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