GCC Code Coverage Report
Directory: ../../../ffmpeg/ Exec Total Coverage
File: src/libavcodec/wmv2dec.c Lines: 252 287 87.8 %
Date: 2020-08-13 15:06:06 Branches: 152 189 80.4 %

Line Branch Exec Source
1
/*
2
 * Copyright (c) 2002 The FFmpeg Project
3
 *
4
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * FFmpeg is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with FFmpeg; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
21
#include "avcodec.h"
22
#include "h263.h"
23
#include "internal.h"
24
#include "intrax8.h"
25
#include "mathops.h"
26
#include "mpegutils.h"
27
#include "mpegvideo.h"
28
#include "msmpeg4.h"
29
#include "msmpeg4data.h"
30
#include "wmv2.h"
31
32
33
645
static int parse_mb_skip(Wmv2Context *w)
34
{
35
    int mb_x, mb_y;
36
645
    int coded_mb_count = 0;
37
645
    MpegEncContext *const s = &w->s;
38
645
    uint32_t *const mb_type = s->current_picture_ptr->mb_type;
39
40
645
    w->skip_type = get_bits(&s->gb, 2);
41

645
    switch (w->skip_type) {
42
230
    case SKIP_TYPE_NONE:
43
3545
        for (mb_y = 0; mb_y < s->mb_height; mb_y++)
44
72180
            for (mb_x = 0; mb_x < s->mb_width; mb_x++)
45
68865
                mb_type[mb_y * s->mb_stride + mb_x] =
46
                    MB_TYPE_16x16 | MB_TYPE_L0;
47
230
        break;
48
28
    case SKIP_TYPE_MPEG:
49
28
        if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
50
            return AVERROR_INVALIDDATA;
51
448
        for (mb_y = 0; mb_y < s->mb_height; mb_y++)
52
8820
            for (mb_x = 0; mb_x < s->mb_width; mb_x++)
53
8400
                mb_type[mb_y * s->mb_stride + mb_x] =
54
8400
                    (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
55
28
        break;
56
354
    case SKIP_TYPE_ROW:
57
5664
        for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
58
5310
            if (get_bits_left(&s->gb) < 1)
59
                return AVERROR_INVALIDDATA;
60
5310
            if (get_bits1(&s->gb)) {
61
17220
                for (mb_x = 0; mb_x < s->mb_width; mb_x++)
62
16400
                    mb_type[mb_y * s->mb_stride + mb_x] =
63
                        MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
64
            } else {
65
94290
                for (mb_x = 0; mb_x < s->mb_width; mb_x++)
66
89800
                    mb_type[mb_y * s->mb_stride + mb_x] =
67
89800
                        (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
68
            }
69
        }
70
354
        break;
71
33
    case SKIP_TYPE_COL:
72
693
        for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
73
660
            if (get_bits_left(&s->gb) < 1)
74
                return AVERROR_INVALIDDATA;
75
660
            if (get_bits1(&s->gb)) {
76
2736
                for (mb_y = 0; mb_y < s->mb_height; mb_y++)
77
2565
                    mb_type[mb_y * s->mb_stride + mb_x] =
78
                        MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
79
            } else {
80
7824
                for (mb_y = 0; mb_y < s->mb_height; mb_y++)
81
7335
                    mb_type[mb_y * s->mb_stride + mb_x] =
82
7335
                        (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
83
            }
84
        }
85
33
        break;
86
    }
87
88
10185
    for (mb_y = 0; mb_y < s->mb_height; mb_y++)
89
202905
        for (mb_x = 0; mb_x < s->mb_width; mb_x++)
90
193365
            coded_mb_count += !IS_SKIP(mb_type[mb_y * s->mb_stride + mb_x]);
91
92
645
    if (coded_mb_count > get_bits_left(&s->gb))
93
        return AVERROR_INVALIDDATA;
94
95
645
    return 0;
96
}
97
98
5
static int decode_ext_header(Wmv2Context *w)
99
{
100
5
    MpegEncContext *const s = &w->s;
101
    GetBitContext gb;
102
    int fps;
103
    int code;
104
105
5
    if (s->avctx->extradata_size < 4)
106
        return AVERROR_INVALIDDATA;
107
108
5
    init_get_bits(&gb, s->avctx->extradata, 32);
109
110
5
    fps                 = get_bits(&gb, 5);
111
5
    s->bit_rate         = get_bits(&gb, 11) * 1024;
112
5
    w->mspel_bit        = get_bits1(&gb);
113
5
    s->loop_filter      = get_bits1(&gb);
114
5
    w->abt_flag         = get_bits1(&gb);
115
5
    w->j_type_bit       = get_bits1(&gb);
116
5
    w->top_left_mv_flag = get_bits1(&gb);
117
5
    w->per_mb_rl_bit    = get_bits1(&gb);
118
5
    code                = get_bits(&gb, 3);
119
120
5
    if (code == 0)
121
        return AVERROR_INVALIDDATA;
122
123
5
    s->slice_height = s->mb_height / code;
124
125
5
    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
126
        av_log(s->avctx, AV_LOG_DEBUG,
127
               "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
128
               "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
129
               "slices:%d\n",
130
               fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
131
               w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
132
               code);
133
5
    return 0;
134
}
135
136
674
int ff_wmv2_decode_picture_header(MpegEncContext *s)
137
{
138
674
    Wmv2Context *const w = (Wmv2Context *) s;
139
    int code;
140
141
674
    if (s->picture_number == 0)
142
5
        decode_ext_header(w);
143
144
674
    s->pict_type = get_bits1(&s->gb) + 1;
145
674
    if (s->pict_type == AV_PICTURE_TYPE_I) {
146
29
        code = get_bits(&s->gb, 7);
147
29
        av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
148
    }
149
674
    s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
150
674
    if (s->qscale <= 0)
151
        return AVERROR_INVALIDDATA;
152
153

674
    if (s->pict_type != AV_PICTURE_TYPE_I && show_bits(&s->gb, 1)) {
154
387
        GetBitContext gb = s->gb;
155
387
        int skip_type = get_bits(&gb, 2);
156
387
        int run = skip_type == SKIP_TYPE_COL ? s->mb_width : s->mb_height;
157
158
387
        while (run > 0) {
159
387
            int block = FFMIN(run, 25);
160
387
            if (get_bits(&gb, block) + 1 != 1<<block)
161
387
                break;
162
            run -= block;
163
        }
164
387
        if (!run)
165
            return FRAME_SKIPPED;
166
    }
167
168
674
    return 0;
169
}
170
171
674
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
172
{
173
674
    Wmv2Context *const w = (Wmv2Context *) s;
174
175
674
    if (s->pict_type == AV_PICTURE_TYPE_I) {
176
29
        if (w->j_type_bit)
177
29
            w->j_type = get_bits1(&s->gb);
178
        else
179
            w->j_type = 0; // FIXME check
180
181
29
        if (!w->j_type) {
182
26
            if (w->per_mb_rl_bit)
183
26
                s->per_mb_rl_table = get_bits1(&s->gb);
184
            else
185
                s->per_mb_rl_table = 0;
186
187
26
            if (!s->per_mb_rl_table) {
188
26
                s->rl_chroma_table_index = decode012(&s->gb);
189
26
                s->rl_table_index        = decode012(&s->gb);
190
            }
191
192
26
            s->dc_table_index = get_bits1(&s->gb);
193
194
            // at minimum one bit per macroblock is required at least in a valid frame,
195
            // we discard frames much smaller than this. Frames smaller than 1/8 of the
196
            // smallest "black/skip" frame generally contain not much recoverable content
197
            // while at the same time they have the highest computational requirements
198
            // per byte
199
26
            if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
200
                return AVERROR_INVALIDDATA;
201
        }
202
29
        s->inter_intra_pred = 0;
203
29
        s->no_rounding      = 1;
204
29
        if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
205
            av_log(s->avctx, AV_LOG_DEBUG,
206
                   "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
207
                   s->qscale, s->rl_chroma_table_index, s->rl_table_index,
208
                   s->dc_table_index, s->per_mb_rl_table, w->j_type);
209
        }
210
    } else {
211
        int cbp_index;
212
        int ret;
213
645
        w->j_type = 0;
214
215
645
        ret = parse_mb_skip(w);
216
645
        if (ret < 0)
217
            return ret;
218
645
        cbp_index = decode012(&s->gb);
219
645
        w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
220
221
645
        if (w->mspel_bit)
222
645
            s->mspel = get_bits1(&s->gb);
223
        else
224
            s->mspel = 0; // FIXME check
225
226
645
        if (w->abt_flag) {
227
645
            w->per_mb_abt = get_bits1(&s->gb) ^ 1;
228
645
            if (!w->per_mb_abt)
229
187
                w->abt_type = decode012(&s->gb);
230
        }
231
232
645
        if (w->per_mb_rl_bit)
233
645
            s->per_mb_rl_table = get_bits1(&s->gb);
234
        else
235
            s->per_mb_rl_table = 0;
236
237
645
        if (!s->per_mb_rl_table) {
238
617
            s->rl_table_index        = decode012(&s->gb);
239
617
            s->rl_chroma_table_index = s->rl_table_index;
240
        }
241
242
645
        if (get_bits_left(&s->gb) < 2)
243
            return AVERROR_INVALIDDATA;
244
245
645
        s->dc_table_index   = get_bits1(&s->gb);
246
645
        s->mv_table_index   = get_bits1(&s->gb);
247
248
645
        s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
249
645
        s->no_rounding     ^= 1;
250
251
645
        if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
252
            av_log(s->avctx, AV_LOG_DEBUG,
253
                   "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
254
                   "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
255
                   s->rl_table_index, s->rl_chroma_table_index,
256
                   s->dc_table_index, s->mv_table_index,
257
                   s->per_mb_rl_table, s->qscale, s->mspel,
258
                   w->per_mb_abt, w->abt_type, w->cbp_table_index,
259
                   s->inter_intra_pred);
260
        }
261
    }
262
674
    s->esc3_level_length = 0;
263
674
    s->esc3_run_length   = 0;
264
674
    s->picture_number++; // FIXME ?
265
266
674
    if (w->j_type) {
267
3
        ff_intrax8_decode_picture(&w->x8, &s->current_picture,
268
                                  &s->gb, &s->mb_x, &s->mb_y,
269
3
                                  2 * s->qscale, (s->qscale - 1) | 1,
270
                                  s->loop_filter, s->low_delay);
271
272
3
        ff_er_add_slice(&w->s.er, 0, 0,
273
3
                        (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
274
                        ER_MB_END);
275
3
        return 1;
276
    }
277
278
671
    return 0;
279
}
280
281
118424
static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
282
{
283
118424
    MpegEncContext *const s = &w->s;
284
    int ret;
285
286
118424
    ret = ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
287
288
118424
    if (ret < 0)
289
        return ret;
290
291

118424
    if ((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
292
19528
        w->hshift = get_bits1(&s->gb);
293
    else
294
98896
        w->hshift = 0;
295
296
118424
    return 0;
297
}
298
299
118424
static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
300
{
301
118424
    MpegEncContext *const s = &w->s;
302
    int xy, wrap, diff, type;
303
    int16_t *A, *B, *C, *mot_val;
304
305
118424
    wrap    = s->b8_stride;
306
118424
    xy      = s->block_index[0];
307
308
118424
    mot_val = s->current_picture.motion_val[0][xy];
309
310
118424
    A       = s->current_picture.motion_val[0][xy     - 1];
311
118424
    B       = s->current_picture.motion_val[0][xy     - wrap];
312
118424
    C       = s->current_picture.motion_val[0][xy + 2 - wrap];
313
314


118424
    if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
315
22431
        diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
316
    else
317
95993
        diff = 0;
318
319
118424
    if (diff >= 8)
320
3203
        type = get_bits1(&s->gb);
321
    else
322
115221
        type = 2;
323
324
118424
    if (type == 0) {
325
1698
        *px = A[0];
326
1698
        *py = A[1];
327
116726
    } else if (type == 1) {
328
1505
        *px = B[0];
329
1505
        *py = B[1];
330
    } else {
331
        /* special case for first (slice) line */
