Hi On Tue, Sep 25, 2007 at 03:51:11PM -0400, Jeff Downs wrote:
On Mon, 24 Sep 2007, Jeff Downs wrote:
On Mon, 24 Sep 2007, Michael Niedermayer wrote:
IMHO the AVFrame.reference code should be fixed first unless this turns out to be very complex to fix
OK. I took a second look at how Picture.reference is used in mpegvideo.c and h264.c. For current SVN (no PAFF), its not too difficult to fix (replace use of reference = 1 with 4 as suggested).
When PAFF is considered, two problems present:
First, a place to store a second field's "is a reference" flag is needed, separate from the reference marking of the first field in a pair.
Would using s->dropable for this be an acceptable solution? Or should I continue with current_picture.reference?
This way:
s->dropable == current field or frame needs reference marking when complete.
current_picture.(_ptr->)reference == PICT_XXX, or 4, as dictated by and set in reference picture marking process and delayed picture holding.
Second, MPV_frame_start forces a value of 3 onto reference for ref frames. This could be solved by replacing "3" with s->picture_structure. But that doesn't really make complete sense for mpeg2.
Another option is to let MPV_frame_start still set 3, but override in h264 with picture_structure.
Another option still is to override with zero, and then let the frame end processing (ref marking and pic output) take total control of the reference variable handling. This is good because it isolates reference handling to one area.
Attached is a patch that cleans up handling of Picture.reference in h264 using some of the above-described approach.
I decided to change MPV_frame_start to use s->picture_structure for reference in h264 case because it was already testing for h264 there anyway. This prepares for PAFF implementation.
This also makes current_picture.reference necessarily == current_picture_ptr->reference and updates any tests of either to have field references in mind.
If ok, I will update PAFF implementation based on this.
ok [...]
+/* + * Value of Picture.reference when Picture is not a reference picture, but + * is held for delayed output. + */ +#define DELAYED_PIC_REF 4
not doxygen compatible [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates