Mercurial > libavutil.hg
annotate pixdesc.c @ 1014:3728a7291737 libavutil
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
This fixes out of bounds accesses for big endian formats and should be
a little faster.
author | mru |
---|---|
date | Sun, 12 Sep 2010 21:39:54 +0000 |
parents | 83021885b234 |
children | f332df5d8da5 |
rev | line source |
---|---|
781 | 1 /* |
2 * pixel format descriptor | |
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at> | |
4 * | |
5 * This file is part of FFmpeg. | |
6 * | |
7 * FFmpeg is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2.1 of the License, or (at your option) any later version. | |
11 * | |
12 * FFmpeg is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with FFmpeg; if not, write to the Free Software | |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
989 | 22 #include <stdio.h> |
23 #include <string.h> | |
781 | 24 #include "pixfmt.h" |
25 #include "pixdesc.h" | |
26 | |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
27 #include "intreadwrite.h" |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
28 |
982
da1b5110dbd0
Rename read/write_line() to av_read/write_image_line().
mru
parents:
898
diff
changeset
|
29 void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], |
987 | 30 const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component) |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
31 { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
32 AVComponentDescriptor comp= desc->comp[c]; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
33 int plane= comp.plane; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
34 int depth= comp.depth_minus1+1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
35 int mask = (1<<depth)-1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
36 int shift= comp.shift; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
37 int step = comp.step_minus1+1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
38 int flags= desc->flags; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
39 |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
40 if (flags & PIX_FMT_BITSTREAM){ |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
41 int skip = x*step + comp.offset_plus1-1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
42 const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
43 int shift = 8 - depth - (skip&7); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
44 |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
45 while(w--){ |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
46 int val = (*p >> shift) & mask; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
47 if(read_pal_component) |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
48 val= data[1][4*val + c]; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
49 shift -= step; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
50 p -= shift>>3; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
51 shift &= 7; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
52 *dst++= val; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
53 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
54 } else { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
55 const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; |
1014
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
56 int is_8bit = 0; |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
57 |
1014
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
58 if (shift + depth <= 8) { |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
59 p += !!(flags & PIX_FMT_BE); |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
60 is_8bit = 1; |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
61 } |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
62 while(w--){ |
1014
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
63 int val = is_8bit ? *p : |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
64 flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p); |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
65 val = (val>>shift) & mask; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
66 if(read_pal_component) |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
67 val= data[1][4*val + c]; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
68 p+= step; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
69 *dst++= val; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
70 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
71 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
72 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
73 |
982
da1b5110dbd0
Rename read/write_line() to av_read/write_image_line().
mru
parents:
898
diff
changeset
|
74 void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], |
987 | 75 const AVPixFmtDescriptor *desc, int x, int y, int c, int w) |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
76 { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
77 AVComponentDescriptor comp = desc->comp[c]; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
78 int plane = comp.plane; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
79 int depth = comp.depth_minus1+1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
80 int step = comp.step_minus1+1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
81 int flags = desc->flags; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
82 |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
83 if (flags & PIX_FMT_BITSTREAM) { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
84 int skip = x*step + comp.offset_plus1-1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
85 uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
86 int shift = 8 - depth - (skip&7); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
87 |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
88 while (w--) { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
89 *p |= *src++ << shift; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
90 shift -= step; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
91 p -= shift>>3; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
92 shift &= 7; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
93 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
94 } else { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
95 int shift = comp.shift; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
96 uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
97 |
1014
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
98 if (shift + depth <= 8) { |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
99 p += !!(flags & PIX_FMT_BE); |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
100 while (w--) { |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
101 *p |= (*src++<<shift); |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
102 p += step; |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
103 } |
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
104 } else { |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
105 while (w--) { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
106 if (flags & PIX_FMT_BE) { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
107 uint16_t val = AV_RB16(p) | (*src++<<shift); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
108 AV_WB16(p, val); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
109 } else { |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
110 uint16_t val = AV_RL16(p) | (*src++<<shift); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
111 AV_WL16(p, val); |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
112 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
113 p+= step; |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
114 } |
1014
3728a7291737
pixdesc: use 8-bit accesses when possible in av_read/write_image_line()
mru
parents:
1013
diff
changeset
|
115 } |
836
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
116 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
117 } |
af688c6fa72f
Move read_line() and write_line() definition from pixdesc.h to
stefano
parents:
827
diff
changeset
|
118 |
781 | 119 const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { |
120 [PIX_FMT_YUV420P] = { | |
121 .name = "yuv420p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
122 .nb_components= 3, |
781 | 123 .log2_chroma_w= 1, |
124 .log2_chroma_h= 1, | |
125 .comp = { | |
126 {0,0,1,0,7}, /* Y */ | |
127 {1,0,1,0,7}, /* U */ | |
128 {2,0,1,0,7}, /* V */ | |
129 }, | |
130 }, | |
131 [PIX_FMT_YUYV422] = { | |
132 .name = "yuyv422", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
133 .nb_components= 3, |
781 | 134 .log2_chroma_w= 1, |
135 .log2_chroma_h= 0, | |
136 .comp = { | |
137 {0,1,1,0,7}, /* Y */ | |
138 {0,3,2,0,7}, /* U */ | |
139 {0,3,4,0,7}, /* V */ | |
140 }, | |
141 }, | |
142 [PIX_FMT_RGB24] = { | |
143 .name = "rgb24", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
144 .nb_components= 3, |
781 | 145 .log2_chroma_w= 0, |
146 .log2_chroma_h= 0, | |
147 .comp = { | |
148 {0,2,1,0,7}, /* R */ | |
149 {0,2,2,0,7}, /* G */ | |
150 {0,2,3,0,7}, /* B */ | |
151 }, | |
152 }, | |
153 [PIX_FMT_BGR24] = { | |
154 .name = "bgr24", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
155 .nb_components= 3, |
781 | 156 .log2_chroma_w= 0, |
157 .log2_chroma_h= 0, | |
158 .comp = { | |
159 {0,2,1,0,7}, /* B */ | |
160 {0,2,2,0,7}, /* G */ | |
161 {0,2,3,0,7}, /* R */ | |
162 }, | |
163 }, | |
164 [PIX_FMT_YUV422P] = { | |
165 .name = "yuv422p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
166 .nb_components= 3, |
781 | 167 .log2_chroma_w= 1, |
168 .log2_chroma_h= 0, | |
169 .comp = { | |
170 {0,0,1,0,7}, /* Y */ | |
171 {1,0,1,0,7}, /* U */ | |
172 {2,0,1,0,7}, /* V */ | |
173 }, | |
174 }, | |
175 [PIX_FMT_YUV444P] = { | |
176 .name = "yuv444p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
177 .nb_components= 3, |
781 | 178 .log2_chroma_w= 0, |
179 .log2_chroma_h= 0, | |
180 .comp = { | |
181 {0,0,1,0,7}, /* Y */ | |
182 {1,0,1,0,7}, /* U */ | |
183 {2,0,1,0,7}, /* V */ | |
184 }, | |
185 }, | |
186 [PIX_FMT_YUV410P] = { | |
187 .name = "yuv410p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
188 .nb_components= 3, |
781 | 189 .log2_chroma_w= 2, |
190 .log2_chroma_h= 2, | |
191 .comp = { | |
192 {0,0,1,0,7}, /* Y */ | |
193 {1,0,1,0,7}, /* U */ | |
194 {2,0,1,0,7}, /* V */ | |
195 }, | |
196 }, | |
197 [PIX_FMT_YUV411P] = { | |
198 .name = "yuv411p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
199 .nb_components= 3, |
781 | 200 .log2_chroma_w= 2, |
201 .log2_chroma_h= 0, | |
202 .comp = { | |
203 {0,0,1,0,7}, /* Y */ | |
204 {1,0,1,0,7}, /* U */ | |
205 {2,0,1,0,7}, /* V */ | |
206 }, | |
207 }, | |
208 [PIX_FMT_GRAY8] = { | |
796
ecf400e9601b
Make av_pix_fmt_descriptors use the same pixel format names as defined
stefano
parents:
791
diff
changeset
|
209 .name = "gray", |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
210 .nb_components= 1, |
781 | 211 .log2_chroma_w= 0, |
212 .log2_chroma_h= 0, | |
213 .comp = { | |
214 {0,0,1,0,7}, /* Y */ | |
215 }, | |
856
f01741b79070
Declare the PIX_FMT_GRAY8 pixel format as a paletted format. This is
stefano
parents:
836
diff
changeset
|
216 .flags = PIX_FMT_PAL, |
781 | 217 }, |
218 [PIX_FMT_MONOWHITE] = { | |
796
ecf400e9601b
Make av_pix_fmt_descriptors use the same pixel format names as defined
stefano
parents:
791
diff
changeset
|
219 .name = "monow", |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
220 .nb_components= 1, |
781 | 221 .log2_chroma_w= 0, |
222 .log2_chroma_h= 0, | |
223 .comp = { | |
224 {0,0,1,0,0}, /* Y */ | |
225 }, | |
226 .flags = PIX_FMT_BITSTREAM, | |
227 }, | |
228 [PIX_FMT_MONOBLACK] = { | |
796
ecf400e9601b
Make av_pix_fmt_descriptors use the same pixel format names as defined
stefano
parents:
791
diff
changeset
|
229 .name = "monob", |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
230 .nb_components= 1, |
781 | 231 .log2_chroma_w= 0, |
232 .log2_chroma_h= 0, | |
233 .comp = { | |
234 {0,0,1,7,0}, /* Y */ | |
235 }, | |
236 .flags = PIX_FMT_BITSTREAM, | |
237 }, | |
238 [PIX_FMT_PAL8] = { | |
239 .name = "pal8", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
240 .nb_components= 1, |
781 | 241 .log2_chroma_w= 0, |
242 .log2_chroma_h= 0, | |
243 .comp = { | |
244 {0,0,1,0,7}, | |
245 }, | |
246 .flags = PIX_FMT_PAL, | |
247 }, | |
248 [PIX_FMT_YUVJ420P] = { | |
249 .name = "yuvj420p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
250 .nb_components= 3, |
781 | 251 .log2_chroma_w= 1, |
252 .log2_chroma_h= 1, | |
253 .comp = { | |
254 {0,0,1,0,7}, /* Y */ | |
255 {1,0,1,0,7}, /* U */ | |
256 {2,0,1,0,7}, /* V */ | |
257 }, | |
258 }, | |
259 [PIX_FMT_YUVJ422P] = { | |
260 .name = "yuvj422p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
261 .nb_components= 3, |
781 | 262 .log2_chroma_w= 1, |
263 .log2_chroma_h= 0, | |
264 .comp = { | |
265 {0,0,1,0,7}, /* Y */ | |
266 {1,0,1,0,7}, /* U */ | |
267 {2,0,1,0,7}, /* V */ | |
268 }, | |
269 }, | |
270 [PIX_FMT_YUVJ444P] = { | |
271 .name = "yuvj444p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
272 .nb_components= 3, |
781 | 273 .log2_chroma_w= 0, |
274 .log2_chroma_h= 0, | |
275 .comp = { | |
276 {0,0,1,0,7}, /* Y */ | |
277 {1,0,1,0,7}, /* U */ | |
278 {2,0,1,0,7}, /* V */ | |
279 }, | |
280 }, | |
783
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
281 [PIX_FMT_XVMC_MPEG2_MC] = { |
796
ecf400e9601b
Make av_pix_fmt_descriptors use the same pixel format names as defined
stefano
parents:
791
diff
changeset
|
282 .name = "xvmcmc", |
783
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
283 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
284 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
285 [PIX_FMT_XVMC_MPEG2_IDCT] = { |
796
ecf400e9601b
Make av_pix_fmt_descriptors use the same pixel format names as defined
stefano
parents:
791
diff
changeset
|
286 .name = "xvmcidct", |
783
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
287 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
288 }, |
781 | 289 [PIX_FMT_UYVY422] = { |
290 .name = "uyvy422", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
291 .nb_components= 3, |
781 | 292 .log2_chroma_w= 1, |
293 .log2_chroma_h= 0, | |
294 .comp = { | |
295 {0,1,2,0,7}, /* Y */ | |
296 {0,3,1,0,7}, /* U */ | |
297 {0,3,3,0,7}, /* V */ | |
298 }, | |
299 }, | |
300 [PIX_FMT_UYYVYY411] = { | |
301 .name = "uyyvyy411", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
302 .nb_components= 3, |
781 | 303 .log2_chroma_w= 2, |
304 .log2_chroma_h= 0, | |
305 .comp = { | |
306 {0,3,2,0,7}, /* Y */ | |
307 {0,5,1,0,7}, /* U */ | |
308 {0,5,4,0,7}, /* V */ | |
309 }, | |
310 }, | |
311 [PIX_FMT_BGR8] = { | |
312 .name = "bgr8", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
313 .nb_components= 3, |
781 | 314 .log2_chroma_w= 0, |
315 .log2_chroma_h= 0, | |
316 .comp = { | |
317 {0,0,1,6,1}, /* B */ | |
318 {0,0,1,3,2}, /* G */ | |
319 {0,0,1,0,2}, /* R */ | |
320 }, | |
782
9b06eaf7b6ef
Add PIX_FMT_PAL flag to BGR8, BGR4_BYTE, RGB8, and RGB4_BYTE formats.
stefano
parents:
781
diff
changeset
|
321 .flags = PIX_FMT_PAL, |
781 | 322 }, |
323 [PIX_FMT_BGR4] = { | |
324 .name = "bgr4", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
325 .nb_components= 3, |
781 | 326 .log2_chroma_w= 0, |
327 .log2_chroma_h= 0, | |
328 .comp = { | |
329 {0,3,1,0,0}, /* B */ | |
330 {0,3,2,0,1}, /* G */ | |
331 {0,3,4,0,0}, /* R */ | |
332 }, | |
333 .flags = PIX_FMT_BITSTREAM, | |
334 }, | |
335 [PIX_FMT_BGR4_BYTE] = { | |
336 .name = "bgr4_byte", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
337 .nb_components= 3, |
781 | 338 .log2_chroma_w= 0, |
339 .log2_chroma_h= 0, | |
340 .comp = { | |
341 {0,0,1,3,0}, /* B */ | |
342 {0,0,1,1,1}, /* G */ | |
343 {0,0,1,0,0}, /* R */ | |
344 }, | |
782
9b06eaf7b6ef
Add PIX_FMT_PAL flag to BGR8, BGR4_BYTE, RGB8, and RGB4_BYTE formats.
stefano
parents:
781
diff
changeset
|
345 .flags = PIX_FMT_PAL, |
781 | 346 }, |
347 [PIX_FMT_RGB8] = { | |
348 .name = "rgb8", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
349 .nb_components= 3, |
781 | 350 .log2_chroma_w= 0, |
351 .log2_chroma_h= 0, | |
352 .comp = { | |
353 {0,0,1,6,1}, /* R */ | |
354 {0,0,1,3,2}, /* G */ | |
355 {0,0,1,0,2}, /* B */ | |
356 }, | |
782
9b06eaf7b6ef
Add PIX_FMT_PAL flag to BGR8, BGR4_BYTE, RGB8, and RGB4_BYTE formats.
stefano
parents:
781
diff
changeset
|
357 .flags = PIX_FMT_PAL, |
781 | 358 }, |
359 [PIX_FMT_RGB4] = { | |
360 .name = "rgb4", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
361 .nb_components= 3, |
781 | 362 .log2_chroma_w= 0, |
363 .log2_chroma_h= 0, | |
364 .comp = { | |
365 {0,3,1,0,0}, /* R */ | |
366 {0,3,2,0,1}, /* G */ | |
367 {0,3,4,0,0}, /* B */ | |
368 }, | |
369 .flags = PIX_FMT_BITSTREAM, | |
370 }, | |
371 [PIX_FMT_RGB4_BYTE] = { | |
372 .name = "rgb4_byte", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
373 .nb_components= 3, |
781 | 374 .log2_chroma_w= 0, |
375 .log2_chroma_h= 0, | |
376 .comp = { | |
377 {0,0,1,3,0}, /* R */ | |
378 {0,0,1,1,1}, /* G */ | |
379 {0,0,1,0,0}, /* B */ | |
380 }, | |
782
9b06eaf7b6ef
Add PIX_FMT_PAL flag to BGR8, BGR4_BYTE, RGB8, and RGB4_BYTE formats.
stefano
parents:
781
diff
changeset
|
381 .flags = PIX_FMT_PAL, |
781 | 382 }, |
383 [PIX_FMT_NV12] = { | |
384 .name = "nv12", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
385 .nb_components= 3, |
781 | 386 .log2_chroma_w= 1, |
387 .log2_chroma_h= 1, | |
388 .comp = { | |
389 {0,0,1,0,7}, /* Y */ | |
390 {1,1,1,0,7}, /* U */ | |
391 {1,1,2,0,7}, /* V */ | |
392 }, | |
393 }, | |
394 [PIX_FMT_NV21] = { | |
395 .name = "nv21", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
396 .nb_components= 3, |
781 | 397 .log2_chroma_w= 1, |
398 .log2_chroma_h= 1, | |
399 .comp = { | |
400 {0,0,1,0,7}, /* Y */ | |
401 {1,1,1,0,7}, /* V */ | |
402 {1,1,2,0,7}, /* U */ | |
403 }, | |
404 }, | |
405 [PIX_FMT_ARGB] = { | |
406 .name = "argb", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
407 .nb_components= 4, |
781 | 408 .log2_chroma_w= 0, |
409 .log2_chroma_h= 0, | |
410 .comp = { | |
411 {0,3,1,0,7}, /* A */ | |
412 {0,3,2,0,7}, /* R */ | |
413 {0,3,3,0,7}, /* G */ | |
414 {0,3,4,0,7}, /* B */ | |
415 }, | |
416 }, | |
417 [PIX_FMT_RGBA] = { | |
418 .name = "rgba", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
419 .nb_components= 4, |
781 | 420 .log2_chroma_w= 0, |
421 .log2_chroma_h= 0, | |
422 .comp = { | |
423 {0,3,1,0,7}, /* R */ | |
424 {0,3,2,0,7}, /* G */ | |
425 {0,3,3,0,7}, /* B */ | |
426 {0,3,4,0,7}, /* A */ | |
427 }, | |
428 }, | |
429 [PIX_FMT_ABGR] = { | |
430 .name = "abgr", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
431 .nb_components= 4, |
781 | 432 .log2_chroma_w= 0, |
433 .log2_chroma_h= 0, | |
434 .comp = { | |
435 {0,3,1,0,7}, /* A */ | |
436 {0,3,2,0,7}, /* B */ | |
437 {0,3,3,0,7}, /* G */ | |
438 {0,3,4,0,7}, /* R */ | |
439 }, | |
440 }, | |
441 [PIX_FMT_BGRA] = { | |
442 .name = "bgra", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
443 .nb_components= 4, |
781 | 444 .log2_chroma_w= 0, |
445 .log2_chroma_h= 0, | |
446 .comp = { | |
447 {0,3,1,0,7}, /* B */ | |
448 {0,3,2,0,7}, /* G */ | |
449 {0,3,3,0,7}, /* R */ | |
450 {0,3,4,0,7}, /* A */ | |
451 }, | |
452 }, | |
453 [PIX_FMT_GRAY16BE] = { | |
454 .name = "gray16be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
455 .nb_components= 1, |
781 | 456 .log2_chroma_w= 0, |
457 .log2_chroma_h= 0, | |
458 .comp = { | |
459 {0,1,1,0,15}, /* Y */ | |
460 }, | |
461 .flags = PIX_FMT_BE, | |
462 }, | |
463 [PIX_FMT_GRAY16LE] = { | |
464 .name = "gray16le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
465 .nb_components= 1, |
781 | 466 .log2_chroma_w= 0, |
467 .log2_chroma_h= 0, | |
468 .comp = { | |
469 {0,1,1,0,15}, /* Y */ | |
470 }, | |
471 }, | |
472 [PIX_FMT_YUV440P] = { | |
473 .name = "yuv440p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
474 .nb_components= 3, |
781 | 475 .log2_chroma_w= 0, |
476 .log2_chroma_h= 1, | |
477 .comp = { | |
478 {0,0,1,0,7}, /* Y */ | |
479 {1,0,1,0,7}, /* U */ | |
480 {2,0,1,0,7}, /* V */ | |
481 }, | |
482 }, | |
483 [PIX_FMT_YUVJ440P] = { | |
484 .name = "yuvj440p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
485 .nb_components= 3, |
781 | 486 .log2_chroma_w= 0, |
487 .log2_chroma_h= 1, | |
488 .comp = { | |
489 {0,0,1,0,7}, /* Y */ | |
490 {1,0,1,0,7}, /* U */ | |
491 {2,0,1,0,7}, /* V */ | |
492 }, | |
493 }, | |
494 [PIX_FMT_YUVA420P] = { | |
495 .name = "yuva420p", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
496 .nb_components= 4, |
781 | 497 .log2_chroma_w= 1, |
498 .log2_chroma_h= 1, | |
499 .comp = { | |
500 {0,0,1,0,7}, /* Y */ | |
501 {1,0,1,0,7}, /* U */ | |
502 {2,0,1,0,7}, /* V */ | |
503 {3,0,1,0,7}, /* A */ | |
504 }, | |
505 }, | |
783
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
506 [PIX_FMT_VDPAU_H264] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
507 .name = "vdpau_h264", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
508 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
509 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
510 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
511 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
512 [PIX_FMT_VDPAU_MPEG1] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
513 .name = "vdpau_mpeg1", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
514 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
515 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
516 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
517 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
518 [PIX_FMT_VDPAU_MPEG2] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
519 .name = "vdpau_mpeg2", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
520 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
521 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
522 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
523 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
524 [PIX_FMT_VDPAU_WMV3] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
525 .name = "vdpau_wmv3", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
526 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
527 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
528 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
529 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
530 [PIX_FMT_VDPAU_VC1] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
531 .name = "vdpau_vc1", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
532 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
533 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
534 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
535 }, |
787 | 536 [PIX_FMT_VDPAU_MPEG4] = { |
537 .name = "vdpau_mpeg4", | |
538 .log2_chroma_w = 1, | |
539 .log2_chroma_h = 1, | |
540 .flags = PIX_FMT_HWACCEL, | |
541 }, | |
781 | 542 [PIX_FMT_RGB48BE] = { |
543 .name = "rgb48be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
544 .nb_components= 3, |
781 | 545 .log2_chroma_w= 0, |
546 .log2_chroma_h= 0, | |
547 .comp = { | |
548 {0,5,1,0,15}, /* R */ | |
549 {0,5,3,0,15}, /* G */ | |
550 {0,5,5,0,15}, /* B */ | |
551 }, | |
552 .flags = PIX_FMT_BE, | |
553 }, | |
554 [PIX_FMT_RGB48LE] = { | |
555 .name = "rgb48le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
556 .nb_components= 3, |
781 | 557 .log2_chroma_w= 0, |
558 .log2_chroma_h= 0, | |
559 .comp = { | |
560 {0,5,1,0,15}, /* R */ | |
561 {0,5,3,0,15}, /* G */ | |
562 {0,5,5,0,15}, /* B */ | |
563 }, | |
564 }, | |
565 [PIX_FMT_RGB565BE] = { | |
566 .name = "rgb565be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
567 .nb_components= 3, |
781 | 568 .log2_chroma_w= 0, |
569 .log2_chroma_h= 0, | |
570 .comp = { | |
571 {0,1,0,3,4}, /* R */ | |
572 {0,1,1,5,5}, /* G */ | |
573 {0,1,1,0,4}, /* B */ | |
574 }, | |
575 .flags = PIX_FMT_BE, | |
576 }, | |
577 [PIX_FMT_RGB565LE] = { | |
578 .name = "rgb565le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
579 .nb_components= 3, |
781 | 580 .log2_chroma_w= 0, |
581 .log2_chroma_h= 0, | |
582 .comp = { | |
583 {0,1,2,3,4}, /* R */ | |
584 {0,1,1,5,5}, /* G */ | |
585 {0,1,1,0,4}, /* B */ | |
586 }, | |
587 }, | |
588 [PIX_FMT_RGB555BE] = { | |
589 .name = "rgb555be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
590 .nb_components= 3, |
781 | 591 .log2_chroma_w= 0, |
592 .log2_chroma_h= 0, | |
593 .comp = { | |
594 {0,1,0,2,4}, /* R */ | |
595 {0,1,1,5,4}, /* G */ | |
596 {0,1,1,0,4}, /* B */ | |
597 }, | |
598 .flags = PIX_FMT_BE, | |
599 }, | |
600 [PIX_FMT_RGB555LE] = { | |
601 .name = "rgb555le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
602 .nb_components= 3, |
781 | 603 .log2_chroma_w= 0, |
604 .log2_chroma_h= 0, | |
605 .comp = { | |
606 {0,1,2,2,4}, /* R */ | |
607 {0,1,1,5,4}, /* G */ | |
608 {0,1,1,0,4}, /* B */ | |
609 }, | |
610 }, | |
857 | 611 [PIX_FMT_RGB444BE] = { |
612 .name = "rgb444be", | |
613 .nb_components= 3, | |
614 .log2_chroma_w= 0, | |
615 .log2_chroma_h= 0, | |
616 .comp = { | |
617 {0,1,0,0,3}, /* R */ | |
618 {0,1,1,4,3}, /* G */ | |
619 {0,1,1,0,3}, /* B */ | |
620 }, | |
621 .flags = PIX_FMT_BE, | |
622 }, | |
623 [PIX_FMT_RGB444LE] = { | |
624 .name = "rgb444le", | |
625 .nb_components= 3, | |
626 .log2_chroma_w= 0, | |
627 .log2_chroma_h= 0, | |
628 .comp = { | |
629 {0,1,2,0,3}, /* R */ | |
630 {0,1,1,4,3}, /* G */ | |
631 {0,1,1,0,3}, /* B */ | |
632 }, | |
633 }, | |
781 | 634 [PIX_FMT_BGR565BE] = { |
635 .name = "bgr565be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
636 .nb_components= 3, |
781 | 637 .log2_chroma_w= 0, |
638 .log2_chroma_h= 0, | |
639 .comp = { | |
640 {0,1,0,3,4}, /* B */ | |
641 {0,1,1,5,5}, /* G */ | |
642 {0,1,1,0,4}, /* R */ | |
643 }, | |
644 .flags = PIX_FMT_BE, | |
645 }, | |
646 [PIX_FMT_BGR565LE] = { | |
647 .name = "bgr565le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
648 .nb_components= 3, |
781 | 649 .log2_chroma_w= 0, |
650 .log2_chroma_h= 0, | |
651 .comp = { | |
652 {0,1,2,3,4}, /* B */ | |
653 {0,1,1,5,5}, /* G */ | |
654 {0,1,1,0,4}, /* R */ | |
655 }, | |
656 }, | |
657 [PIX_FMT_BGR555BE] = { | |
658 .name = "bgr555be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
659 .nb_components= 3, |
781 | 660 .log2_chroma_w= 0, |
661 .log2_chroma_h= 0, | |
662 .comp = { | |
663 {0,1,0,2,4}, /* B */ | |
664 {0,1,1,5,4}, /* G */ | |
665 {0,1,1,0,4}, /* R */ | |
666 }, | |
667 .flags = PIX_FMT_BE, | |
668 }, | |
669 [PIX_FMT_BGR555LE] = { | |
670 .name = "bgr555le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
671 .nb_components= 3, |
781 | 672 .log2_chroma_w= 0, |
673 .log2_chroma_h= 0, | |
674 .comp = { | |
675 {0,1,2,2,4}, /* B */ | |
676 {0,1,1,5,4}, /* G */ | |
677 {0,1,1,0,4}, /* R */ | |
678 }, | |
679 }, | |
857 | 680 [PIX_FMT_BGR444BE] = { |
681 .name = "bgr444be", | |
682 .nb_components= 3, | |
683 .log2_chroma_w= 0, | |
684 .log2_chroma_h= 0, | |
685 .comp = { | |
686 {0,1,0,0,3}, /* B */ | |
687 {0,1,1,4,3}, /* G */ | |
688 {0,1,1,0,3}, /* R */ | |
689 }, | |
690 .flags = PIX_FMT_BE, | |
691 }, | |
692 [PIX_FMT_BGR444LE] = { | |
693 .name = "bgr444le", | |
694 .nb_components= 3, | |
695 .log2_chroma_w= 0, | |
696 .log2_chroma_h= 0, | |
697 .comp = { | |
698 {0,1,2,0,3}, /* B */ | |
699 {0,1,1,4,3}, /* G */ | |
700 {0,1,1,0,3}, /* R */ | |
701 }, | |
702 }, | |
783
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
703 [PIX_FMT_VAAPI_MOCO] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
704 .name = "vaapi_moco", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
705 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
706 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
707 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
708 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
709 [PIX_FMT_VAAPI_IDCT] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
710 .name = "vaapi_idct", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
711 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
712 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
713 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
714 }, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
715 [PIX_FMT_VAAPI_VLD] = { |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
716 .name = "vaapi_vld", |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
717 .log2_chroma_w = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
718 .log2_chroma_h = 1, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
719 .flags = PIX_FMT_HWACCEL, |
c0b4f10edb74
Add pixel format descriptors for the HW-accelerated formats.
stefano
parents:
782
diff
changeset
|
720 }, |
781 | 721 [PIX_FMT_YUV420P16LE] = { |
722 .name = "yuv420p16le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
723 .nb_components= 3, |
781 | 724 .log2_chroma_w= 1, |
725 .log2_chroma_h= 1, | |
726 .comp = { | |
727 {0,1,1,0,15}, /* Y */ | |
728 {1,1,1,0,15}, /* U */ | |
729 {2,1,1,0,15}, /* V */ | |
730 }, | |
731 }, | |
732 [PIX_FMT_YUV420P16BE] = { | |
733 .name = "yuv420p16be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
734 .nb_components= 3, |
781 | 735 .log2_chroma_w= 1, |
736 .log2_chroma_h= 1, | |
737 .comp = { | |
738 {0,1,1,0,15}, /* Y */ | |
739 {1,1,1,0,15}, /* U */ | |
740 {2,1,1,0,15}, /* V */ | |
741 }, | |
742 .flags = PIX_FMT_BE, | |
743 }, | |
744 [PIX_FMT_YUV422P16LE] = { | |
745 .name = "yuv422p16le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
746 .nb_components= 3, |
781 | 747 .log2_chroma_w= 1, |
748 .log2_chroma_h= 0, | |
749 .comp = { | |
750 {0,1,1,0,15}, /* Y */ | |
751 {1,1,1,0,15}, /* U */ | |
752 {2,1,1,0,15}, /* V */ | |
753 }, | |
754 }, | |
755 [PIX_FMT_YUV422P16BE] = { | |
756 .name = "yuv422p16be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
757 .nb_components= 3, |
781 | 758 .log2_chroma_w= 1, |
759 .log2_chroma_h= 0, | |
760 .comp = { | |
761 {0,1,1,0,15}, /* Y */ | |
762 {1,1,1,0,15}, /* U */ | |
763 {2,1,1,0,15}, /* V */ | |
764 }, | |
765 .flags = PIX_FMT_BE, | |
766 }, | |
767 [PIX_FMT_YUV444P16LE] = { | |
768 .name = "yuv444p16le", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
769 .nb_components= 3, |
781 | 770 .log2_chroma_w= 0, |
771 .log2_chroma_h= 0, | |
772 .comp = { | |
773 {0,1,1,0,15}, /* Y */ | |
774 {1,1,1,0,15}, /* U */ | |
775 {2,1,1,0,15}, /* V */ | |
776 }, | |
777 }, | |
778 [PIX_FMT_YUV444P16BE] = { | |
779 .name = "yuv444p16be", | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
780 .nb_components= 3, |
781 | 781 .log2_chroma_w= 0, |
782 .log2_chroma_h= 0, | |
783 .comp = { | |
784 {0,1,1,0,15}, /* Y */ | |
785 {1,1,1,0,15}, /* U */ | |
786 {2,1,1,0,15}, /* V */ | |
787 }, | |
788 .flags = PIX_FMT_BE, | |
789 }, | |
818 | 790 [PIX_FMT_DXVA2_VLD] = { |
791 .name = "dxva2_vld", | |
792 .log2_chroma_w = 1, | |
793 .log2_chroma_h = 1, | |
794 .flags = PIX_FMT_HWACCEL, | |
795 }, | |
898 | 796 [PIX_FMT_Y400A] = { |
797 .name = "y400a", | |
798 .nb_components= 2, | |
799 .comp = { | |
800 {0,1,1,0,7}, /* Y */ | |
801 {0,1,2,0,7}, /* A */ | |
802 }, | |
803 }, | |
781 | 804 }; |
805 | |
827
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
806 static enum PixelFormat get_pix_fmt_internal(const char *name) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
807 { |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
808 enum PixelFormat pix_fmt; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
809 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
810 for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
811 if (av_pix_fmt_descriptors[pix_fmt].name && |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
812 !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name)) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
813 return pix_fmt; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
814 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
815 return PIX_FMT_NONE; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
816 } |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
817 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
818 #if HAVE_BIGENDIAN |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
819 # define X_NE(be, le) be |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
820 #else |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
821 # define X_NE(be, le) le |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
822 #endif |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
823 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
824 enum PixelFormat av_get_pix_fmt(const char *name) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
825 { |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
826 enum PixelFormat pix_fmt; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
827 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
828 if (!strcmp(name, "rgb32")) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
829 name = X_NE("argb", "bgra"); |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
830 else if (!strcmp(name, "bgr32")) |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
831 name = X_NE("abgr", "rgba"); |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
832 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
833 pix_fmt = get_pix_fmt_internal(name); |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
834 if (pix_fmt == PIX_FMT_NONE) { |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
835 char name2[32]; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
836 |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
837 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
838 pix_fmt = get_pix_fmt_internal(name2); |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
839 } |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
840 return pix_fmt; |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
841 } |
f01765adeb5c
Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt().
stefano
parents:
818
diff
changeset
|
842 |
781 | 843 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) |
844 { | |
845 int c, bits = 0; | |
846 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h; | |
847 | |
791
ecf67bd079fe
Rename AVPixFmtDescriptor.nb_channels to nb_components, the new name
stefano
parents:
787
diff
changeset
|
848 for (c = 0; c < pixdesc->nb_components; c++) { |
781 | 849 int s = c==1 || c==2 ? 0 : log2_pixels; |
850 bits += (pixdesc->comp[c].depth_minus1+1) << s; | |
851 } | |
852 | |
853 return bits >> log2_pixels; | |
854 } |