comparison imgconvert.c @ 10136:399b5d6b5439 libavcodec

Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt(). Patch by Lars T¸«£uber <lars <dot> taeuber <at> gmx <dot> net>.
author ramiro
date Sat, 05 Sep 2009 23:33:25 +0000
parents 5d5562aa94df
children 4c1259af2fce
comparison
equal deleted inserted replaced
10135:a3abf068e05e 10136:399b5d6b5439
128 .color_type = FF_COLOR_YUV, 128 .color_type = FF_COLOR_YUV,
129 .pixel_type = FF_PIXEL_PLANAR, 129 .pixel_type = FF_PIXEL_PLANAR,
130 .depth = 8, 130 .depth = 8,
131 .x_chroma_shift = 0, .y_chroma_shift = 1, 131 .x_chroma_shift = 0, .y_chroma_shift = 1,
132 }, 132 },
133 [PIX_FMT_YUV420PLE] = { 133 [PIX_FMT_YUV420P16LE] = {
134 .name = "yuv420ple", 134 .name = "yuv420p16le",
135 .nb_channels = 3, 135 .nb_channels = 3,
136 .color_type = FF_COLOR_YUV, 136 .color_type = FF_COLOR_YUV,
137 .pixel_type = FF_PIXEL_PLANAR, 137 .pixel_type = FF_PIXEL_PLANAR,
138 .depth = 16, 138 .depth = 16,
139 .x_chroma_shift = 1, .y_chroma_shift = 1, 139 .x_chroma_shift = 1, .y_chroma_shift = 1,
140 }, 140 },
141 [PIX_FMT_YUV422PLE] = { 141 [PIX_FMT_YUV422P16LE] = {
142 .name = "yuv422ple", 142 .name = "yuv422p16le",
143 .nb_channels = 3, 143 .nb_channels = 3,
144 .color_type = FF_COLOR_YUV, 144 .color_type = FF_COLOR_YUV,
145 .pixel_type = FF_PIXEL_PLANAR, 145 .pixel_type = FF_PIXEL_PLANAR,
146 .depth = 16, 146 .depth = 16,
147 .x_chroma_shift = 1, .y_chroma_shift = 0, 147 .x_chroma_shift = 1, .y_chroma_shift = 0,
148 }, 148 },
149 [PIX_FMT_YUV444PLE] = { 149 [PIX_FMT_YUV444P16LE] = {
150 .name = "yuv444ple", 150 .name = "yuv444p16le",
151 .nb_channels = 3, 151 .nb_channels = 3,
152 .color_type = FF_COLOR_YUV, 152 .color_type = FF_COLOR_YUV,
153 .pixel_type = FF_PIXEL_PLANAR, 153 .pixel_type = FF_PIXEL_PLANAR,
154 .depth = 16, 154 .depth = 16,
155 .x_chroma_shift = 0, .y_chroma_shift = 0, 155 .x_chroma_shift = 0, .y_chroma_shift = 0,
156 }, 156 },
157 [PIX_FMT_YUV420PBE] = { 157 [PIX_FMT_YUV420P16BE] = {
158 .name = "yuv420pbe", 158 .name = "yuv420p16be",
159 .nb_channels = 3, 159 .nb_channels = 3,
160 .color_type = FF_COLOR_YUV, 160 .color_type = FF_COLOR_YUV,
161 .pixel_type = FF_PIXEL_PLANAR, 161 .pixel_type = FF_PIXEL_PLANAR,
162 .depth = 16, 162 .depth = 16,
163 .x_chroma_shift = 1, .y_chroma_shift = 1, 163 .x_chroma_shift = 1, .y_chroma_shift = 1,
164 }, 164 },
165 [PIX_FMT_YUV422PBE] = { 165 [PIX_FMT_YUV422P16BE] = {
166 .name = "yuv422pbe", 166 .name = "yuv422p16be",
167 .nb_channels = 3, 167 .nb_channels = 3,
168 .color_type = FF_COLOR_YUV, 168 .color_type = FF_COLOR_YUV,
169 .pixel_type = FF_PIXEL_PLANAR, 169 .pixel_type = FF_PIXEL_PLANAR,
170 .depth = 16, 170 .depth = 16,
171 .x_chroma_shift = 1, .y_chroma_shift = 0, 171 .x_chroma_shift = 1, .y_chroma_shift = 0,
172 }, 172 },
173 [PIX_FMT_YUV444PBE] = { 173 [PIX_FMT_YUV444P16BE] = {
174 .name = "yuv444pbe", 174 .name = "yuv444p16be",
175 .nb_channels = 3, 175 .nb_channels = 3,
176 .color_type = FF_COLOR_YUV, 176 .color_type = FF_COLOR_YUV,
177 .pixel_type = FF_PIXEL_PLANAR, 177 .pixel_type = FF_PIXEL_PLANAR,
178 .depth = 16, 178 .depth = 16,
179 .x_chroma_shift = 0, .y_chroma_shift = 0, 179 .x_chroma_shift = 0, .y_chroma_shift = 0,
660 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; 660 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
661 picture->linesize[0] = width; 661 picture->linesize[0] = width;
662 picture->linesize[1] = w2; 662 picture->linesize[1] = w2;
663 picture->linesize[2] = w2; 663 picture->linesize[2] = w2;
664 break; 664 break;
665 case PIX_FMT_YUV420PLE: 665 case PIX_FMT_YUV420P16LE:
666 case PIX_FMT_YUV422PLE: 666 case PIX_FMT_YUV422P16LE:
667 case PIX_FMT_YUV444PLE: 667 case PIX_FMT_YUV444P16LE:
668 case PIX_FMT_YUV420PBE: 668 case PIX_FMT_YUV420P16BE:
669 case PIX_FMT_YUV422PBE: 669 case PIX_FMT_YUV422P16BE:
670 case PIX_FMT_YUV444PBE: 670 case PIX_FMT_YUV444P16BE:
671 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; 671 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
672 picture->linesize[0] = 2*width; 672 picture->linesize[0] = 2*width;
673 picture->linesize[1] = 2*w2; 673 picture->linesize[1] = 2*w2;
674 picture->linesize[2] = 2*w2; 674 picture->linesize[2] = 2*w2;
675 break; 675 break;
758 case PIX_FMT_YUV440P: 758 case PIX_FMT_YUV440P:
759 case PIX_FMT_YUVJ420P: 759 case PIX_FMT_YUVJ420P:
760 case PIX_FMT_YUVJ422P: 760 case PIX_FMT_YUVJ422P:
761 case PIX_FMT_YUVJ444P: 761 case PIX_FMT_YUVJ444P:
762 case PIX_FMT_YUVJ440P: 762 case PIX_FMT_YUVJ440P:
763 case PIX_FMT_YUV420PLE: 763 case PIX_FMT_YUV420P16LE:
764 case PIX_FMT_YUV422PLE: 764 case PIX_FMT_YUV422P16LE:
765 case PIX_FMT_YUV444PLE: 765 case PIX_FMT_YUV444P16LE:
766 case PIX_FMT_YUV420PBE: 766 case PIX_FMT_YUV420P16BE:
767 case PIX_FMT_YUV422PBE: 767 case PIX_FMT_YUV422P16BE:
768 case PIX_FMT_YUV444PBE: 768 case PIX_FMT_YUV444P16BE:
769 h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift; 769 h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
770 size2 = picture->linesize[1] * h2; 770 size2 = picture->linesize[1] * h2;
771 picture->data[0] = ptr; 771 picture->data[0] = ptr;
772 picture->data[1] = picture->data[0] + size; 772 picture->data[1] = picture->data[0] + size;
773 picture->data[2] = picture->data[1] + size2; 773 picture->data[2] = picture->data[1] + size2;