[Ffmpeg-devel] [PATCH] lowres chroma bug
Michael Niedermayer
michaelni
Fri Feb 9 10:54:43 CET 2007
Hi
On Fri, Feb 09, 2007 at 04:42:52PM +0900, Oleg Metelitsa wrote:
> Hello,
>
> > 3) We can add two extra pixels to image in lowres=2 mode:
> > image_stride = image_width + 2
> > chroma_stride = image_width/2 + 2
> > Then the garbage will be written to those extra (dummy) pixels rather
> > than to the beginning of the next row.
>
> Please, find the patch 3) attached. It may be not so interested
> comparing to the patches proposed earlier. But the advantage is it
> does not change non lowres H.264 operation.
>
> Index: libavcodec/utils.c
> ===================================================================
> --- /libavcodec/utils.c (revision 7890)
> +++ /libavcodec/utils.c (working copy)
> @@ -279,7 +279,9 @@
> if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
> w+= EDGE_WIDTH*2;
> h+= EDGE_WIDTH*2;
> - }
> + } else if(s->lowres==2)
> + w+= 4;
> +
> avpicture_fill(&picture, NULL, s->pix_fmt, w, h);
> pixel_size= picture.linesize[0]*8 / w;
>
> The idea is to add 4 pixels before calling avpicture_fill() inside
> avcodec_default_get_buffer function. As a result 4 pixels will be
> added to linesize[0] and 2 pixels to linesize[1] and linesize[2].
>
> All sizes will be aligned inside avpicture_fill(). For example, if we
> have coded_width=640 and width=160 after applying lowres=2 mode, we
> will have linesize[1]=176 and linesize[1]=88 as a result of alignment
> operation.
and it will fail if avocodec_default_get_buffer() isnt used aka for example
in mplayer
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070209/9d59947f/attachment.pgp>
More information about the ffmpeg-devel
mailing list