summaryrefslogtreecommitdiff
path: root/libavcodec/ratecontrol.c
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/mpegvideo: Move encoder-only stuff to a new headerAndreas Rheinhardt2022-02-13
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ratecontrol: fix the integer overflow after long time runLimin Wang2020-06-03
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* Merge commit '3b50dbc51fb0978d09c1a5b83d4bf5a59d170e1e'James Almer2017-03-31
|\ | | | | | | | | | | | | * commit '3b50dbc51fb0978d09c1a5b83d4bf5a59d170e1e': ratecontrol: Use correct function pointer casts instead of void* Merged-by: James Almer <jamrial@gmail.com>
| * ratecontrol: Use correct function pointer casts instead of void*Diego Biurrun2016-11-12
| | | | | | | | | | libavcodec/ratecontrol.c:120:9: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic] libavcodec/ratecontrol.c:121:9: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]
* | Merge commit 'a1f6a2dfdaf9beb42ca66e49d10bfaf5905a0128'Clément Bœsch2017-02-01
|\| | | | | | | | | | | | | | | | | | | * commit 'a1f6a2dfdaf9beb42ca66e49d10bfaf5905a0128': ratecontrol: Reorder functions to avoid forward declarations Merged, but this seems to break the clear separation of 1-pass vs 2-pass. Merged-by: Clément Bœsch <u@pkh.me>
| * ratecontrol: Reorder functions to avoid forward declarationsVittorio Giovara2016-07-20
| |
* | Merge commit 'd639dcdae022130078c9c84b7b691c5e9694786c'Clément Bœsch2017-02-01
|\| | | | | | | | | | | | | * commit 'd639dcdae022130078c9c84b7b691c5e9694786c': ratecontrol: Move Xvid-related functions to the place they are actually used Merged-by: Clément Bœsch <u@pkh.me>
| * ratecontrol: Move Xvid-related functions to the place they are actually usedVittorio Giovara2016-07-20
| | | | | | | | This will simplify the de-MpegEncContextualization.
| * ratecontrol: Move mpegenc-only function where it is usedVittorio Giovara2016-07-20
| |
* | Merge commit 'b4bb9593834460bbbe0e70823f2c503cb01ad052'James Almer2017-01-31
|\| | | | | | | | | | | | | * commit 'b4bb9593834460bbbe0e70823f2c503cb01ad052': ratecontrol: Drop commented out cruft Merged-by: James Almer <jamrial@gmail.com>
| * ratecontrol: Drop commented out cruftVittorio Giovara2016-07-20
| |
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/mpegvideo: use constants for rc_strategyClément Bœsch2015-12-04
| |
* | avcodec/ratecontrol: use predefined M_EGanesh Ajjanagadde2015-11-14
| | | | | | | | | | | | | | | | M_E is defined in math.h, or in avutil/mathematics.h for compatibility hacks. This uses this value instead of an ad-hoc define. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | avcodec/mpegvideo: change bit_rate to 64bitMichael Niedermayer2015-09-02
| | | | | | | | | | | | | | | | | | 32bit is not sufficient for all cases Fixes: signal_sigabrt_7ffff6ac8cc9_686_cov_1897408623_microsoft_new_way_to_shove_mpeg2_in_asf.dvr_ms Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615': lavc: AV-prefix all codec flags Conflicts: doc/examples/muxing.c ffmpeg.c ffmpeg_opt.c ffplay.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/ac3enc_float.c libavcodec/atrac1.c libavcodec/atrac3.c libavcodec/atrac3plusdec.c libavcodec/dcadec.c libavcodec/ffv1enc.c libavcodec/h264.c libavcodec/h264_loopfilter.c libavcodec/h264_mb.c libavcodec/imc.c libavcodec/libmp3lame.c libavcodec/libtheoraenc.c libavcodec/libtwolame.c libavcodec/libvpxenc.c libavcodec/libxavs.c libavcodec/libxvid.c libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegaudiodec_template.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/nellymoserdec.c libavcodec/nellymoserenc.c libavcodec/nvenc.c libavcodec/on2avc.c libavcodec/options_table.h libavcodec/opus_celt.c libavcodec/pngenc.c libavcodec/ra288.c libavcodec/ratecontrol.c libavcodec/twinvq.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c libavcodec/vorbisdec.c libavcodec/vp3.c libavcodec/wma.c libavcodec/wmaprodec.c libavcodec/x86/hpeldsp_init.c libavcodec/x86/me_cmp_init.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec flagsVittorio Giovara2015-07-27
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '1761ab838c75223a6b97d8c0720d09275374c53d'Michael Niedermayer2015-07-09
|\| | | | | | | | | | | | | | | | | | | | | * commit '1761ab838c75223a6b97d8c0720d09275374c53d': lavc: Deprecate avctx.rc_strategy Conflicts: libavcodec/mpegvideo.h libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: Deprecate avctx.rc_strategyVittorio Giovara2015-07-08
| | | | | | | | | | | | | | Only used by libxvid in ratecontrol module, so move it to a codec private option. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '42df71d9bbb1a5b4bce0bb34417692565c72d390'Michael Niedermayer2015-06-01
|\| | | | | | | | | | | | | | | | | | | | | * commit '42df71d9bbb1a5b4bce0bb34417692565c72d390': ratecontrol: Check memory allocation Conflicts: libavcodec/ratecontrol.c See: 0898a6d4e4b669704fce663f610aa43dd7483fe9 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ratecontrol: Check memory allocationVittorio Giovara2015-05-31
| |
* | Merge commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42'Michael Niedermayer2015-05-22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42': mpegvideo: Drop flags and flags2 Conflicts: libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/ratecontrol.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: Drop flags and flags2Vittorio Giovara2015-05-22
| | | | | | | | They are just duplicates of AVCodecContext members so use those instead.
* | Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'Michael Niedermayer2015-04-20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25': lavc: Replace av_dlog and tprintf with internal macros Conflicts: libavcodec/aacdec.c libavcodec/audio_frame_queue.c libavcodec/bitstream.c libavcodec/dcadec.c libavcodec/dnxhddec.c libavcodec/dvbsubdec.c libavcodec/dvdec.c libavcodec/dvdsubdec.c libavcodec/get_bits.h libavcodec/gifdec.c libavcodec/h264.h libavcodec/h264_cabac.c libavcodec/h264_cavlc.c libavcodec/h264_loopfilter.c libavcodec/h264_refs.c libavcodec/imc.c libavcodec/interplayvideo.c libavcodec/jpeglsdec.c libavcodec/libopencore-amr.c libavcodec/mjpegdec.c libavcodec/mpeg12dec.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_parser.c libavcodec/pngdec.c libavcodec/ratecontrol.c libavcodec/rv10.c libavcodec/svq1dec.c libavcodec/vqavideo.c libavcodec/wmadec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: Replace av_dlog and tprintf with internal macrosVittorio Giovara2015-04-19
| |
* | avcodec/ratecontrol: replace asserts by av_assertsMichael Niedermayer2015-01-31
| | | | | | | | | | | | Also remove the now unneeded #include <assert.h> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/ratecontrol: Check for av_malloc*() failuresMichael Niedermayer2015-01-10
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '530c1441fd1426b6a4bb33485ff3226e1ae0ad45'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | | | | | | | * commit '530c1441fd1426b6a4bb33485ff3226e1ae0ad45': lavc: make lmax/lmin into private options of mpegvideo encoders Conflicts: libavcodec/avcodec.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make lmax/lmin into private options of mpegvideo encodersAnton Khirnov2014-10-18
| |
* | Merge commit '15ec053c4c0b198a2e93eb8e60c8f41e091e0c40'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | * commit '15ec053c4c0b198a2e93eb8e60c8f41e091e0c40': lavc: make border_masking into private options of mpegvideo encoders Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make border_masking into private options of mpegvideo encodersAnton Khirnov2014-10-18
| |
* | Merge commit '66a68ddd1ac376b24db8695058bc8fc28f5bada6'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | * commit '66a68ddd1ac376b24db8695058bc8fc28f5bada6': lavc: make rc_buffer_aggressivity/rc_initial_cplx into private options of mpegvideo encoders Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make rc_buffer_aggressivity/rc_initial_cplx into private options of ↵Anton Khirnov2014-10-18
| | | | | | | | mpegvideo encoders
* | Merge commit 'a75c2eb25a62105c09b48521aef429dc8a231637'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | | | | | | | * commit 'a75c2eb25a62105c09b48521aef429dc8a231637': lavc: make rc_eq into private options of mpegvideo encoders Conflicts: libavcodec/options_table.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make rc_eq into private options of mpegvideo encodersAnton Khirnov2014-10-18
| |
* | Merge commit '946f95354ba76ef73c9b66889d86ab5fba4fb486'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | * commit '946f95354ba76ef73c9b66889d86ab5fba4fb486': lavc: make rc_qmod_* into private options of mpegvideo encoders Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make rc_qmod_* into private options of mpegvideo encodersAnton Khirnov2014-10-18
| |
* | Merge commit 'a6e4ce9fd50897dc6d9c2ada4b6b8090de7de5bf'Michael Niedermayer2014-10-18
|\| | | | | | | | | | | | | | | | | | | * commit 'a6e4ce9fd50897dc6d9c2ada4b6b8090de7de5bf': lavc: make rc_qsquish a private option of mpegvideo encoders Conflicts: libavcodec/avcodec.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make rc_qsquish a private option of mpegvideo encodersAnton Khirnov2014-10-18
| |
* | avcodec/ratecontrol: remove unneeded statementMichael Niedermayer2014-07-31
| | | | | | | | | | Found-by: CSA Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'b2c31710c96fa47d9dcd40b64d39663e8957f683'Michael Niedermayer2014-05-01
|\| | | | | | | | | | | | | | | | | | | * commit 'b2c31710c96fa47d9dcd40b64d39663e8957f683': lavc: move CODEC_FLAG_NORMALIZE_AQP to mpegvideo Conflicts: libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: move CODEC_FLAG_NORMALIZE_AQP to mpegvideoAnton Khirnov2014-05-01
| |
* | avcodec/ratecontrol: use av_malloc_array()Michael Niedermayer2014-04-20
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2014-04-09
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: mpegvideo: operate with pointers to AVFrames instead of whole structs Conflicts: libavcodec/h261dec.c libavcodec/h263dec.c libavcodec/intrax8.c libavcodec/mpeg12enc.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/mpegvideo_xvmc.c libavcodec/msmpeg4.c libavcodec/ratecontrol.c libavcodec/vaapi.c libavcodec/vc1dec.c libavcodec/vdpau_vc1.c See: fc567ac49e17151f00f31b59030cd10f952612ef Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: operate with pointers to AVFrames instead of whole structswm42014-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | The most interesting parts are initialization in ff_MPV_common_init() and uninitialization in ff_MPV_common_end(). ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL checks for Picture.f, because these functions can be called on uninitialized or partially initialized Pictures. NULL pointer checks are added to ff_thread_release_buffer() stub function. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/ratecontrol: make (mc_)mb_var_sum(_last) 64bitMichael Niedermayer2014-03-21
| | | | | | | | This avoids hypothetical integer overflows