332
115221
        if (s->first_slice_line) {
333
4281
            *px = A[0];
334
4281
            *py = A[1];
335
        } else {
336
110940
            *px = mid_pred(A[0], B[0], C[0]);
337
110940
            *py = mid_pred(A[1], B[1], C[1]);
338
        }
339
    }
340
341
118424
    return mot_val;
342
}
343
344
710544
static inline int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block,
345
                                          int n, int cbp)
346
{
347
710544
    MpegEncContext *const s = &w->s;
348
    static const int sub_cbp_table[3] = { 2, 3, 1 };
349
    int sub_cbp, ret;
350
351
710544
    if (!cbp) {
352
529955
        s->block_last_index[n] = -1;
353
529955
        return 0;
354
    }
355
356
180589
    if (w->per_block_abt)
357
20828
        w->abt_type = decode012(&s->gb);
358
180589
    w->abt_type_table[n] = w->abt_type;
359
360
180589
    if (w->abt_type) {
361
//        const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
362
31447
        const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
363
//        const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
364
365
31447
        sub_cbp = sub_cbp_table[decode012(&s->gb)];
366
367
31447
        if (sub_cbp & 1)
368
18950
            if ((ret = ff_msmpeg4_decode_block(s, block, n, 1, scantable)) < 0)
369
                return ret;
370
371
31447
        if (sub_cbp & 2)
372
19090
            if ((ret = ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable)) < 0)
373
                return ret;
374
375
31447
        s->block_last_index[n] = 63;
376
377
31447
        return 0;
378
    } else {
379
149142
        return ff_msmpeg4_decode_block(s, block, n, 1,
380
149142
                                       s->inter_scantable.permutated);
381
    }
