Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2002-2014 Michael Niedermayer <michaelni@gmx.at> | ||
3 | * | ||
4 | * see https://multimedia.cx/huffyuv.txt for a description of | ||
5 | * the algorithm used | ||
6 | * | ||
7 | * This file is part of FFmpeg. | ||
8 | * | ||
9 | * FFmpeg is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU Lesser General Public | ||
11 | * License as published by the Free Software Foundation; either | ||
12 | * version 2.1 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * FFmpeg is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * Lesser General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU Lesser General Public | ||
20 | * License along with FFmpeg; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * | ||
23 | * yuva, gray, 4:4:4, 4:1:1, 4:1:0 and >8 bit per sample support sponsored by NOA | ||
24 | */ | ||
25 | |||
26 | /** | ||
27 | * @file | ||
28 | * huffyuv encoder | ||
29 | */ | ||
30 | |||
31 | #include "config_components.h" | ||
32 | |||
33 | #include "avcodec.h" | ||
34 | #include "bswapdsp.h" | ||
35 | #include "codec_internal.h" | ||
36 | #include "encode.h" | ||
37 | #include "huffyuv.h" | ||
38 | #include "huffman.h" | ||
39 | #include "huffyuvencdsp.h" | ||
40 | #include "lossless_videoencdsp.h" | ||
41 | #include "put_bits.h" | ||
42 | #include "libavutil/emms.h" | ||
43 | #include "libavutil/opt.h" | ||
44 | #include "libavutil/pixdesc.h" | ||
45 | |||
46 | typedef struct HYuvEncContext { | ||
47 | AVClass *class; | ||
48 | AVCodecContext *avctx; | ||
49 | PutBitContext pb; | ||
50 | Predictor predictor; | ||
51 | int interlaced; | ||
52 | int decorrelate; | ||
53 | int bitstream_bpp; | ||
54 | int version; | ||
55 | int bps; | ||
56 | int n; // 1<<bps | ||
57 | int vlc_n; // number of vlc codes (FFMIN(1<<bps, MAX_VLC_N)) | ||
58 | int alpha; | ||
59 | int chroma; | ||
60 | int yuv; | ||
61 | int chroma_h_shift; | ||
62 | int chroma_v_shift; | ||
63 | int flags; | ||
64 | int context; | ||
65 | int picture_number; | ||
66 | |||
67 | uint8_t *temp[3]; | ||
68 | uint16_t *temp16[3]; ///< identical to temp but 16bit type | ||
69 | uint64_t stats[4][MAX_VLC_N]; | ||
70 | uint8_t len[4][MAX_VLC_N]; | ||
71 | uint32_t bits[4][MAX_VLC_N]; | ||
72 | BswapDSPContext bdsp; | ||
73 | HuffYUVEncDSPContext hencdsp; | ||
74 | LLVidEncDSPContext llvidencdsp; | ||
75 | int non_determ; // non-deterministic, multi-threaded encoder allowed | ||
76 | } HYuvEncContext; | ||
77 | |||
78 | 134100 | static inline void diff_bytes(HYuvEncContext *s, uint8_t *dst, | |
79 | const uint8_t *src0, const uint8_t *src1, int w) | ||
80 | { | ||
81 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134100 times.
|
134100 | if (s->bps <= 8) { |
82 | ✗ | s->llvidencdsp.diff_bytes(dst, src0, src1, w); | |
83 | } else { | ||
84 | 134100 | s->hencdsp.diff_int16((uint16_t *)dst, (const uint16_t *)src0, (const uint16_t *)src1, s->n - 1, w); | |
85 | } | ||
86 | 134100 | } | |
87 | |||
88 | 718400 | static inline int sub_left_prediction(HYuvEncContext *s, uint8_t *dst, | |
89 | const uint8_t *src, int w, int left) | ||
90 | { | ||
91 | int i; | ||
92 | 718400 | int min_width = FFMIN(w, 32); | |
93 | |||
94 |
2/2✓ Branch 0 taken 359200 times.
✓ Branch 1 taken 359200 times.
|
718400 | if (s->bps <= 8) { |
95 |
2/2✓ Branch 0 taken 11417900 times.
✓ Branch 1 taken 359200 times.
|
11777100 | for (i = 0; i < min_width; i++) { /* scalar loop before dsp call */ |
96 | 11417900 | const int temp = src[i]; | |
97 | 11417900 | dst[i] = temp - left; | |
98 | 11417900 | left = temp; | |
99 | } | ||
100 |
2/2✓ Branch 0 taken 5100 times.
✓ Branch 1 taken 354100 times.
|
359200 | if (w < 32) |
101 | 5100 | return left; | |
102 | 354100 | s->llvidencdsp.diff_bytes(dst + 32, src + 32, src + 31, w - 32); | |
103 | 354100 | return src[w-1]; | |
104 | } else { | ||
105 | 359200 | const uint16_t *src16 = (const uint16_t *)src; | |
106 | 359200 | uint16_t *dst16 = ( uint16_t *)dst; | |
107 |
2/2✓ Branch 0 taken 11417900 times.
✓ Branch 1 taken 359200 times.
|
11777100 | for (i = 0; i < min_width; i++) { /* scalar loop before dsp call */ |
108 | 11417900 | const int temp = src16[i]; | |
109 | 11417900 | dst16[i] = temp - left; | |
110 | 11417900 | left = temp; | |
111 | } | ||
112 |
2/2✓ Branch 0 taken 5100 times.
✓ Branch 1 taken 354100 times.
|
359200 | if (w < 32) |
113 | 5100 | return left; | |
114 | 354100 | s->hencdsp.diff_int16(dst16 + 32, src16 + 32, src16 + 31, s->n - 1, w - 32); | |
115 | 354100 | return src16[w-1]; | |
116 | } | ||
117 | } | ||
118 | |||
119 | 44900 | static inline void sub_left_prediction_bgr32(HYuvEncContext *s, uint8_t *dst, | |
120 | const uint8_t *src, int w, | ||
121 | int *red, int *green, int *blue, | ||
122 | int *alpha) | ||
123 | { | ||
124 | int i; | ||
125 | int r, g, b, a; | ||
126 | 44900 | int min_width = FFMIN(w, 8); | |
127 | 44900 | r = *red; | |
128 | 44900 | g = *green; | |
129 | 44900 | b = *blue; | |
130 | 44900 | a = *alpha; | |
131 | |||
132 |
2/2✓ Branch 0 taken 359200 times.
✓ Branch 1 taken 44900 times.
|
404100 | for (i = 0; i < min_width; i++) { |
133 | 359200 | const int rt = src[i * 4 + R]; | |
134 | 359200 | const int gt = src[i * 4 + G]; | |
135 | 359200 | const int bt = src[i * 4 + B]; | |
136 | 359200 | const int at = src[i * 4 + A]; | |
137 | 359200 | dst[i * 4 + R] = rt - r; | |
138 | 359200 | dst[i * 4 + G] = gt - g; | |
139 | 359200 | dst[i * 4 + B] = bt - b; | |
140 | 359200 | dst[i * 4 + A] = at - a; | |
141 | 359200 | r = rt; | |
142 | 359200 | g = gt; | |
143 | 359200 | b = bt; | |
144 | 359200 | a = at; | |
145 | } | ||
146 | |||
147 | 44900 | s->llvidencdsp.diff_bytes(dst + 32, src + 32, src + 32 - 4, w * 4 - 32); | |
148 | |||
149 | 44900 | *red = src[(w - 1) * 4 + R]; | |
150 | 44900 | *green = src[(w - 1) * 4 + G]; | |
151 | 44900 | *blue = src[(w - 1) * 4 + B]; | |
152 | 44900 | *alpha = src[(w - 1) * 4 + A]; | |
153 | 44900 | } | |
154 | |||
155 | 44900 | static inline void sub_left_prediction_rgb24(HYuvEncContext *s, uint8_t *dst, | |
156 | const uint8_t *src, int w, | ||
157 | int *red, int *green, int *blue) | ||
158 | { | ||
159 | int i; | ||
160 | int r, g, b; | ||
161 | 44900 | r = *red; | |
162 | 44900 | g = *green; | |
163 | 44900 | b = *blue; | |
164 |
2/2✓ Branch 0 taken 718400 times.
✓ Branch 1 taken 44900 times.
|
763300 | for (i = 0; i < FFMIN(w, 16); i++) { |
165 | 718400 | const int rt = src[i * 3 + 0]; | |
166 | 718400 | const int gt = src[i * 3 + 1]; | |
167 | 718400 | const int bt = src[i * 3 + 2]; | |
168 | 718400 | dst[i * 3 + 0] = rt - r; | |
169 | 718400 | dst[i * 3 + 1] = gt - g; | |
170 | 718400 | dst[i * 3 + 2] = bt - b; | |
171 | 718400 | r = rt; | |
172 | 718400 | g = gt; | |
173 | 718400 | b = bt; | |
174 | } | ||
175 | |||
176 | 44900 | s->llvidencdsp.diff_bytes(dst + 48, src + 48, src + 48 - 3, w * 3 - 48); | |
177 | |||
178 | 44900 | *red = src[(w - 1) * 3 + 0]; | |
179 | 44900 | *green = src[(w - 1) * 3 + 1]; | |
180 | 44900 | *blue = src[(w - 1) * 3 + 2]; | |
181 | 44900 | } | |
182 | |||
183 | ✗ | static void sub_median_prediction(HYuvEncContext *s, uint8_t *dst, | |
184 | const uint8_t *src1, const uint8_t *src2, | ||
185 | int w, int *left, int *left_top) | ||
186 | { | ||
187 | ✗ | if (s->bps <= 8) { | |
188 | ✗ | s->llvidencdsp.sub_median_pred(dst, src1, src2, w , left, left_top); | |
189 | } else { | ||
190 | ✗ | s->hencdsp.sub_hfyu_median_pred_int16((uint16_t *)dst, (const uint16_t *)src1, (const uint16_t *)src2, s->n - 1, w , left, left_top); | |
191 | } | ||
192 | ✗ | } | |
193 | |||
194 | 96 | static int store_table(HYuvEncContext *s, const uint8_t *len, uint8_t *buf) | |
195 | { | ||
196 | int i; | ||
197 | 96 | int index = 0; | |
198 | 96 | int n = s->vlc_n; | |
199 | |||
200 |
2/2✓ Branch 0 taken 3876 times.
✓ Branch 1 taken 96 times.
|
3972 | for (i = 0; i < n;) { |
201 | 3876 | int val = len[i]; | |
202 | 3876 | int repeat = 0; | |
203 | |||
204 |
6/6✓ Branch 0 taken 277188 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 274140 times.
✓ Branch 3 taken 3048 times.
✓ Branch 4 taken 273408 times.
✓ Branch 5 taken 732 times.
|
277284 | for (; i < n && len[i] == val && repeat < 255; i++) |
205 | 273408 | repeat++; | |
206 | |||
207 |
4/8✓ Branch 0 taken 3876 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3876 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3876 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3876 times.
|
3876 | av_assert0(val < 32 && val >0 && repeat < 256 && repeat>0); |
208 |
2/2✓ Branch 0 taken 2244 times.
✓ Branch 1 taken 1632 times.
|
3876 | if (repeat > 7) { |
209 | 2244 | buf[index++] = val; | |
210 | 2244 | buf[index++] = repeat; | |
211 | } else { | ||
212 | 1632 | buf[index++] = val | (repeat << 5); | |
213 | } | ||
214 | } | ||
215 | |||
216 | 96 | return index; | |
217 | } | ||
218 | |||
219 | 32 | static int store_huffman_tables(HYuvEncContext *s, uint8_t *buf) | |
220 | { | ||
221 | int i, ret; | ||
222 | 32 | int size = 0; | |
223 | 32 | int count = 3; | |
224 | |||
225 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
|
32 | if (s->version > 2) |
226 | 16 | count = 1 + s->alpha + 2*s->chroma; | |
227 | |||
228 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 32 times.
|
128 | for (i = 0; i < count; i++) { |
229 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
|
96 | if ((ret = ff_huff_gen_len_table(s->len[i], s->stats[i], s->vlc_n, 0)) < 0) |
230 | ✗ | return ret; | |
231 | |||
232 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
|
96 | if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n) < 0) { |
233 | ✗ | return -1; | |
234 | } | ||
235 | |||
236 | 96 | size += store_table(s, s->len[i], buf + size); | |
237 | } | ||
238 | 32 | return size; | |
239 | } | ||
240 | |||
241 | 32 | static av_cold int encode_init(AVCodecContext *avctx) | |
242 | { | ||
243 | 32 | HYuvEncContext *s = avctx->priv_data; | |
244 | int i, j; | ||
245 | int ret; | ||
246 | const AVPixFmtDescriptor *desc; | ||
247 | |||
248 | 32 | s->avctx = avctx; | |
249 | 32 | s->flags = avctx->flags; | |
250 | |||
251 | 32 | ff_bswapdsp_init(&s->bdsp); | |
252 | 32 | ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); | |
253 | 32 | ff_llvidencdsp_init(&s->llvidencdsp); | |
254 | |||
255 | 32 | avctx->extradata = av_mallocz(3*MAX_N + 4); | |
256 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (!avctx->extradata) |
257 | ✗ | return AVERROR(ENOMEM); | |
258 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (s->flags&AV_CODEC_FLAG_PASS1) { |
259 | #define STATS_OUT_SIZE 21*MAX_N*3 + 4 | ||
260 | ✗ | avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 | |
261 | ✗ | if (!avctx->stats_out) | |
262 | ✗ | return AVERROR(ENOMEM); | |
263 | } | ||
264 | 32 | s->version = 2; | |
265 | |||
266 | 32 | desc = av_pix_fmt_desc_get(avctx->pix_fmt); | |
267 | 32 | s->bps = desc->comp[0].depth; | |
268 |
3/4✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
32 | s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2; |
269 | 32 | s->chroma = desc->nb_components > 2; | |
270 | 32 | s->alpha = !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); | |
271 | 32 | s->chroma_h_shift = desc->log2_chroma_w; | |
272 | 32 | s->chroma_v_shift = desc->log2_chroma_h; | |
273 | |||
274 |
4/5✓ Branch 0 taken 8 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
32 | switch (avctx->pix_fmt) { |
275 | 8 | case AV_PIX_FMT_YUV420P: | |
276 | case AV_PIX_FMT_YUV422P: | ||
277 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (avctx->width & 1) { |
278 | ✗ | av_log(avctx, AV_LOG_ERROR, "Width must be even for this colorspace.\n"); | |
279 | ✗ | return AVERROR(EINVAL); | |
280 | } | ||
281 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | s->bitstream_bpp = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 12 : 16; |
282 | 8 | break; | |
283 | 16 | case AV_PIX_FMT_YUV444P: | |
284 | case AV_PIX_FMT_YUV410P: | ||
285 | case AV_PIX_FMT_YUV411P: | ||
286 | case AV_PIX_FMT_YUV440P: | ||
287 | case AV_PIX_FMT_GBRP: | ||
288 | case AV_PIX_FMT_GBRP9: | ||
289 | case AV_PIX_FMT_GBRP10: | ||
290 | case AV_PIX_FMT_GBRP12: | ||
291 | case AV_PIX_FMT_GBRP14: | ||
292 | case AV_PIX_FMT_GBRP16: | ||
293 | case AV_PIX_FMT_GRAY8: | ||
294 | case AV_PIX_FMT_GRAY16: | ||
295 | case AV_PIX_FMT_YUVA444P: | ||
296 | case AV_PIX_FMT_YUVA420P: | ||
297 | case AV_PIX_FMT_YUVA422P: | ||
298 | case AV_PIX_FMT_GBRAP: | ||
299 | case AV_PIX_FMT_YUV420P9: | ||
300 | case AV_PIX_FMT_YUV420P10: | ||
301 | case AV_PIX_FMT_YUV420P12: | ||
302 | case AV_PIX_FMT_YUV420P14: | ||
303 | case AV_PIX_FMT_YUV420P16: | ||
304 | case AV_PIX_FMT_YUV422P9: | ||
305 | case AV_PIX_FMT_YUV422P10: | ||
306 | case AV_PIX_FMT_YUV422P12: | ||
307 | case AV_PIX_FMT_YUV422P14: | ||
308 | case AV_PIX_FMT_YUV422P16: | ||
309 | case AV_PIX_FMT_YUV444P9: | ||
310 | case AV_PIX_FMT_YUV444P10: | ||
311 | case AV_PIX_FMT_YUV444P12: | ||
312 | case AV_PIX_FMT_YUV444P14: | ||
313 | case AV_PIX_FMT_YUV444P16: | ||
314 | case AV_PIX_FMT_YUVA420P9: | ||
315 | case AV_PIX_FMT_YUVA420P10: | ||
316 | case AV_PIX_FMT_YUVA420P16: | ||
317 | case AV_PIX_FMT_YUVA422P9: | ||
318 | case AV_PIX_FMT_YUVA422P10: | ||
319 | case AV_PIX_FMT_YUVA422P16: | ||
320 | case AV_PIX_FMT_YUVA444P9: | ||
321 | case AV_PIX_FMT_YUVA444P10: | ||
322 | case AV_PIX_FMT_YUVA444P16: | ||
323 | 16 | s->version = 3; | |
324 | 16 | break; | |
325 | 4 | case AV_PIX_FMT_RGB32: | |
326 | 4 | s->bitstream_bpp = 32; | |
327 | 4 | break; | |
328 | 4 | case AV_PIX_FMT_RGB24: | |
329 | 4 | s->bitstream_bpp = 24; | |
330 | 4 | break; | |
331 | ✗ | default: | |
332 | ✗ | av_log(avctx, AV_LOG_ERROR, "format not supported\n"); | |
333 | ✗ | return AVERROR(EINVAL); | |
334 | } | ||
335 | 32 | s->n = 1<<s->bps; | |
336 | 32 | s->vlc_n = FFMIN(s->n, MAX_VLC_N); | |
337 | |||
338 | 32 | avctx->bits_per_coded_sample = s->bitstream_bpp; | |
339 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
|
32 | s->decorrelate = s->bitstream_bpp >= 24 && !s->yuv && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR); |
340 | 32 | s->interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_ME ? 1 : 0; | |
341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (s->context) { |
342 | ✗ | if (s->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) { | |
343 | ✗ | av_log(avctx, AV_LOG_ERROR, | |
344 | "context=1 is not compatible with " | ||
345 | "2 pass huffyuv encoding\n"); | ||
346 | ✗ | return AVERROR(EINVAL); | |
347 | } | ||
348 | } | ||
349 | |||
350 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 20 times.
|
32 | if (avctx->codec->id == AV_CODEC_ID_HUFFYUV) { |
351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (s->interlaced != ( avctx->height > 288 )) |
352 | ✗ | av_log(avctx, AV_LOG_INFO, | |
353 | "using huffyuv 2.2.0 or newer interlacing flag\n"); | ||
354 | } | ||
355 | |||
356 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
32 | if (s->version > 3 && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { |
357 | ✗ | av_log(avctx, AV_LOG_ERROR, "Ver > 3 is under development, files encoded with it may not be decodable with future versions!!!\n" | |
358 | "Use vstrict=-2 / -strict -2 to use it anyway.\n"); | ||
359 | ✗ | return AVERROR(EINVAL); | |
360 | } | ||
361 | |||
362 |
3/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
32 | if (s->bitstream_bpp >= 24 && s->predictor == MEDIAN && s->version <= 2) { |
363 | ✗ | av_log(avctx, AV_LOG_ERROR, | |
364 | "Error: RGB is incompatible with median predictor\n"); | ||
365 | ✗ | return AVERROR(EINVAL); | |
366 | } | ||
367 | |||
368 | 32 | avctx->extradata[0] = s->predictor | (s->decorrelate << 6); | |
369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | avctx->extradata[2] = s->interlaced ? 0x10 : 0x20; |
370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (s->context) |
371 | ✗ | avctx->extradata[2] |= 0x40; | |
372 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
|
32 | if (s->version < 3) { |
373 | 16 | avctx->extradata[1] = s->bitstream_bpp; | |
374 | 16 | avctx->extradata[3] = 0; | |
375 | } else { | ||
376 | 16 | avctx->extradata[1] = ((s->bps-1)<<4) | s->chroma_h_shift | (s->chroma_v_shift<<2); | |
377 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (s->chroma) |
378 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | avctx->extradata[2] |= s->yuv ? 1 : 2; |
379 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (s->alpha) |
380 | ✗ | avctx->extradata[2] |= 4; | |
381 | 16 | avctx->extradata[3] = 1; | |
382 | } | ||
383 | 32 | avctx->extradata_size = 4; | |
384 | |||
385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (avctx->stats_in) { |
386 | ✗ | char *p = avctx->stats_in; | |
387 | |||
388 | ✗ | for (i = 0; i < 4; i++) | |
389 | ✗ | for (j = 0; j < s->vlc_n; j++) | |
390 | ✗ | s->stats[i][j] = 1; | |
391 | |||
392 | for (;;) { | ||
393 | ✗ | for (i = 0; i < 4; i++) { | |
394 | char *next; | ||
395 | |||
396 | ✗ | for (j = 0; j < s->vlc_n; j++) { | |
397 | ✗ | s->stats[i][j] += strtol(p, &next, 0); | |
398 | ✗ | if (next == p) return -1; | |
399 | ✗ | p = next; | |
400 | } | ||
401 | } | ||
402 | ✗ | if (p[0] == 0 || p[1] == 0 || p[2] == 0) break; | |
403 | } | ||
404 | } else { | ||
405 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 32 times.
|
160 | for (i = 0; i < 4; i++) |
406 |
2/2✓ Branch 0 taken 364544 times.
✓ Branch 1 taken 128 times.
|
364672 | for (j = 0; j < s->vlc_n; j++) { |
407 | 364544 | int d = FFMIN(j, s->vlc_n - j); | |
408 | |||
409 | 364544 | s->stats[i][j] = 100000000 / (d*d + 1); | |
410 | } | ||
411 | } | ||
412 | |||
413 | 32 | ret = store_huffman_tables(s, avctx->extradata + avctx->extradata_size); | |
414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (ret < 0) |
415 | ✗ | return ret; | |
416 | 32 | avctx->extradata_size += ret; | |
417 | |||
418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (s->context) { |
419 | ✗ | for (i = 0; i < 4; i++) { | |
420 | ✗ | int pels = avctx->width * avctx->height / (i ? 40 : 10); | |
421 | ✗ | for (j = 0; j < s->vlc_n; j++) { | |
422 | ✗ | int d = FFMIN(j, s->vlc_n - j); | |
423 | ✗ | s->stats[i][j] = pels/(d*d + 1); | |
424 | } | ||
425 | } | ||
426 | } else { | ||
427 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 32 times.
|
160 | for (i = 0; i < 4; i++) |
428 |
2/2✓ Branch 0 taken 364544 times.
✓ Branch 1 taken 128 times.
|
364672 | for (j = 0; j < s->vlc_n; j++) |
429 | 364544 | s->stats[i][j]= 0; | |
430 | } | ||
431 | |||
432 | 32 | ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width); | |
433 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (ret < 0) |
434 | ✗ | return ret; | |
435 | |||
436 | 32 | s->picture_number=0; | |
437 | |||
438 | 32 | return 0; | |
439 | } | ||
440 | 67350 | static int encode_422_bitstream(HYuvEncContext *s, int offset, int count) | |
441 | { | ||
442 | int i; | ||
443 | 67350 | const uint8_t *y = s->temp[0] + offset; | |
444 | 67350 | const uint8_t *u = s->temp[1] + offset / 2; | |
445 | 67350 | const uint8_t *v = s->temp[2] + offset / 2; | |
446 | |||
447 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 67350 times.
|
67350 | if (put_bytes_left(&s->pb, 0) < 2 * 4 * count) { |
448 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |
449 | ✗ | return -1; | |
450 | } | ||
451 | |||
452 | #define LOAD4\ | ||
453 | int y0 = y[2 * i];\ | ||
454 | int y1 = y[2 * i + 1];\ | ||
455 | int u0 = u[i];\ | ||
456 | int v0 = v[i]; | ||
457 | |||
458 | 67350 | count /= 2; | |
459 | |||
460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67350 times.
|
67350 | if (s->flags & AV_CODEC_FLAG_PASS1) { |
461 | ✗ | for(i = 0; i < count; i++) { | |
462 | ✗ | LOAD4; | |
463 | ✗ | s->stats[0][y0]++; | |
464 | ✗ | s->stats[1][u0]++; | |
465 | ✗ | s->stats[0][y1]++; | |
466 | ✗ | s->stats[2][v0]++; | |
467 | } | ||
468 | } | ||
469 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67350 times.
|
67350 | if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) |
470 | ✗ | return 0; | |
471 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67350 times.
|
67350 | if (s->context) { |
472 | ✗ | for (i = 0; i < count; i++) { | |
473 | ✗ | LOAD4; | |
474 | ✗ | s->stats[0][y0]++; | |
475 | ✗ | put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]); | |
476 | ✗ | s->stats[1][u0]++; | |
477 | ✗ | put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]); | |
478 | ✗ | s->stats[0][y1]++; | |
479 | ✗ | put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]); | |
480 | ✗ | s->stats[2][v0]++; | |
481 | ✗ | put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]); | |
482 | } | ||
483 | } else { | ||
484 |
2/2✓ Branch 0 taken 11447750 times.
✓ Branch 1 taken 67350 times.
|
11515100 | for(i = 0; i < count; i++) { |
485 | 11447750 | LOAD4; | |
486 | 11447750 | put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]); | |
487 | 11447750 | put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]); | |
488 | 11447750 | put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]); | |
489 | 11447750 | put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]); | |
490 | } | ||
491 | } | ||
492 | 67350 | return 0; | |
493 | } | ||
494 | |||
495 | 493900 | static int encode_plane_bitstream(HYuvEncContext *s, int width, int plane) | |
496 | { | ||
497 | 493900 | int i, count = width/2; | |
498 | |||
499 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 493900 times.
|
493900 | if (put_bytes_left(&s->pb, 0) < count * s->bps / 2) { |
500 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |
501 | ✗ | return -1; | |
502 | } | ||
503 | |||
504 | #define LOADEND\ | ||
505 | int y0 = s->temp[0][width-1]; | ||
506 | #define LOADEND_14\ | ||
507 | int y0 = s->temp16[0][width-1] & mask; | ||
508 | #define LOADEND_16\ | ||
509 | int y0 = s->temp16[0][width-1]; | ||
510 | #define STATEND\ | ||
511 | s->stats[plane][y0]++; | ||
512 | #define STATEND_16\ | ||
513 | s->stats[plane][y0>>2]++; | ||
514 | #define WRITEEND\ | ||
515 | put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]); | ||
516 | #define WRITEEND_16\ | ||
517 | put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\ | ||
518 | put_bits(&s->pb, 2, y0&3); | ||
519 | |||
520 | #define LOAD2\ | ||
521 | int y0 = s->temp[0][2 * i];\ | ||
522 | int y1 = s->temp[0][2 * i + 1]; | ||
523 | #define LOAD2_14\ | ||
524 | int y0 = s->temp16[0][2 * i] & mask;\ | ||
525 | int y1 = s->temp16[0][2 * i + 1] & mask; | ||
526 | #define LOAD2_16\ | ||
527 | int y0 = s->temp16[0][2 * i];\ | ||
528 | int y1 = s->temp16[0][2 * i + 1]; | ||
529 | #define STAT2\ | ||
530 | s->stats[plane][y0]++;\ | ||
531 | s->stats[plane][y1]++; | ||
532 | #define STAT2_16\ | ||
533 | s->stats[plane][y0>>2]++;\ | ||
534 | s->stats[plane][y1>>2]++; | ||
535 | #define WRITE2\ | ||
536 | put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]);\ | ||
537 | put_bits(&s->pb, s->len[plane][y1], s->bits[plane][y1]); | ||
538 | #define WRITE2_16\ | ||
539 | put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\ | ||
540 | put_bits(&s->pb, 2, y0&3);\ | ||
541 | put_bits(&s->pb, s->len[plane][y1>>2], s->bits[plane][y1>>2]);\ | ||
542 | put_bits(&s->pb, 2, y1&3); | ||
543 | |||
544 |
2/2✓ Branch 0 taken 134700 times.
✓ Branch 1 taken 359200 times.
|
493900 | if (s->bps <= 8) { |
545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->flags & AV_CODEC_FLAG_PASS1) { |
546 | ✗ | for (i = 0; i < count; i++) { | |
547 | ✗ | LOAD2; | |
548 | ✗ | STAT2; | |
549 | } | ||
550 | ✗ | if (width&1) { | |
551 | ✗ | LOADEND; | |
552 | ✗ | STATEND; | |
553 | } | ||
554 | } | ||
555 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) |
556 | ✗ | return 0; | |
557 | |||
558 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->context) { |
559 | ✗ | for (i = 0; i < count; i++) { | |
560 | ✗ | LOAD2; | |
561 | ✗ | STAT2; | |
562 | ✗ | WRITE2; | |
563 | } | ||
564 | ✗ | if (width&1) { | |
565 | ✗ | LOADEND; | |
566 | ✗ | STATEND; | |
567 | ✗ | WRITEEND; | |
568 | } | ||
569 | } else { | ||
570 |
2/2✓ Branch 0 taken 22896300 times.
✓ Branch 1 taken 134700 times.
|
23031000 | for (i = 0; i < count; i++) { |
571 | 22896300 | LOAD2; | |
572 | 22896300 | WRITE2; | |
573 | } | ||
574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (width&1) { |
575 | ✗ | LOADEND; | |
576 | ✗ | WRITEEND; | |
577 | } | ||
578 | } | ||
579 |
2/2✓ Branch 0 taken 224500 times.
✓ Branch 1 taken 134700 times.
|
359200 | } else if (s->bps <= 14) { |
580 | 224500 | int mask = s->n - 1; | |
581 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 224500 times.
|
224500 | if (s->flags & AV_CODEC_FLAG_PASS1) { |
582 | ✗ | for (i = 0; i < count; i++) { | |
583 | ✗ | LOAD2_14; | |
584 | ✗ | STAT2; | |
585 | } | ||
586 | ✗ | if (width&1) { | |
587 | ✗ | LOADEND_14; | |
588 | ✗ | STATEND; | |
589 | } | ||
590 | } | ||
591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 224500 times.
|
224500 | if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) |
592 | ✗ | return 0; | |
593 | |||
594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 224500 times.
|
224500 | if (s->context) { |
595 | ✗ | for (i = 0; i < count; i++) { | |
596 | ✗ | LOAD2_14; | |
597 | ✗ | STAT2; | |
598 | ✗ | WRITE2; | |
599 | } | ||
600 | ✗ | if (width&1) { | |
601 | ✗ | LOADEND_14; | |
602 | ✗ | STATEND; | |
603 | ✗ | WRITEEND; | |
604 | } | ||
605 | } else { | ||
606 |
2/2✓ Branch 0 taken 26709800 times.
✓ Branch 1 taken 224500 times.
|
26934300 | for (i = 0; i < count; i++) { |
607 | 26709800 | LOAD2_14; | |
608 | 26709800 | WRITE2; | |
609 | } | ||
610 |
2/2✓ Branch 0 taken 5100 times.
✓ Branch 1 taken 219400 times.
|
224500 | if (width&1) { |
611 | 5100 | LOADEND_14; | |
612 | 5100 | WRITEEND; | |
613 | } | ||
614 | } | ||
615 | } else { | ||
616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->flags & AV_CODEC_FLAG_PASS1) { |
617 | ✗ | for (i = 0; i < count; i++) { | |
618 | ✗ | LOAD2_16; | |
619 | ✗ | STAT2_16; | |
620 | } | ||
621 | ✗ | if (width&1) { | |
622 | ✗ | LOADEND_16; | |
623 | ✗ | STATEND_16; | |
624 | } | ||
625 | } | ||
626 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) |
627 | ✗ | return 0; | |
628 | |||
629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (s->context) { |
630 | ✗ | for (i = 0; i < count; i++) { | |
631 | ✗ | LOAD2_16; | |
632 | ✗ | STAT2_16; | |
633 | ✗ | WRITE2_16; | |
634 | } | ||
635 | ✗ | if (width&1) { | |
636 | ✗ | LOADEND_16; | |
637 | ✗ | STATEND_16; | |
638 | ✗ | WRITEEND_16; | |
639 | } | ||
640 | } else { | ||
641 |
2/2✓ Branch 0 taken 22896300 times.
✓ Branch 1 taken 134700 times.
|
23031000 | for (i = 0; i < count; i++) { |
642 | 22896300 | LOAD2_16; | |
643 | 22896300 | WRITE2_16; | |
644 | } | ||
645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134700 times.
|
134700 | if (width&1) { |
646 | ✗ | LOADEND_16; | |
647 | ✗ | WRITEEND_16; | |
648 | } | ||
649 | } | ||
650 | } | ||
651 | #undef LOAD2 | ||
652 | #undef STAT2 | ||
653 | #undef WRITE2 | ||
654 | 493900 | return 0; | |
655 | } | ||
656 | |||
657 | 22450 | static int encode_gray_bitstream(HYuvEncContext *s, int count) | |
658 | { | ||
659 | int i; | ||
660 | |||
661 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22450 times.
|
22450 | if (put_bytes_left(&s->pb, 0) < 4 * count) { |
662 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |
663 | ✗ | return -1; | |
664 | } | ||
665 | |||
666 | #define LOAD2\ | ||
667 | int y0 = s->temp[0][2 * i];\ | ||
668 | int y1 = s->temp[0][2 * i + 1]; | ||
669 | #define STAT2\ | ||
670 | s->stats[0][y0]++;\ | ||
671 | s->stats[0][y1]++; | ||
672 | #define WRITE2\ | ||
673 | put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\ | ||
674 | put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]); | ||
675 | |||
676 | 22450 | count /= 2; | |
677 | |||
678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22450 times.
|
22450 | if (s->flags & AV_CODEC_FLAG_PASS1) { |
679 | ✗ | for (i = 0; i < count; i++) { | |
680 | ✗ | LOAD2; | |
681 | ✗ | STAT2; | |
682 | } | ||
683 | } | ||
684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22450 times.
|
22450 | if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) |
685 | ✗ | return 0; | |
686 | |||
687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22450 times.
|
22450 | if (s->context) { |
688 | ✗ | for (i = 0; i < count; i++) { | |
689 | ✗ | LOAD2; | |
690 | ✗ | STAT2; | |
691 | ✗ | WRITE2; | |
692 | } | ||
693 | } else { | ||
694 |
2/2✓ Branch 0 taken 3816050 times.
✓ Branch 1 taken 22450 times.
|
3838500 | for (i = 0; i < count; i++) { |
695 | 3816050 | LOAD2; | |
696 | 3816050 | WRITE2; | |
697 | } | ||
698 | } | ||
699 | 22450 | return 0; | |
700 | } | ||
701 | |||
702 | 89800 | static inline int encode_bgra_bitstream(HYuvEncContext *s, int count, int planes) | |
703 | { | ||
704 | int i; | ||
705 | |||
706 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 89800 times.
|
89800 | if (put_bytes_left(&s->pb, 0) < 4 * planes * count) { |
707 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |
708 | ✗ | return -1; | |
709 | } | ||
710 | |||
711 | #define LOAD_GBRA \ | ||
712 | int g = s->temp[0][planes == 3 ? 3 * i + 1 : 4 * i + G]; \ | ||
713 | int b =(s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g) & 0xFF;\ | ||
714 | int r =(s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g) & 0xFF;\ | ||
715 | int a = s->temp[0][planes * i + A]; | ||
716 | |||
717 | #define STAT_BGRA \ | ||
718 | s->stats[0][b]++; \ | ||
719 | s->stats[1][g]++; \ | ||
720 | s->stats[2][r]++; \ | ||
721 | if (planes == 4) \ | ||
722 | s->stats[2][a]++; | ||
723 | |||
724 | #define WRITE_GBRA \ | ||
725 | put_bits(&s->pb, s->len[1][g], s->bits[1][g]); \ | ||
726 | put_bits(&s->pb, s->len[0][b], s->bits[0][b]); \ | ||
727 | put_bits(&s->pb, s->len[2][r], s->bits[2][r]); \ | ||
728 | if (planes == 4) \ | ||
729 | put_bits(&s->pb, s->len[2][a], s->bits[2][a]); | ||
730 | |||
731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89800 times.
|
89800 | if ((s->flags & AV_CODEC_FLAG_PASS1) && |
732 | ✗ | (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)) { | |
733 | ✗ | for (i = 0; i < count; i++) { | |
734 | ✗ | LOAD_GBRA; | |
735 | ✗ | STAT_BGRA; | |
736 | } | ||
737 |
2/4✓ Branch 0 taken 89800 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 89800 times.
|
89800 | } else if (s->context || (s->flags & AV_CODEC_FLAG_PASS1)) { |
738 | ✗ | for (i = 0; i < count; i++) { | |
739 | ✗ | LOAD_GBRA; | |
740 | ✗ | STAT_BGRA; | |
741 | ✗ | WRITE_GBRA; | |
742 | } | ||
743 | } else { | ||
744 |
2/2✓ Branch 0 taken 30528000 times.
✓ Branch 1 taken 89800 times.
|
30617800 | for (i = 0; i < count; i++) { |
745 |
6/6✓ Branch 0 taken 15264000 times.
✓ Branch 1 taken 15264000 times.
✓ Branch 2 taken 15264000 times.
✓ Branch 3 taken 15264000 times.
✓ Branch 4 taken 15264000 times.
✓ Branch 5 taken 15264000 times.
|
30528000 | LOAD_GBRA; |
746 |
2/2✓ Branch 3 taken 15264000 times.
✓ Branch 4 taken 15264000 times.
|
30528000 | WRITE_GBRA; |
747 | } | ||
748 | } | ||
749 | 89800 | return 0; | |
750 | } | ||
751 | |||
752 | 1600 | static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |
753 | const AVFrame *pict, int *got_packet) | ||
754 | { | ||
755 | 1600 | HYuvEncContext *s = avctx->priv_data; | |
756 | 1600 | const int width = avctx->width; | |
757 | 1600 | const int width2 = avctx->width >> 1; | |
758 | 1600 | const int height = avctx->height; | |
759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
|
1600 | const int fake_ystride = s->interlaced ? pict->linesize[0]*2 : pict->linesize[0]; |
760 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
|
1600 | const int fake_ustride = s->interlaced ? pict->linesize[1]*2 : pict->linesize[1]; |
761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
|
1600 | const int fake_vstride = s->interlaced ? pict->linesize[2]*2 : pict->linesize[2]; |
762 | 1600 | const AVFrame * const p = pict; | |
763 | 1600 | int i, j, size = 0, ret; | |
764 | |||
765 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1600 times.
|
1600 | if ((ret = ff_alloc_packet(avctx, pkt, width * height * 3 * 4 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) |
766 | ✗ | return ret; | |
767 | |||
768 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
|
1600 | if (s->context) { |
769 | ✗ | size = store_huffman_tables(s, pkt->data); | |
770 | ✗ | if (size < 0) | |
771 | ✗ | return size; | |
772 | |||
773 | ✗ | for (i = 0; i < 4; i++) | |
774 | ✗ | for (j = 0; j < s->vlc_n; j++) | |
775 | ✗ | s->stats[i][j] >>= 1; | |
776 | } | ||
777 | |||
778 | 1600 | init_put_bits(&s->pb, pkt->data + size, pkt->size - size); | |
779 | |||
780 |
2/2✓ Branch 0 taken 1400 times.
✓ Branch 1 taken 200 times.
|
1600 | if (avctx->pix_fmt == AV_PIX_FMT_YUV422P || |
781 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 1200 times.
|
1800 | avctx->pix_fmt == AV_PIX_FMT_YUV420P) { |
782 | int lefty, leftu, leftv, y, cy; | ||
783 | |||
784 | 400 | put_bits(&s->pb, 8, leftv = p->data[2][0]); | |
785 | 400 | put_bits(&s->pb, 8, lefty = p->data[0][1]); | |
786 | 400 | put_bits(&s->pb, 8, leftu = p->data[1][0]); | |
787 | 400 | put_bits(&s->pb, 8, p->data[0][0]); | |
788 | |||
789 | 400 | lefty = sub_left_prediction(s, s->temp[0], p->data[0], width , 0); | |
790 | 400 | leftu = sub_left_prediction(s, s->temp[1], p->data[1], width2, 0); | |
791 | 400 | leftv = sub_left_prediction(s, s->temp[2], p->data[2], width2, 0); | |
792 | |||
793 | 400 | encode_422_bitstream(s, 2, width-2); | |
794 | |||
795 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 400 times.
|
400 | if (s->predictor==MEDIAN) { |
796 | int lefttopy, lefttopu, lefttopv; | ||
797 | ✗ | cy = y = 1; | |
798 | ✗ | if (s->interlaced) { | |
799 | ✗ | lefty = sub_left_prediction(s, s->temp[0], p->data[0] + p->linesize[0], width , lefty); | |
800 | ✗ | leftu = sub_left_prediction(s, s->temp[1], p->data[1] + p->linesize[1], width2, leftu); | |
801 | ✗ | leftv = sub_left_prediction(s, s->temp[2], p->data[2] + p->linesize[2], width2, leftv); | |
802 | |||
803 | ✗ | encode_422_bitstream(s, 0, width); | |
804 | ✗ | y++; cy++; | |
805 | } | ||
806 | |||
807 | ✗ | lefty = sub_left_prediction(s, s->temp[0], p->data[0] + fake_ystride, 4, lefty); | |
808 | ✗ | leftu = sub_left_prediction(s, s->temp[1], p->data[1] + fake_ustride, 2, leftu); | |
809 | ✗ | leftv = sub_left_prediction(s, s->temp[2], p->data[2] + fake_vstride, 2, leftv); | |
810 | |||
811 | ✗ | encode_422_bitstream(s, 0, 4); | |
812 | |||
813 | ✗ | lefttopy = p->data[0][3]; | |
814 | ✗ | lefttopu = p->data[1][1]; | |
815 | ✗ | lefttopv = p->data[2][1]; | |
816 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[0], p->data[0] + 4, p->data[0] + fake_ystride + 4, width - 4, &lefty, &lefttopy); | |
817 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[1], p->data[1] + 2, p->data[1] + fake_ustride + 2, width2 - 2, &leftu, &lefttopu); | |
818 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[2], p->data[2] + 2, p->data[2] + fake_vstride + 2, width2 - 2, &leftv, &lefttopv); | |
819 | ✗ | encode_422_bitstream(s, 0, width - 4); | |
820 | ✗ | y++; cy++; | |
821 | |||
822 | ✗ | for (; y < height; y++,cy++) { | |
823 | const uint8_t *ydst, *udst, *vdst; | ||
824 | |||
825 | ✗ | if (s->bitstream_bpp == 12) { | |
826 | ✗ | while (2 * cy > y) { | |
827 | ✗ | ydst = p->data[0] + p->linesize[0] * y; | |
828 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[0], ydst - fake_ystride, ydst, width, &lefty, &lefttopy); | |
829 | ✗ | encode_gray_bitstream(s, width); | |
830 | ✗ | y++; | |
831 | } | ||
832 | ✗ | if (y >= height) break; | |
833 | } | ||
834 | ✗ | ydst = p->data[0] + p->linesize[0] * y; | |
835 | ✗ | udst = p->data[1] + p->linesize[1] * cy; | |
836 | ✗ | vdst = p->data[2] + p->linesize[2] * cy; | |
837 | |||
838 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[0], ydst - fake_ystride, ydst, width, &lefty, &lefttopy); | |
839 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu); | |
840 | ✗ | s->llvidencdsp.sub_median_pred(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv); | |
841 | |||
842 | ✗ | encode_422_bitstream(s, 0, width); | |
843 | } | ||
844 | } else { | ||
845 |
2/2✓ Branch 0 taken 67150 times.
✓ Branch 1 taken 200 times.
|
67350 | for (cy = y = 1; y < height; y++, cy++) { |
846 | const uint8_t *ydst, *udst, *vdst; | ||
847 | |||
848 | /* encode a luma only line & y++ */ | ||
849 |
2/2✓ Branch 0 taken 22450 times.
✓ Branch 1 taken 44700 times.
|
67150 | if (s->bitstream_bpp == 12) { |
850 | 22450 | ydst = p->data[0] + p->linesize[0] * y; | |
851 | |||
852 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22450 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22450 | if (s->predictor == PLANE && s->interlaced < y) { |
853 | ✗ | s->llvidencdsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); | |
854 | |||
855 | ✗ | lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty); | |
856 | } else { | ||
857 | 22450 | lefty = sub_left_prediction(s, s->temp[0], ydst, width , lefty); | |
858 | } | ||
859 | 22450 | encode_gray_bitstream(s, width); | |
860 | 22450 | y++; | |
861 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 22250 times.
|
22450 | if (y >= height) break; |
862 | } | ||
863 | |||
864 | 66950 | ydst = p->data[0] + p->linesize[0] * y; | |
865 | 66950 | udst = p->data[1] + p->linesize[1] * cy; | |
866 | 66950 | vdst = p->data[2] + p->linesize[2] * cy; | |
867 | |||
868 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 66950 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
66950 | if (s->predictor == PLANE && s->interlaced < cy) { |
869 | ✗ | s->llvidencdsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); | |
870 | ✗ | s->llvidencdsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2); | |
871 | ✗ | s->llvidencdsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2); | |
872 | |||
873 | ✗ | lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty); | |
874 | ✗ | leftu = sub_left_prediction(s, s->temp[1], s->temp[2], width2, leftu); | |
875 | ✗ | leftv = sub_left_prediction(s, s->temp[2], s->temp[2] + width2, width2, leftv); | |
876 | } else { | ||
877 | 66950 | lefty = sub_left_prediction(s, s->temp[0], ydst, width , lefty); | |
878 | 66950 | leftu = sub_left_prediction(s, s->temp[1], udst, width2, leftu); | |
879 | 66950 | leftv = sub_left_prediction(s, s->temp[2], vdst, width2, leftv); | |
880 | } | ||
881 | |||
882 | 66950 | encode_422_bitstream(s, 0, width); | |
883 | } | ||
884 | } | ||
885 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 1000 times.
|
1200 | } else if(avctx->pix_fmt == AV_PIX_FMT_RGB32) { |
886 | 200 | const uint8_t *data = p->data[0] + (height - 1) * p->linesize[0]; | |
887 | 200 | const int stride = -p->linesize[0]; | |
888 | 200 | const int fake_stride = -fake_ystride; | |
889 | int leftr, leftg, leftb, lefta; | ||
890 | |||
891 | 200 | put_bits(&s->pb, 8, lefta = data[A]); | |
892 | 200 | put_bits(&s->pb, 8, leftr = data[R]); | |
893 | 200 | put_bits(&s->pb, 8, leftg = data[G]); | |
894 | 200 | put_bits(&s->pb, 8, leftb = data[B]); | |
895 | |||
896 | 200 | sub_left_prediction_bgr32(s, s->temp[0], data + 4, width - 1, | |
897 | &leftr, &leftg, &leftb, &lefta); | ||
898 | 200 | encode_bgra_bitstream(s, width - 1, 4); | |
899 | |||
900 |
2/2✓ Branch 0 taken 44700 times.
✓ Branch 1 taken 200 times.
|
44900 | for (int y = 1; y < height; y++) { |
901 | 44700 | const uint8_t *dst = data + y*stride; | |
902 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44700 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44700 | if (s->predictor == PLANE && s->interlaced < y) { |
903 | ✗ | s->llvidencdsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width * 4); | |
904 | ✗ | sub_left_prediction_bgr32(s, s->temp[0], s->temp[1], width, | |
905 | &leftr, &leftg, &leftb, &lefta); | ||
906 | } else { | ||
907 | 44700 | sub_left_prediction_bgr32(s, s->temp[0], dst, width, | |
908 | &leftr, &leftg, &leftb, &lefta); | ||
909 | } | ||
910 | 44700 | encode_bgra_bitstream(s, width, 4); | |
911 | } | ||
912 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 800 times.
|
1000 | } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) { |
913 | 200 | const uint8_t *data = p->data[0] + (height - 1) * p->linesize[0]; | |
914 | 200 | const int stride = -p->linesize[0]; | |
915 | 200 | const int fake_stride = -fake_ystride; | |
916 | int leftr, leftg, leftb; | ||
917 | |||
918 | 200 | put_bits(&s->pb, 8, leftr = data[0]); | |
919 | 200 | put_bits(&s->pb, 8, leftg = data[1]); | |
920 | 200 | put_bits(&s->pb, 8, leftb = data[2]); | |
921 | 200 | put_bits(&s->pb, 8, 0); | |
922 | |||
923 | 200 | sub_left_prediction_rgb24(s, s->temp[0], data + 3, width - 1, | |
924 | &leftr, &leftg, &leftb); | ||
925 | 200 | encode_bgra_bitstream(s, width-1, 3); | |
926 | |||
927 |
2/2✓ Branch 0 taken 44700 times.
✓ Branch 1 taken 200 times.
|
44900 | for (int y = 1; y < height; y++) { |
928 | 44700 | const uint8_t *dst = data + y * stride; | |
929 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44700 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44700 | if (s->predictor == PLANE && s->interlaced < y) { |
930 | ✗ | s->llvidencdsp.diff_bytes(s->temp[1], dst, dst - fake_stride, | |
931 | ✗ | width * 3); | |
932 | ✗ | sub_left_prediction_rgb24(s, s->temp[0], s->temp[1], width, | |
933 | &leftr, &leftg, &leftb); | ||
934 | } else { | ||
935 | 44700 | sub_left_prediction_rgb24(s, s->temp[0], dst, width, | |
936 | &leftr, &leftg, &leftb); | ||
937 | } | ||
938 | 44700 | encode_bgra_bitstream(s, width, 3); | |
939 | } | ||
940 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | } else if (s->version > 2) { |
941 | int plane; | ||
942 |
2/2✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 800 times.
|
3200 | for (plane = 0; plane < 1 + 2*s->chroma + s->alpha; plane++) { |
943 | int left, y; | ||
944 | 2400 | int w = width; | |
945 | 2400 | int h = height; | |
946 | 2400 | int fake_stride = fake_ystride; | |
947 | |||
948 |
5/6✓ Branch 0 taken 2400 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1600 times.
✓ Branch 3 taken 800 times.
✓ Branch 4 taken 800 times.
✓ Branch 5 taken 800 times.
|
2400 | if (s->chroma && (plane == 1 || plane == 2)) { |
949 | 1600 | w >>= s->chroma_h_shift; | |
950 | 1600 | h >>= s->chroma_v_shift; | |
951 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 800 times.
|
1600 | fake_stride = plane == 1 ? fake_ustride : fake_vstride; |
952 | } | ||
953 | |||
954 | 2400 | left = sub_left_prediction(s, s->temp[0], p->data[plane], w , 0); | |
955 | |||
956 | 2400 | encode_plane_bitstream(s, w, plane); | |
957 | |||
958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2400 times.
|
2400 | if (s->predictor==MEDIAN) { |
959 | int lefttop; | ||
960 | ✗ | y = 1; | |
961 | ✗ | if (s->interlaced) { | |
962 | ✗ | left = sub_left_prediction(s, s->temp[0], p->data[plane] + p->linesize[plane], w , left); | |
963 | |||
964 | ✗ | encode_plane_bitstream(s, w, plane); | |
965 | ✗ | y++; | |
966 | } | ||
967 | |||
968 | ✗ | lefttop = p->data[plane][0]; | |
969 | |||
970 | ✗ | for (; y < h; y++) { | |
971 | ✗ | const uint8_t *dst = p->data[plane] + p->linesize[plane] * y; | |
972 | |||
973 | ✗ | sub_median_prediction(s, s->temp[0], dst - fake_stride, dst, w , &left, &lefttop); | |
974 | |||
975 | ✗ | encode_plane_bitstream(s, w, plane); | |
976 | } | ||
977 | } else { | ||
978 |
2/2✓ Branch 0 taken 491500 times.
✓ Branch 1 taken 2400 times.
|
493900 | for (y = 1; y < h; y++) { |
979 | 491500 | const uint8_t *dst = p->data[plane] + p->linesize[plane] * y; | |
980 | |||
981 |
3/4✓ Branch 0 taken 134100 times.
✓ Branch 1 taken 357400 times.
✓ Branch 2 taken 134100 times.
✗ Branch 3 not taken.
|
491500 | if (s->predictor == PLANE && s->interlaced < y) { |
982 | 134100 | diff_bytes(s, s->temp[1], dst, dst - fake_stride, w); | |
983 | |||
984 | 134100 | left = sub_left_prediction(s, s->temp[0], s->temp[1], w , left); | |
985 | } else { | ||
986 | 357400 | left = sub_left_prediction(s, s->temp[0], dst, w , left); | |
987 | } | ||
988 | |||
989 | 491500 | encode_plane_bitstream(s, w, plane); | |
990 | } | ||
991 | } | ||
992 | } | ||
993 | } else { | ||
994 | ✗ | av_log(avctx, AV_LOG_ERROR, "Format not supported!\n"); | |
995 | } | ||
996 | 1600 | emms_c(); | |
997 | |||
998 | 1600 | size += (put_bits_count(&s->pb) + 31) / 8; | |
999 | 1600 | put_bits(&s->pb, 16, 0); | |
1000 | 1600 | put_bits(&s->pb, 15, 0); | |
1001 | 1600 | size /= 4; | |
1002 | |||
1003 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1600 | if ((s->flags & AV_CODEC_FLAG_PASS1) && (s->picture_number & 31) == 0) { |
1004 | int j; | ||
1005 | ✗ | char *p = avctx->stats_out; | |
1006 | ✗ | char *end = p + STATS_OUT_SIZE; | |
1007 | ✗ | for (i = 0; i < 4; i++) { | |
1008 | ✗ | for (j = 0; j < s->vlc_n; j++) { | |
1009 | ✗ | snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]); | |
1010 | ✗ | p += strlen(p); | |
1011 | ✗ | s->stats[i][j]= 0; | |
1012 | } | ||
1013 | ✗ | snprintf(p, end-p, "\n"); | |
1014 | ✗ | p++; | |
1015 | ✗ | if (end <= p) | |
1016 | ✗ | return AVERROR(ENOMEM); | |
1017 | } | ||
1018 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1600 times.
|
1600 | } else if (avctx->stats_out) |
1019 | ✗ | avctx->stats_out[0] = '\0'; | |
1020 |
1/2✓ Branch 0 taken 1600 times.
✗ Branch 1 not taken.
|
1600 | if (!(s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)) { |
1021 | 1600 | flush_put_bits(&s->pb); | |
1022 | 1600 | s->bdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size); | |
1023 | } | ||
1024 | |||
1025 | 1600 | s->picture_number++; | |
1026 | |||
1027 | 1600 | pkt->size = size * 4; | |
1028 | 1600 | *got_packet = 1; | |
1029 | |||
1030 | 1600 | return 0; | |
1031 | } | ||
1032 | |||
1033 | 32 | static av_cold int encode_end(AVCodecContext *avctx) | |
1034 | { | ||
1035 | 32 | HYuvEncContext *s = avctx->priv_data; | |
1036 | |||
1037 | 32 | ff_huffyuv_common_end(s->temp, s->temp16); | |
1038 | |||
1039 | 32 | av_freep(&avctx->stats_out); | |
1040 | |||
1041 | 32 | return 0; | |
1042 | } | ||
1043 | |||
1044 | #define OFFSET(x) offsetof(HYuvEncContext, x) | ||
1045 | #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM | ||
1046 | |||
1047 | #define COMMON_OPTIONS \ | ||
1048 | { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism", \ | ||
1049 | OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 0 }, \ | ||
1050 | 0, 1, VE }, \ | ||
1051 | { "pred", "Prediction method", OFFSET(predictor), AV_OPT_TYPE_INT, { .i64 = LEFT }, LEFT, MEDIAN, VE, "pred" }, \ | ||
1052 | { "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LEFT }, INT_MIN, INT_MAX, VE, "pred" }, \ | ||
1053 | { "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PLANE }, INT_MIN, INT_MAX, VE, "pred" }, \ | ||
1054 | { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MEDIAN }, INT_MIN, INT_MAX, VE, "pred" }, \ | ||
1055 | |||
1056 | static const AVOption normal_options[] = { | ||
1057 | COMMON_OPTIONS | ||
1058 | { NULL }, | ||
1059 | }; | ||
1060 | |||
1061 | static const AVOption ff_options[] = { | ||
1062 | COMMON_OPTIONS | ||
1063 | { "context", "Set per-frame huffman tables", OFFSET(context), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, | ||
1064 | { NULL }, | ||
1065 | }; | ||
1066 | |||
1067 | static const AVClass normal_class = { | ||
1068 | .class_name = "huffyuv", | ||
1069 | .item_name = av_default_item_name, | ||
1070 | .option = normal_options, | ||
1071 | .version = LIBAVUTIL_VERSION_INT, | ||
1072 | }; | ||
1073 | |||
1074 | static const AVClass ff_class = { | ||
1075 | .class_name = "ffvhuff", | ||
1076 | .item_name = av_default_item_name, | ||
1077 | .option = ff_options, | ||
1078 | .version = LIBAVUTIL_VERSION_INT, | ||
1079 | }; | ||
1080 | |||
1081 | const FFCodec ff_huffyuv_encoder = { | ||
1082 | .p.name = "huffyuv", | ||
1083 | CODEC_LONG_NAME("Huffyuv / HuffYUV"), | ||
1084 | .p.type = AVMEDIA_TYPE_VIDEO, | ||
1085 | .p.id = AV_CODEC_ID_HUFFYUV, | ||
1086 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | | ||
1087 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, | ||
1088 | .priv_data_size = sizeof(HYuvEncContext), | ||
1089 | .init = encode_init, | ||
1090 | FF_CODEC_ENCODE_CB(encode_frame), | ||
1091 | .close = encode_end, | ||
1092 | .p.priv_class = &normal_class, | ||
1093 | .p.pix_fmts = (const enum AVPixelFormat[]){ | ||
1094 | AV_PIX_FMT_YUV422P, AV_PIX_FMT_RGB24, | ||
1095 | AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE | ||
1096 | }, | ||
1097 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, | ||
1098 | }; | ||
1099 | |||
1100 | #if CONFIG_FFVHUFF_ENCODER | ||
1101 | const FFCodec ff_ffvhuff_encoder = { | ||
1102 | .p.name = "ffvhuff", | ||
1103 | CODEC_LONG_NAME("Huffyuv FFmpeg variant"), | ||
1104 | .p.type = AVMEDIA_TYPE_VIDEO, | ||
1105 | .p.id = AV_CODEC_ID_FFVHUFF, | ||
1106 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | | ||
1107 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, | ||
1108 | .priv_data_size = sizeof(HYuvEncContext), | ||
1109 | .init = encode_init, | ||
1110 | FF_CODEC_ENCODE_CB(encode_frame), | ||
1111 | .close = encode_end, | ||
1112 | .p.priv_class = &ff_class, | ||
1113 | .p.pix_fmts = (const enum AVPixelFormat[]){ | ||
1114 | AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV411P, | ||
1115 | AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P, | ||
1116 | AV_PIX_FMT_GBRP, | ||
1117 | AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, | ||
1118 | AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16, | ||
1119 | AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, | ||
1120 | AV_PIX_FMT_GBRAP, | ||
1121 | AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV420P16, | ||
1122 | AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV422P16, | ||
1123 | AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, | ||
1124 | AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, | ||
1125 | AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA422P16, | ||
1126 | AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P16, | ||
1127 | AV_PIX_FMT_RGB24, | ||
1128 | AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE | ||
1129 | }, | ||
1130 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, | ||
1131 | }; | ||
1132 | #endif | ||
1133 |