[FFmpeg-devel] [PATCH] Enable PAFF decoding
Jeff Downs
heydowns
Wed Oct 10 15:32:41 CEST 2007
On Wed, 10 Oct 2007, Neil Brown wrote:
[...]
> 3 issues:
>
> 1/ The first few frames are in the wrong order.
>
> The first 3 field-pairs in my files are:
> I+P (poc 0 and 1)
> B+B (poc -4 and -3)
> B+B (poc -2 and -1)
>
> I'm getting the first pair out first, then the second decodes
> imperfectly. I haven't figured out why yet. The same thing doesn't
> happen when you cross an IDR frame, so there must be something
> "special" about the very start.
Do your files start with IDR?
> 2/ The frames are not 100% identical to those generated by the
> reference decoder.
>
> I use
> ffmpeg -i test.mts -t 0.2 /tmp/ff%d.ppm
> and
> ffmpeg -s 1440x1080 -i test.yuv -t 0.2 /tmp/ref%d.ppm
>
> to collect the frames, find two that look the same (i.e. compensate
> for the ordering problems), load them as two different layers into
> GIMP, and use the "Difference" Mode to find the difference.
>
> The result looks black, but when you look at the histogram or adjust
> the thresholds, there are differences, mostly 1 or 2, but as much as
> 10.
> I won't be losing sleep over this, but I thought you should know.
Me neither :) Maybe someone else will, but as Andreas posted (thanks) it
happens with non-PAFF so I'm not going to concentrate on this one.
> 3/ I'm getting the error message:
> [h264 @ 0xa638a0]MBAFF + spatial direct mode is not implemented
>
> a lot. As the file doesn't use MBAFF (only PAFF) I suspect this is
> wrong.
>
> Maybe this patch is correct?
>
> Thanks,
>
> NeilBrown
>
> ---
> libavcodec/h264.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- ffmpeg.orig/libavcodec/h264.c
> +++ ffmpeg/libavcodec/h264.c
> @@ -4396,7 +4396,7 @@ static int decode_slice_header(H264Conte
> if(h->slice_type == P_TYPE || h->slice_type == SP_TYPE || h->slice_type == B_TYPE){
> if(h->slice_type == B_TYPE){
> h->direct_spatial_mv_pred= get_bits1(&s->gb);
> - if(h->sps.mb_aff && h->direct_spatial_mv_pred)
> + if(h->mb_aff_frame && h->direct_spatial_mv_pred)
> av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF + spatial direct mode is not implemented\n");
> }
> num_ref_idx_active_override_flag= get_bits1(&s->gb);
Looks right to me. This was actually in my orignal PAFF patch (I think
taken from your priliminary PAFF patch of long ago) because I do get
similar errors. I pulled it out during the splitting process.
The problem is that the SPS has to include the MBAFF flag for any
interlaced sequence (including PAFF). But for a PAFF frame, its value is
meaningless; an encoder could freely set it either way. mb_aff_frame is
the correct flag to test.
-Jeff
More information about the ffmpeg-devel
mailing list