382
}
383
384
201150
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
385
{
386
201150
    Wmv2Context *const w = (Wmv2Context *) s;
387
    int cbp, code, i, ret;
388
    uint8_t *coded_val;
389
390
201150
    if (w->j_type)
391
        return 0;
392
393
201150
    if (s->pict_type == AV_PICTURE_TYPE_P) {
394
193365
        if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) {
395
            /* skip mb */
396
71725
            s->mb_intra = 0;
397
502075
            for (i = 0; i < 6; i++)
398
430350
                s->block_last_index[i] = -1;
399
71725
            s->mv_dir      = MV_DIR_FORWARD;
400
71725
            s->mv_type     = MV_TYPE_16X16;
401
71725
            s->mv[0][0][0] = 0;
402
71725
            s->mv[0][0][1] = 0;
403
71725
            s->mb_skipped  = 1;
404
71725
            w->hshift      = 0;
405
71725
            return 0;
406
        }
407
121640
        if (get_bits_left(&s->gb) <= 0)
408
            return AVERROR_INVALIDDATA;
409
410
121640
        code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
411
                        MB_NON_INTRA_VLC_BITS, 3);
412
121640
        if (code < 0)
413
            return AVERROR_INVALIDDATA;
414
121640
        s->mb_intra = (~code & 0x40) >> 6;
