summaryrefslogtreecommitdiff
path: root/libavutil/frame.c
Commit message (Collapse)AuthorAge
* avutil/frame: fix remove_side_dataZhao Zhili2019-11-11
| | | | | | | | remove_side_data is supposed to remove a single instance by design. Since new_side_data() doesn't forbid add multiple instances of the same type, remove_side_data should deal with that. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil: add ROI (Region Of Interest) data struct and bump versionGuo, Yejun2019-01-17
| | | | | | | | | | | | | | | The encoders such as libx264 support different QPs offset for different MBs, it makes possible for ROI-based encoding. It makes sense to add support within ffmpeg to generate/accept ROI infos and pass into encoders. Typical usage: After AVFrame is decoded, a ffmpeg filter or user's code generates ROI info for that frame, and the encoder finally does the ROI-based encoding. The ROI info is maintained as side data of AVFrame. Signed-off-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* Add HDR dynamic metadata struct (for SMPTE 2094-40) to libavutilMohammad Izadi2018-12-21
| | | | | | | | The dynamic metadata contains data for color volume transform - application 4 of SMPTE 2094-40:2016 standard. The data comes from HEVC in the SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavu/frame: Add error report if av_image_fill_pointers fail.Jun Zhao2018-10-30
| | | | | | | Add error handle if av_image_fill_pointers fail. Signed-off-by: Jun Zhao <mypopydev@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/h264: create AVFrame side data from H.264 timecodesDevin Heitmueller2018-10-23
| | | | | | | | | Create SMPTE ST 12-1 timecodes based on H.264 SEI picture timing info. For framerates > 30 FPS, the field flag is used in conjunction with pairs of frames which contain the same frame timestamp in S12M. Ensure the field is properly set per the spec.
* lavu/frame: Add missing conversions from side data enum to nameJun Zhao2018-09-21
| | | | | | Add missing conversions from side data enum to name. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* Merge commit 'f89ec87afaf0d1abb6d450253b0b348fd554533b'James Almer2018-09-11
|\ | | | | | | | | | | | | | | * commit 'f89ec87afaf0d1abb6d450253b0b348fd554533b': frame: Simplify the video allocation Merged-by: James Almer <jamrial@gmail.com> Padding-Remixed-by: Michael Niedermayer <michael@niedermayer.cc>
| * frame: Simplify the video allocationLuca Barbato2018-08-05
| |
| * lavc, lavu: move frame cropping to a convenience functionwm42017-07-26
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * AVFrame: add an opaque_ref fieldwm42017-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an extended version of the AVFrame.opaque field, which can be used to attach arbitrary user information to an AVFrame. The usefulness of the opaque field is rather limited, because it can store only up to 32 bits of information (or 64 bit on 64 bit systems). It's not possible to set this field to a memory allocation, because there is no way to deallocate it correctly. The opaque_ref field circumvents this by letting the user set an AVBuffer, which makes the user data refcounted. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Use the same name for stereo3d frame/packet side dataVittorio Giovara2018-06-05
| |
* | avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPALwm42018-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PSEUDOPAL pixel formats are not paletted, but carried a palette with the intention of allowing code to treat unpaletted formats as paletted. The palette simply mapped the byte values to the resulting RGB values, making it some sort of LUT for RGB conversion. It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8, GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap formats. The last one, GRAY8, is more common, but its treatment is grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming from typical Y video planes was not mapped to the correct RGB values. This cannot be fixed, because AVFrame.color_range can be freely changed at runtime, and there is nothing to ensure the pseudo palette is updated. Also, nothing actually used the PSEUDOPAL palette data, except xwdenc (trivially changed in the previous commit). All other code had to treat it as a special case, just to ignore or to propagate palette data. In conclusion, this was just a very strange old mechnaism that has no real justification to exist anymore (although it may have been nice and useful in the past). Now it's an artifact that makes the API harder to use: API users who allocate their own pixel data have to be aware that they need to allocate the palette, or FFmpeg will crash on them in _some_ situations. On top of this, there was no API to allocate the pseuo palette outside of av_frame_get_buffer(). This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes the pseudo palette optional. Nothing accesses it anymore, though if it's set, it's propagated. It's still allocated and initialized for compatibility with API users that rely on this feature. But new API users do not need to allocate it. This was an explicit goal of this patch. Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0. Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition, FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation functions manually changed to not allocating a palette.
* | lavu/frame: add QP side datawm42018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a way for an API user to transfer QP data and metadata without having to keep the reference to AVFrame, and without having to explicitly care about QP APIs. It might also provide a way to finally remove the deprecated QP related fields. In the end, the QP table should be handled in a very similar way to e.g. AV_FRAME_DATA_MOTION_VECTORS. There are two side data types, because I didn't care about having to repack the QP data so the table and the metadata are in a single AVBufferRef. Otherwise it would have either required a copy on decoding (extra slowdown for something as obscure as the QP data), or would have required making intrusive changes to the codecs which support export of this data. The new side data types are added under deprecation guards, because I don't intend to change the status of the QP export as being deprecated (as it was before this patch too).
* | lavu/frame: fix inconsistent qp_table_buf deprecationwm42018-03-18
| | | | | | | | | | | | Everything related to the QP data is deprecated, with qp_table_buf being an inconsistent exception. Some parts were under the deprecation guards, some not. It probably didn't even compile.
* | frame: add an av_frame_new_side_data_from_buf functionRostislav Pehlivanov2018-03-01
| | | | | | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* | avutil/frame: Add private_ref to AVFrameMichael Niedermayer2017-11-10
| | | | | | | | | | | | | | This gives FFmpeg libs a field that they can freely and safely use. Avoiding the need of wrapping of a users opaque_ref field and its issues. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/frame: deprecate getters and setters for AVFrame fieldsJames Almer2017-10-29
| | | | | | | | | | | | | | The fields can be accessed directly, so these are not needed anymore. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | avutil/frame: remove unneccessary metadata pointer getterJames Almer2017-10-23
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '4de220d2e3751c459f8739a08ac6ca52e63eba30'James Almer2017-09-27
|\| | | | | | | | | | | | | | | | | * commit '4de220d2e3751c459f8739a08ac6ca52e63eba30': frame: allow align=0 (meaning automatic) for av_frame_get_buffer() See https://ffmpeg.org/pipermail/ffmpeg-devel/2017-September/215834.html Merged-by: James Almer <jamrial@gmail.com>
| * frame: allow align=0 (meaning automatic) for av_frame_get_buffer()Anton Khirnov2017-02-11
| | | | | | | | | | This will avoid every caller from hardcoding some specific alignment, which may break in the future with new instruction sets.
* | lavc, lavu: move frame cropping to a convenience functionwm42017-08-08
| | | | | | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net> Merged from Libav commit 47399ccdfd.
* | avutil/frame: add ICC Profile to av_frame_side_data_nameJames Almer2017-07-26
| | | | | | | | | | Reviwed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '52627248e49e58eb4b78e4fcda90a64f4c476ea3'James Almer2017-05-08
|\| | | | | | | | | | | | | * commit '52627248e49e58eb4b78e4fcda90a64f4c476ea3': frame: add a cropping rectangle to AVFrame Merged-by: James Almer <jamrial@gmail.com>
| * frame: add a cropping rectangle to AVFrameAnton Khirnov2017-01-12
| | | | | | | | | | Extend the width/height doxy to clarify that it should store coded values.
* | lavu: add support for Content Light Level side metadataSteve Lhomme2017-04-06
| | | | | | | | | | | | As found in HEVC. Signed-off-by: James Almer <jamrial@gmail.com>
* | Revert "avutil/frame: Disallow zero sized frame side data"Michael Niedermayer2017-03-03
| | | | | | | | | | | | | | | | | | Found a case where we use size==0, the other related commits remain needed, and should be sufficient to fix the original issue This reverts commit 7e4f32f4e4b93c95dcc872cb844c5548e69f352e. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/frame: Disallow zero sized frame side dataMichael Niedermayer2017-02-25
| | | | | | | | | | | | | | There should be no case that needs this and its a potential for creating corner cases Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/frame: Reimplement av_frame_new_side_data() without size=0 special caseMichael Niedermayer2017-02-25
| | | | | | | | | | | | | | | | | | | | | | | | The size 0 special case causes side data to be created which is different and a special case if for any reasons size = 0 is passed Fixes: multiple runtime error: null pointer passed as argument 1, which is declared to never be null Fixes: 653/clusterfuzz-testcase-5773837415219200 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | AVFrame: add an opaque_ref fieldwm42017-02-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an extended version of the AVFrame.opaque field, which can be used to attach arbitrary user information to an AVFrame. The usefulness of the opaque field is rather limited, because it can store only up to 32 bits of information (or 64 bit on 64 bit systems). It's not possible to set this field to a memory allocation, because there is no way to deallocate it correctly. The opaque_ref field circumvents this by letting the user set an AVBuffer, which makes the user data refcounted. Signed-off-by: Anton Khirnov <anton@khirnov.net> Merges Libav commit 04f3bd349651.
* | avutil/frame: fix av_frame_copy for unknown layoutsMarton Balint2017-01-31
| | | | | | | | | | | | | | | | | | I wonder how unknown layouts ever worked without this? Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avutil/frame: fix indention after last commitMichael Niedermayer2016-11-16
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/frame: Copy size=0 side data in ff_init_buffer_info()Michael Niedermayer2016-11-16
| | | | | | | | | | | | | | | | Fixes null pointer dereference Fixes: 189/FOO Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'Hendrik Leppkes2016-10-07
|\| | | | | | | | | | | | | * commit '32c8359093d1ff4f45ed19518b449b3ac3769d27': lavc: export the timestamps when decoding in AVFrame.pts Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: export the timestamps when decoding in AVFrame.ptsAnton Khirnov2016-06-21
| | | | | | | | | | | | | | | | | | | | | | Currently it's exported as AVFrame.pkt_pts, which is also the only use for that field. The reason it is done like this is that lavc used to export various codec-specific "timing" information in AVFrame.pts, which is not done anymore. Since it is confusing to the callers to have a separate field which is used only for decoder timestamps and nothing else, deprecate pkt_pts and use just AVFrame.pts everywhere.
* | avutil/frame: Add a flag to discard frame after decode.Sasi Inguva2016-09-19
| | | | | | | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/frame: access avframe fields directly in get_frame_defaults()James Almer2016-07-25
| | | | | | | | | | | | | | The accessors are needed only from outside libavutil. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avutil/frame: Assert that width/height/channels is 0 for the destination of ↵Michael Niedermayer2016-06-05
| | | | | | | | | | | | av_frame*_ref() This should detect caes where these functions are called in unclean destinations
* | Merge commit '29c2d06d67724e994980045afa055c6c34611b30'Derek Buitenhuis2016-02-24
|\| | | | | | | | | | | | | * commit '29c2d06d67724e994980045afa055c6c34611b30': cosmetics: Drop empty comment lines Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * cosmetics: Drop empty comment linesDiego Biurrun2016-02-18
| |
* | Merge commit '89923e418b494e337683442ab896d754bc07341a'Derek Buitenhuis2016-02-17
|\| | | | | | | | | | | | | * commit '89923e418b494e337683442ab896d754bc07341a': lavu: add a framework for handling hwaccel frames Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavu: add a framework for handling hwaccel framesAnton Khirnov2016-02-14
| |
| * lavu: add AV_CEIL_RSHIFT and use it in various placesClément Bœsch2016-01-11
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avutil/frame: Free destination qp_table_buf in frame_copy_props()Michael Niedermayer2016-02-13
| | | | | | | | | | | | | | Fixes memleak Fixes: Ticket4899 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil: Add GOP timecode frame side dataDerek Buitenhuis2016-02-01
| | | | | | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-27
| | | | | | | | | | | | | | | | | | | | Libav, for some reason, merged this as a public API function. This will aid in future merges. A define is left for backwards compat, just in case some person used it, since it is in a public header. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Add missing conversions from side data enum to nameNeil Birkbeck2016-01-22
| | | | | | | | | | | | | | Add names for recently added enums to av_frame_side_data_name. Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavu/frame: use AVPALETTE_SIZE instead of 1024Clément Bœsch2015-12-08
| |
* | Merge commit '1aa24df74c052a73175c43e57d35b4835e537ec8'Hendrik Leppkes2015-10-03
|\| | | | | | | | | | | | | * commit '1aa24df74c052a73175c43e57d35b4835e537ec8': lavu: Deprecate AVFrame.error[] Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavu: Deprecate AVFrame.error[]Vittorio Giovara2015-09-30
| | | | | | | | | | | | | | | | | | | | | | These field are difficult to interpret, and are provided by a single encoder (mpegvideoenc). In general they do not belong to a structure containing raw data only, so remove them from AVFrame. Mpegvideoenc now uses a private field in Picture for its internal computations. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavu/frame: put frame QP elements under a new version guardHendrik Leppkes2015-09-05
| | | | | | | | These fields are still used, removal postponed until a replacement functionality is available.