Thanks for the tip, I think i got it working.
I cannot modify the values ff_get_buffer() as I go out of a H264Context and
lose the sps information, so I applied the cropping directly on the AVFrame
at the end of decode_frame(). This should be syntactically correct
according to the spec anyways.

Please see if the patches are fine for inclusion in the codebase.
Cheers,
Vittorio

On Wed, Feb 6, 2013 at 9:54 PM, Anton Khirnov <[email protected]> wrote:

>
> On Wed, 6 Feb 2013 18:35:03 +0100, Vittorio Giovara <
> [email protected]> wrote:
> > Hi, I'm trying to work on bug 378 (
> > https://bugzilla.libav.org/show_bug.cgi?id=378) and have the h264
> decoder
> > correctly interpret at least the right and bottom SPS cropping.
> > According to the documentation there coded_width and coded_height that
> > represent the bitstream size and width and height that represent the size
> > of what should be displayed.
> > So, as I got hinted on IRC, it should be possible to apply cropping at
> the
> > end of the decoding stage and so setting avcodeccontext width to
> > coded_width - right_cropping (and similarly for height).
> >
> > However if I'm to not exactly sure *where* this should be done in libav
> > code: if I do that in h264_decode_end() I get a correct size, but the
> image
> > is just stretched, not cropped, while if I put it in decode_slice() I
> > either get a corrupt image or just a full size picture or a lot of error
> > messages (regarding MB decoding or reinitialization). I've pasted my
> > current modifications with the cropping applied in h264_decode_end().
> >
> > What I'm doing wrong? Can anyone give me a few more pointers?
>
> Note that AVFrame also contains width and height. Those are set from the
> AVCodecContext values at get_buffer() time. Try modifying them as well.
>
> --
> Anton Khirnov
>

Attachment: 0001-h264-correctly-interpret-right-cropping-offset-from-.patch
Description: Binary data

Attachment: 0002-h264-correctly-interpret-bottom-cropping-offset-from.patch
Description: Binary data

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to