415
416
121640
        cbp = code & 0x3f;
417
    } else {
418
7785
        s->mb_intra = 1;
419
7785
        if (get_bits_left(&s->gb) <= 0)
420
            return AVERROR_INVALIDDATA;
421
7785
        code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
422
7785
        if (code < 0) {
423
            av_log(s->avctx, AV_LOG_ERROR,
424
                   "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
425
            return AVERROR_INVALIDDATA;
426
        }
427
        /* predict coded block pattern */
428
7785
        cbp = 0;
429
54495
        for (i = 0; i < 6; i++) {
430
46710
            int val = ((code >> (5 - i)) & 1);
431
46710
            if (i < 4) {
432
31140
                int pred   = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
433
31140
                val        = val ^ pred;
434
31140
                *coded_val = val;
435
            }
436
46710
            cbp |= val << (5 - i);
437
        }
438
    }
439
440
129425
    if (!s->mb_intra) {
441
        int mx, my;
442
118424
        wmv2_pred_motion(w, &mx, &my);
443
444
118424
        if (cbp) {
445
76773
            s->bdsp.clear_blocks(s->block[0]);
446
76773
            if (s->per_mb_rl_table) {
447
1656
                s->rl_table_index        = decode012(&s->gb);
448
1656
                s->rl_chroma_table_index = s->rl_table_index;
449
            }
450
451

76773
            if (w->abt_flag && w->per_mb_abt) {
452
37493
                w->per_block_abt = get_bits1(&s->gb);
453
37493
                if (!w->per_block_abt)
454
30618
                    w->abt_type = decode012(&s->gb);
455
            } else
456
39280
                w->per_block_abt = 0;
457
        }
458
459
118424
        if ((ret = wmv2_decode_motion(w, &mx, &my)) < 0)
460
            return ret;
461
462
118424
        s->mv_dir      = MV_DIR_FORWARD;
463
118424
        s->mv_type     = MV_TYPE_16X16;
464
118424
        s->mv[0][0][0] = mx;
465
118424
        s->mv[0][0][1] = my;
466
467
828968
        for (i = 0; i < 6; i++) {
468
710544
            if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
469
                av_log(s->avctx, AV_LOG_ERROR,
470
                       "\nerror while decoding inter block: %d x %d (%d)\n",
471
                       s->mb_x, s->mb_y, i);
472
                return ret;
473
            }
474
        }
475
    } else {
476
11001
        if (s->pict_type == AV_PICTURE_TYPE_P)
477
            ff_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
478
        ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
479
                ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
480
                show_bits(&s->gb, 24));
