summaryrefslogtreecommitdiff
path: root/libavcodec/mpegpicture.h
Commit message (Collapse)AuthorAge
* avcodec/mpegpicture: Move encoding_error and mb_var_sum to MpegEncCtxAndreas Rheinhardt2022-08-10
| | | | | | | | These fields are only ever set by the encoder for the current picture and for no other picture. So only one set of these values needs to exist, so move them to MpegEncContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Move mb_var, mc_mb_var and mb_mean to MpegEncCtxAndreas Rheinhardt2022-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tables are only used by encoders and only for the current picture; ergo they need not be put into the picture at all, but rather into the encoder's context. They also don't need to be refcounted, because there is only one owner. In contrast to this, the earlier code refcounts them which incurs unnecessary overhead. These references are not unreferenced in ff_mpeg_unref_picture() (they are kept in order to have something like a buffer pool), so that several buffers are kept at the same time, although only one is needed, thereby wasting memory. The code also propagates references to other pictures not part of the pictures array (namely the copy of the current/next/last picture in the MpegEncContext which get references of their own). These references are not unreferenced in ff_mpeg_unref_picture() (the buffers are probably kept in order to have something like a pool), yet if the current picture is a B-frame, it gets unreferenced at the end of ff_mpv_encode_picture() and its slot in the picture array will therefore be reused the next time; but the copy of the current picture also still has its references and therefore these buffers will be made duplicated in order to make them writable in the next call to ff_mpv_encode_picture(). This is of course unnecessary. Finally, ff_find_unused_picture() is supposed to just return any unused picture and the code is supposed to work with it; yet for the vsynth*-mpeg4-adap tests the result depends upon the content of these buffers; given that this patchset changes the content of these buffers (the initial content is now the state of these buffers after encoding the last frame; before this patch the buffers used came from the last picture that occupied the same slot in the picture array) their ref-files needed to be changed. This points to a bug somewhere (if one removes the initialization, one gets uninitialized reads in adaptive_quantization in ratecontrol.c). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Constify src parameter of ff_update_picture_tablesAndreas Rheinhardt2022-02-13
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-09
| | | | | | | | | | | | | | | | | | | | | | | The majority of frame-threaded decoders (mainly the intra-only) need exactly one part of ThreadFrame: The AVFrame. They don't need the owners nor the progress, yet they had to use it because ff_thread_(get|release)_buffer() requires it. This commit changes this and makes these functions work with ordinary AVFrames; the decoders that need the extra fields for progress use ff_thread_(get|release)_ext_buffer() which work exactly as ff_thread_(get|release)_buffer() used to do. This also avoids some unnecessary allocations of progress AVBuffers, namely for H.264 and HEVC film grain frames: These frames are not used for synchronization and therefore don't need a ThreadFrame. Also move the ThreadFrame structure as well as ff_thread_ref_frame() to threadframe.h, the header for frame-threaded decoders with inter-frame dependencies. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Add function to completely free MPEG-PictureAndreas Rheinhardt2022-01-29
| | | | | | | | | Also use said function in mpegvideo.c and mpegvideo_enc.c; and make ff_free_picture_tables() static as it isn't needed anymore outside of mpegpicture.c. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Decrease size of encoding_error arrayAndreas Rheinhardt2022-01-13
| | | | | | | | | | | | | The current size is AV_NUM_DATA_POINTERS (i.e. eight). This number is chosen in order to minimize the amount of allocations for AVFrame.extended_(data|buf) for audio; it is meaningless for video for which four is sufficient. So decrease this array in order to minimize what is copied in ff_mpeg_ref_picture() and at the places that copy a whole MpegEncContext. Also do the same for snowenc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* mpegvideo: use the AVVideoEncParams API for exporting QP tablesAnton Khirnov2021-01-01
| | | | | | | | | | Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS flag. Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE* API. Temporarily disable fate-filter-pp, fate-filter-pp7, fate-filter-spp. They will be reenabled once these filters are converted in following commits.
* 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>
* | Merge commit '7061bf0925a7d6c5899bbe710b2b8cdae9005274'Michael Niedermayer2015-06-10
|/ | | | | | | | | | | * commit '7061bf0925a7d6c5899bbe710b2b8cdae9005274': mpegvideo: Move Picture-related functions to a separate file Conflicts: libavcodec/mpegvideo.c libavcodec/mpegvideo.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
* mpegvideo: Move Picture-related functions to a separate fileVittorio Giovara2015-06-10