comparison raw.c @ 3587:d4ab276e5987 libavcodec

Add YV12 support, patch by Steve Lhomme % steve P lhomme A free P fr % Original thread: Date: Aug 17, 2006 5:45 PM Subject: Re: [Ffmpeg-devel] [PATCH] AVISynth support
author gpoirier
date Fri, 18 Aug 2006 07:55:08 +0000
parents 78963e63a45c
children 20545fbb6f7c
comparison
equal deleted inserted replaced
3586:2194398c2c0f 3587:d4ab276e5987
36 } PixelFormatTag; 36 } PixelFormatTag;
37 37
38 const PixelFormatTag pixelFormatTags[] = { 38 const PixelFormatTag pixelFormatTags[] = {
39 { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ 39 { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
40 { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, 40 { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
41 { PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
41 { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, 42 { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
42 { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, 43 { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
43 { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, 44 { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
44 { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, 45 { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
45 { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') }, 46 { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') },
139 memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); 140 memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
140 avctx->palctrl->palette_changed = 0; 141 avctx->palctrl->palette_changed = 0;
141 } 142 }
142 143
143 flip(avctx, picture); 144 flip(avctx, picture);
145
146 if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2'))
147 {
148 // swap fields
149 unsigned char *tmp = picture->data[1];
150 picture->data[1] = picture->data[2];
151 picture->data[2] = tmp;
152 }
153
144 *data_size = sizeof(AVPicture); 154 *data_size = sizeof(AVPicture);
145 return buf_size; 155 return buf_size;
146 } 156 }
147 157
148 static int raw_close_decoder(AVCodecContext *avctx) 158 static int raw_close_decoder(AVCodecContext *avctx)