481
11001
        s->ac_pred = get_bits1(&s->gb);
482
11001
        if (s->inter_intra_pred) {
483
            s->h263_aic_dir = get_vlc2(&s->gb, ff_inter_intra_vlc.table,
484
                                       INTER_INTRA_VLC_BITS, 1);
485
            ff_dlog(s->avctx, "%d%d %d %d/",
486
                    s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
487
        }
488

11001
        if (s->per_mb_rl_table && cbp) {
489
128
            s->rl_table_index        = decode012(&s->gb);
490
128
            s->rl_chroma_table_index = s->rl_table_index;
491
        }
492
493
11001
        s->bdsp.clear_blocks(s->block[0]);
494
77007
        for (i = 0; i < 6; i++) {
495
66006
            if ((ret = ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL)) < 0) {
496
                av_log(s->avctx, AV_LOG_ERROR,
497
                       "\nerror while decoding intra block: %d x %d (%d)\n",
498
                       s->mb_x, s->mb_y, i);
499
                return ret;
500
            }
501
        }
502
    }
503
504
129425
    return 0;
505
}
506
507
12
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
508
{
509
12
    Wmv2Context *const w = avctx->priv_data;
510
    int ret;
511
512
12
    if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
513
        return ret;
514
515
12
    ff_wmv2_common_init(w);
516
517
12
    return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
518
12
                                  w->s.block, w->s.block_last_index,
519
                                  w->s.mb_width, w->s.mb_height);
520
}
521
522
12
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
523
{
524
12
    Wmv2Context *w = avctx->priv_data;
525
526
12
    ff_intrax8_common_end(&w->x8);
527
12
    return ff_h263_decode_end(avctx);
528
}
529
530
AVCodec ff_wmv2_decoder = {
531
    .name           = "wmv2",
532
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
533
    .type           = AVMEDIA_TYPE_VIDEO,
534
    .id             = AV_CODEC_ID_WMV2,
535
    .priv_data_size = sizeof(Wmv2Context),
536
    .init           = wmv2_decode_init,
537
    .close          = wmv2_decode_end,
538
    .decode         = ff_h263_decode_frame,
539
    .capabilities   = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
540
    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
541
    .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
542
                                                     AV_PIX_FMT_NONE },
543
};