[FFmpeg-devel] [PATCH] MOV YUV2 fourcc -> PIX_FMT_YUYV422 mapping
Michael Niedermayer
michaelni
Mon Mar 30 19:31:15 CEST 2009
On Mon, Mar 30, 2009 at 11:12:10AM +0530, Jai Menon wrote:
> On 3/26/09, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote:
> > On Thu, Mar 26, 2009 at 02:22:03PM +0530, Jai Menon wrote:
> > > On 3/26/09, Michael Niedermayer <michaelni at gmx.at> wrote:
> > > > On Wed, Mar 25, 2009 at 08:47:33AM -0700, Baptiste Coudurier wrote:
> > > > > On 3/25/2009 8:35 AM, Reimar D?ffinger wrote:
> > > > > > On Wed, Mar 25, 2009 at 03:01:50PM +0100, Michael Niedermayer wrote:
> > > > > >> On Wed, Mar 25, 2009 at 09:48:51AM +0530, Jai Menon wrote:
> > > > > >>> Index: libavcodec/rawdec.c
> > > > > >>> ===================================================================
> > > > > >>> --- libavcodec/rawdec.c (revision 17944)
> > > > > >>> +++ libavcodec/rawdec.c (working copy)
> > > > > >>> @@ -144,6 +144,13 @@
> > > > > >>> picture->data[2] = tmp;
> > > > > >>> }
> > > > > >>>
> > > > > >>> + if(avctx->codec_tag == MKTAG('y', 'u', 'v', '2')) {
> > > > > >>> + int i;
> > > > > >>> + for(i=1; i<picture->linesize[0]*avctx->height; i+=2) {
> > > > > >>> + picture->data[0][i] ^= 128;
> > > > > >>> + }
> > > > > >>> + }
> >
> >
> > I think you should avoid writing to the padding pixels, particularly
> > since this would not work for negative linesize i.e. something
> > like
> > uint8_t *line = picture->data[0];
> > for (y = 0; y < avctx->height; y++) {
> > for (x = 0; x < avctx->width; x++)
> > line[2*x + 1] ^= 0x80; // convert signed to unsigned
> > line += picture->linesize[0];
> >
> > }
> >
>
> Changed. I didn't realize linesize could be negative.
>
> > > Are you suggesting adding a similar if case in raw_encode which sets
> > > the sign bit? such a patch will be quite intrusive, especially for a
> > > pixel fmt which most people won't use :)
> >
> >
> > Huh? Wouldn't you just need to add exactly the same code between
> > avpicture_layout and the return?
>
> Nevermind, I was looking at adding it in imgconvert code :)
> Revised patch attached.
>
> --
> Regards,
>
> Jai
> Index: libavcodec/rawenc.c
> ===================================================================
> --- libavcodec/rawenc.c (revision 17944)
> +++ libavcodec/rawenc.c (working copy)
> @@ -40,8 +40,19 @@
> static int raw_encode(AVCodecContext *avctx,
> unsigned char *frame, int buf_size, void *data)
> {
> - return avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
> + int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
> avctx->height, frame, buf_size);
> +
> + if(avctx->codec_tag == MKTAG('y', 'u', 'v', '2') && (ret > 0)) {
doesnt this need a pix_fmt check too?
> + int i, j;
> + uint8_t *line = frame;
> + for(j = 0; j < avctx->height; j++) {
> + for(i = 0; i < avctx->width; i++)
x and y are better variable names in this case
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090330/4f5e46e4/attachment.pgp>
More information about the ffmpeg-devel
mailing list