../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
15 / 15
100.0%
Branches:
5 / 6
83.3%
Functions:
1 / 1
100.0%

libavcodec/cavs_aec.c
Line Branch Exec Source
1 /*
2 * Chinese AVS video (AVS1-P16, Broadcasting profile) AEC decoder.
3 * Copyright (c) 2026 Rainbaby <r@bgr.jp>
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 /**
23 * @file
24 * Chinese AVS video (AVS1-P16, Broadcasting profile) AEC decoder
25 *
26 * Clause numbers refer to GY/T 257.1-2012. The renormalization loops end
27 * with the buffer, so truncated input terminates. The caller must have
28 * removed the annex A pseudo start codes from the payload.
29 */
30
31 #include <stdint.h>
32
33 #include "cavs_aec.h"
34 #include "get_bits.h"
35
36 10 void ff_cavs_aec_init(CAVSAECContext *aec, GetBitContext *gb)
37 {
38
2/2
✓ Branch 4 → 3 taken 3230 times.
✓ Branch 4 → 5 taken 10 times.
3240 for (int i = 0; i < CAVS_AEC_NUM_CTX; i++) {
39 3230 aec->ctx[i].mps = 0;
40 3230 aec->ctx[i].cycno = 0;
41 3230 aec->ctx[i].lg_pmps = CAVS_AEC_LGPMPS_INIT;
42 }
43
44 10 aec->gb = gb;
45 10 aec->rs1 = 0;
46 10 aec->rt1 = CAVS_AEC_RT1_INIT;
47 10 aec->vs = 0;
48 10 aec->vt = get_bits(gb, 9);
49
3/4
✓ Branch 9 → 10 taken 17 times.
✓ Branch 9 → 12 taken 10 times.
✓ Branch 11 → 7 taken 17 times.
✗ Branch 11 → 12 not taken.
27 while (!((aec->vt >> 8) & 0x01) && get_bits_left(gb) > 0) {
50 17 aec->vt = (aec->vt << 1) | get_bits1(gb);
51 17 aec->vs++;
52 }
53 10 aec->vt &= 0xFF;
54 10 }
55