Commit Graph

7 Commits

Author SHA1 Message Date
Andreas Rheinhardt bc109a53c7 avcodec/mpegpicture: Move mb_var, mc_mb_var and mb_mean to MpegEncCtx
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>
2022-08-09 19:17:22 +02:00
Michael Niedermayer adfde9a646 avformat/avienc: Fix wrongly placed comment
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 17:30:28 +01:00
Michael Niedermayer 42801505cd tests: Add vsynth2 which uses the new reference.pnm
The file is already present in git and by using it we can perform more tests
without the need of fate samples

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 03:39:56 +01:00
Michael Niedermayer ed49b142bb tests: Rename vsynth2 to vsynth_lena
This avoids confusion with a growing number of vsynth tests

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 03:02:30 +01:00
Carl Eugen Hoyos e705d0ce1c Set dwSuggestBufferSize to largest chunk size for every stream in avi.
Fixes playback with WMP 9 for files with large (rawvideo) frames
as explained in ticket #2145.

Fixes ticket #2818.
2014-05-19 00:05:40 +02:00
Michael Niedermayer 7711f19eda Merge commit 'e816034a5fa131b13c4ad87bb0b5065b4f5697c6'
* commit 'e816034a5fa131b13c4ad87bb0b5065b4f5697c6':
  fate-seek: remove use of gnu make 3.82 only private modifier
  fate: move vsynth reference files to their own directory
  fate: move fate-acodec reference files to their own dir
  configure: avplay now depends on avresample
  fate: split dependencies for fate-seek tests

Conflicts:
	configure
	tests/fate/seek.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-03 02:33:27 +01:00
Janne Grunau c8148e5c93 fate: move vsynth reference files to their own directory 2012-12-03 00:36:10 +01:00