| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. | ||
| 3 | * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> | ||
| 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-P2, JiZhun profile) decoder | ||
| 25 | * @author Stefan Gehrer <stefan.gehrer@gmx.de> | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include "libavutil/attributes.h" | ||
| 29 | #include "libavutil/avassert.h" | ||
| 30 | #include "libavutil/emms.h" | ||
| 31 | #include "libavutil/mem.h" | ||
| 32 | #include "avcodec.h" | ||
| 33 | #include "get_bits.h" | ||
| 34 | #include "golomb.h" | ||
| 35 | #include "cavs.h" | ||
| 36 | #include "codec_internal.h" | ||
| 37 | #include "decode.h" | ||
| 38 | #include "mathops.h" | ||
| 39 | #include "mpeg12data.h" | ||
| 40 | #include "startcode.h" | ||
| 41 | |||
| 42 | static const uint8_t mv_scan[4] = { | ||
| 43 | MV_FWD_X0, MV_FWD_X1, | ||
| 44 | MV_FWD_X2, MV_FWD_X3 | ||
| 45 | }; | ||
| 46 | |||
| 47 | static const uint8_t cbp_tab[64][2] = { | ||
| 48 | { 63, 0 }, { 15, 15 }, { 31, 63 }, { 47, 31 }, { 0, 16 }, { 14, 32 }, { 13, 47 }, { 11, 13 }, | ||
| 49 | { 7, 14 }, { 5, 11 }, { 10, 12 }, { 8, 5 }, { 12, 10 }, { 61, 7 }, { 4, 48 }, { 55, 3 }, | ||
| 50 | { 1, 2 }, { 2, 8 }, { 59, 4 }, { 3, 1 }, { 62, 61 }, { 9, 55 }, { 6, 59 }, { 29, 62 }, | ||
| 51 | { 45, 29 }, { 51, 27 }, { 23, 23 }, { 39, 19 }, { 27, 30 }, { 46, 28 }, { 53, 9 }, { 30, 6 }, | ||
| 52 | { 43, 60 }, { 37, 21 }, { 60, 44 }, { 16, 26 }, { 21, 51 }, { 28, 35 }, { 19, 18 }, { 35, 20 }, | ||
| 53 | { 42, 24 }, { 26, 53 }, { 44, 17 }, { 32, 37 }, { 58, 39 }, { 24, 45 }, { 20, 58 }, { 17, 43 }, | ||
| 54 | { 18, 42 }, { 48, 46 }, { 22, 36 }, { 33, 33 }, { 25, 34 }, { 49, 40 }, { 40, 52 }, { 36, 49 }, | ||
| 55 | { 34, 50 }, { 50, 56 }, { 52, 25 }, { 54, 22 }, { 41, 54 }, { 56, 57 }, { 38, 41 }, { 57, 38 } | ||
| 56 | }; | ||
| 57 | |||
| 58 | static const uint8_t scan3x3[4] = { 4, 5, 7, 8 }; | ||
| 59 | |||
| 60 | static const uint8_t dequant_shift[64] = { | ||
| 61 | 14, 14, 14, 14, 14, 14, 14, 14, | ||
| 62 | 13, 13, 13, 13, 13, 13, 13, 13, | ||
| 63 | 13, 12, 12, 12, 12, 12, 12, 12, | ||
| 64 | 11, 11, 11, 11, 11, 11, 11, 11, | ||
| 65 | 11, 10, 10, 10, 10, 10, 10, 10, | ||
| 66 | 10, 9, 9, 9, 9, 9, 9, 9, | ||
| 67 | 9, 8, 8, 8, 8, 8, 8, 8, | ||
| 68 | 7, 7, 7, 7, 7, 7, 7, 7 | ||
| 69 | }; | ||
| 70 | |||
| 71 | static const uint16_t dequant_mul[64] = { | ||
| 72 | 32768, 36061, 38968, 42495, 46341, 50535, 55437, 60424, | ||
| 73 | 32932, 35734, 38968, 42495, 46177, 50535, 55109, 59933, | ||
| 74 | 65535, 35734, 38968, 42577, 46341, 50617, 55027, 60097, | ||
| 75 | 32809, 35734, 38968, 42454, 46382, 50576, 55109, 60056, | ||
| 76 | 65535, 35734, 38968, 42495, 46320, 50515, 55109, 60076, | ||
| 77 | 65535, 35744, 38968, 42495, 46341, 50535, 55099, 60087, | ||
| 78 | 65535, 35734, 38973, 42500, 46341, 50535, 55109, 60097, | ||
| 79 | 32771, 35734, 38965, 42497, 46341, 50535, 55109, 60099 | ||
| 80 | }; | ||
| 81 | |||
| 82 | #define EOB 0, 0, 0 | ||
| 83 | |||
| 84 | static const struct dec_2dvlc intra_dec[7] = { | ||
| 85 | { | ||
| 86 | { //level / run / table_inc | ||
| 87 | { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 }, | ||
| 88 | { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 }, | ||
| 89 | { 1, 7, 1 }, { -1, 7, 1 }, { 1, 8, 1 }, { -1, 8, 1 }, { 1, 9, 1 }, { -1, 9, 1 }, | ||
| 90 | { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 }, { 2, 1, 2 }, { -2, 1, 2 }, | ||
| 91 | { 1, 12, 1 }, { -1, 12, 1 }, { 1, 13, 1 }, { -1, 13, 1 }, { 1, 14, 1 }, { -1, 14, 1 }, | ||
| 92 | { 1, 15, 1 }, { -1, 15, 1 }, { 2, 2, 2 }, { -2, 2, 2 }, { 1, 16, 1 }, { -1, 16, 1 }, | ||
| 93 | { 1, 17, 1 }, { -1, 17, 1 }, { 3, 1, 3 }, { -3, 1, 3 }, { 1, 18, 1 }, { -1, 18, 1 }, | ||
| 94 | { 1, 19, 1 }, { -1, 19, 1 }, { 2, 3, 2 }, { -2, 3, 2 }, { 1, 20, 1 }, { -1, 20, 1 }, | ||
| 95 | { 1, 21, 1 }, { -1, 21, 1 }, { 2, 4, 2 }, { -2, 4, 2 }, { 1, 22, 1 }, { -1, 22, 1 }, | ||
| 96 | { 2, 5, 2 }, { -2, 5, 2 }, { 1, 23, 1 }, { -1, 23, 1 }, { EOB } | ||
| 97 | }, | ||
| 98 | //level_add | ||
| 99 | { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1 }, | ||
| 100 | 2, //golomb_order | ||
| 101 | 0, //inc_limit | ||
| 102 | 23, //max_run | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | { //level / run | ||
| 106 | { 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 }, { -2, 1, 1 }, | ||
| 107 | { 1, 3, 0 }, { -1, 3, 0 }, { EOB }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 }, | ||
| 108 | { -1, 5, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 3, 1, 2 }, { -3, 1, 2 }, { 2, 2, 1 }, | ||
| 109 | { -2, 2, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 1, 9, 0 }, | ||
| 110 | { -1, 9, 0 }, { 2, 3, 1 }, { -2, 3, 1 }, { 4, 1, 2 }, { -4, 1, 2 }, { 1, 10, 0 }, | ||
| 111 | { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 2, 4, 1 }, { -2, 4, 1 }, { 3, 2, 2 }, | ||
| 112 | { -3, 2, 2 }, { 1, 12, 0 }, { -1, 12, 0 }, { 2, 5, 1 }, { -2, 5, 1 }, { 5, 1, 3 }, | ||
| 113 | { -5, 1, 3 }, { 1, 13, 0 }, { -1, 13, 0 }, { 2, 6, 1 }, { -2, 6, 1 }, { 1, 14, 0 }, | ||
| 114 | { -1, 14, 0 }, { 2, 7, 1 }, { -2, 7, 1 }, { 2, 8, 1 }, { -2, 8, 1 }, { 3, 3, 2 }, | ||
| 115 | { -3, 3, 2 }, { 6, 1, 3 }, { -6, 1, 3 }, { 1, 15, 0 }, { -1, 15, 0 } | ||
| 116 | }, | ||
| 117 | //level_add | ||
| 118 | { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 119 | 2, //golomb_order | ||
| 120 | 1, //inc_limit | ||
| 121 | 15, //max_run | ||
| 122 | }, | ||
| 123 | { | ||
| 124 | { //level / run | ||
| 125 | { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, | ||
| 126 | { 3, 1, 1 }, { -3, 1, 1 }, { EOB }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 }, | ||
| 127 | { -2, 2, 0 }, { 4, 1, 1 }, { -4, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 2 }, | ||
| 128 | { -5, 1, 2 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 3, 0 }, | ||
| 129 | { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 2 }, { -6, 1, 2 }, { 2, 4, 0 }, | ||
| 130 | { -2, 4, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 7, 1, 2 }, | ||
| 131 | { -7, 1, 2 }, { 3, 3, 1 }, { -3, 3, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 8, 0 }, | ||
| 132 | { -1, 8, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 8, 1, 3 }, { -8, 1, 3 }, { 1, 9, 0 }, | ||
| 133 | { -1, 9, 0 }, { 5, 2, 2 }, { -5, 2, 2 }, { 3, 4, 1 }, { -3, 4, 1 }, { 2, 7, 0 }, | ||
| 134 | { -2, 7, 0 }, { 9, 1, 3 }, { -9, 1, 3 }, { 1, 10, 0 }, { -1, 10, 0 } | ||
| 135 | }, | ||
| 136 | //level_add | ||
| 137 | { 0, 10, 6, 4, 4, 3, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 138 | 2, //golomb_order | ||
| 139 | 2, //inc_limit | ||
| 140 | 10, //max_run | ||
| 141 | }, | ||
| 142 | { | ||
| 143 | { //level / run | ||
| 144 | { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 }, | ||
| 145 | { 1, 2, 0 }, { -1, 2, 0 }, { EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 1 }, | ||
| 146 | { -5, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 6, 1, 1 }, | ||
| 147 | { -6, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 1, 4, 0 }, | ||
| 148 | { -1, 4, 0 }, { 8, 1, 2 }, { -8, 1, 2 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 2, 0 }, | ||
| 149 | { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 9, 1, 2 }, { -9, 1, 2 }, { 5, 2, 1 }, | ||
| 150 | { -5, 2, 1 }, { 2, 4, 0 }, { -2, 4, 0 }, { 10, 1, 2 }, {-10, 1, 2 }, { 3, 3, 0 }, | ||
| 151 | { -3, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 11, 1, 3 }, {-11, 1, 3 }, { 6, 2, 1 }, | ||
| 152 | { -6, 2, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 2, 5, 0 }, { -2, 5, 0 }, { 3, 4, 0 }, | ||
| 153 | { -3, 4, 0 }, { 12, 1, 3 }, {-12, 1, 3 }, { 4, 3, 0 }, { -4, 3, 0 } | ||
| 154 | }, | ||
| 155 | //level_add | ||
| 156 | { 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 157 | 2, //golomb_order | ||
| 158 | 4, //inc_limit | ||
| 159 | 7, //max_run | ||
| 160 | }, | ||
| 161 | { | ||
| 162 | { //level / run | ||
| 163 | { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 }, | ||
| 164 | { EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 }, | ||
| 165 | { -6, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 1 }, | ||
| 166 | { -8, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 9, 1, 1 }, { -9, 1, 1 }, { 10, 1, 1 }, | ||
| 167 | {-10, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 11, 1, 2 }, | ||
| 168 | {-11, 1, 2 }, { 4, 2, 0 }, { -4, 2, 0 }, { 12, 1, 2 }, {-12, 1, 2 }, { 13, 1, 2 }, | ||
| 169 | {-13, 1, 2 }, { 5, 2, 0 }, { -5, 2, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 2, 3, 0 }, | ||
| 170 | { -2, 3, 0 }, { 14, 1, 2 }, {-14, 1, 2 }, { 6, 2, 0 }, { -6, 2, 0 }, { 15, 1, 2 }, | ||
| 171 | {-15, 1, 2 }, { 16, 1, 2 }, {-16, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 1, 5, 0 }, | ||
| 172 | { -1, 5, 0 }, { 7, 2, 0 }, { -7, 2, 0 }, { 17, 1, 2 }, {-17, 1, 2 } | ||
| 173 | }, | ||
| 174 | //level_add | ||
| 175 | { 0,18, 8, 4, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 176 | 2, //golomb_order | ||
| 177 | 7, //inc_limit | ||
| 178 | 5, //max_run | ||
| 179 | }, | ||
| 180 | { | ||
| 181 | { //level / run | ||
| 182 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 183 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 }, | ||
| 184 | { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 9, 1, 0 }, | ||
| 185 | { -9, 1, 0 }, { 10, 1, 0 }, {-10, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 11, 1, 1 }, | ||
| 186 | {-11, 1, 1 }, { 12, 1, 1 }, {-12, 1, 1 }, { 13, 1, 1 }, {-13, 1, 1 }, { 2, 2, 0 }, | ||
| 187 | { -2, 2, 0 }, { 14, 1, 1 }, {-14, 1, 1 }, { 15, 1, 1 }, {-15, 1, 1 }, { 3, 2, 0 }, | ||
| 188 | { -3, 2, 0 }, { 16, 1, 1 }, {-16, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 17, 1, 1 }, | ||
| 189 | {-17, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 18, 1, 1 }, {-18, 1, 1 }, { 5, 2, 0 }, | ||
| 190 | { -5, 2, 0 }, { 19, 1, 1 }, {-19, 1, 1 }, { 20, 1, 1 }, {-20, 1, 1 }, { 6, 2, 0 }, | ||
| 191 | { -6, 2, 0 }, { 21, 1, 1 }, {-21, 1, 1 }, { 2, 3, 0 }, { -2, 3, 0 } | ||
| 192 | }, | ||
| 193 | //level_add | ||
| 194 | { 0, 22, 7, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 195 | 2, //golomb_order | ||
| 196 | 10, //inc_limit | ||
| 197 | 3, //max_run | ||
| 198 | }, | ||
| 199 | { | ||
| 200 | { //level / run | ||
| 201 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 202 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 }, | ||
| 203 | { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 9, 1, 0 }, | ||
| 204 | { -9, 1, 0 }, { 10, 1, 0 }, {-10, 1, 0 }, { 11, 1, 0 }, {-11, 1, 0 }, { 12, 1, 0 }, | ||
| 205 | {-12, 1, 0 }, { 13, 1, 0 }, {-13, 1, 0 }, { 14, 1, 0 }, {-14, 1, 0 }, { 15, 1, 0 }, | ||
| 206 | {-15, 1, 0 }, { 16, 1, 0 }, {-16, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 17, 1, 0 }, | ||
| 207 | {-17, 1, 0 }, { 18, 1, 0 }, {-18, 1, 0 }, { 19, 1, 0 }, {-19, 1, 0 }, { 20, 1, 0 }, | ||
| 208 | {-20, 1, 0 }, { 21, 1, 0 }, {-21, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 22, 1, 0 }, | ||
| 209 | {-22, 1, 0 }, { 23, 1, 0 }, {-23, 1, 0 }, { 24, 1, 0 }, {-24, 1, 0 }, { 25, 1, 0 }, | ||
| 210 | {-25, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 26, 1, 0 }, {-26, 1, 0 } | ||
| 211 | }, | ||
| 212 | //level_add | ||
| 213 | { 0, 27, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 214 | 2, //golomb_order | ||
| 215 | INT_MAX, //inc_limit | ||
| 216 | 2, //max_run | ||
| 217 | } | ||
| 218 | }; | ||
| 219 | |||
| 220 | static const struct dec_2dvlc inter_dec[7] = { | ||
| 221 | { | ||
| 222 | { //level / run | ||
| 223 | { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 }, | ||
| 224 | { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 }, | ||
| 225 | { 1, 7, 1 }, { -1, 7, 1 }, { 1, 8, 1 }, { -1, 8, 1 }, { 1, 9, 1 }, { -1, 9, 1 }, | ||
| 226 | { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 }, { 1, 12, 1 }, { -1, 12, 1 }, | ||
| 227 | { 1, 13, 1 }, { -1, 13, 1 }, { 2, 1, 2 }, { -2, 1, 2 }, { 1, 14, 1 }, { -1, 14, 1 }, | ||
| 228 | { 1, 15, 1 }, { -1, 15, 1 }, { 1, 16, 1 }, { -1, 16, 1 }, { 1, 17, 1 }, { -1, 17, 1 }, | ||
| 229 | { 1, 18, 1 }, { -1, 18, 1 }, { 1, 19, 1 }, { -1, 19, 1 }, { 3, 1, 3 }, { -3, 1, 3 }, | ||
| 230 | { 1, 20, 1 }, { -1, 20, 1 }, { 1, 21, 1 }, { -1, 21, 1 }, { 2, 2, 2 }, { -2, 2, 2 }, | ||
| 231 | { 1, 22, 1 }, { -1, 22, 1 }, { 1, 23, 1 }, { -1, 23, 1 }, { 1, 24, 1 }, { -1, 24, 1 }, | ||
| 232 | { 1, 25, 1 }, { -1, 25, 1 }, { 1, 26, 1 }, { -1, 26, 1 }, { EOB } | ||
| 233 | }, | ||
| 234 | //level_add | ||
| 235 | { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, | ||
| 236 | 3, //golomb_order | ||
| 237 | 0, //inc_limit | ||
| 238 | 26 //max_run | ||
| 239 | }, | ||
| 240 | { | ||
| 241 | { //level / run | ||
| 242 | { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 1, 3, 0 }, | ||
| 243 | { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 1, 6, 0 }, | ||
| 244 | { -1, 6, 0 }, { 2, 1, 1 }, { -2, 1, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 1, 8, 0 }, | ||
| 245 | { -1, 8, 0 }, { 1, 9, 0 }, { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 2, 2, 1 }, | ||
| 246 | { -2, 2, 1 }, { 1, 11, 0 }, { -1, 11, 0 }, { 1, 12, 0 }, { -1, 12, 0 }, { 3, 1, 2 }, | ||
| 247 | { -3, 1, 2 }, { 1, 13, 0 }, { -1, 13, 0 }, { 1, 14, 0 }, { -1, 14, 0 }, { 2, 3, 1 }, | ||
| 248 | { -2, 3, 1 }, { 1, 15, 0 }, { -1, 15, 0 }, { 2, 4, 1 }, { -2, 4, 1 }, { 1, 16, 0 }, | ||
| 249 | { -1, 16, 0 }, { 2, 5, 1 }, { -2, 5, 1 }, { 1, 17, 0 }, { -1, 17, 0 }, { 4, 1, 3 }, | ||
| 250 | { -4, 1, 3 }, { 2, 6, 1 }, { -2, 6, 1 }, { 1, 18, 0 }, { -1, 18, 0 }, { 1, 19, 0 }, | ||
| 251 | { -1, 19, 0 }, { 2, 7, 1 }, { -2, 7, 1 }, { 3, 2, 2 }, { -3, 2, 2 } | ||
| 252 | }, | ||
| 253 | //level_add | ||
| 254 | { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 255 | 2, //golomb_order | ||
| 256 | 1, //inc_limit | ||
| 257 | 19 //max_run | ||
| 258 | }, | ||
| 259 | { | ||
| 260 | { //level / run | ||
| 261 | { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 0 }, | ||
| 262 | { -2, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 3, 1, 1 }, | ||
| 263 | { -3, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 1, 6, 0 }, | ||
| 264 | { -1, 6, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 1, 2 }, | ||
| 265 | { -4, 1, 2 }, { 1, 8, 0 }, { -1, 8, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 4, 0 }, | ||
| 266 | { -2, 4, 0 }, { 1, 9, 0 }, { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 5, 1, 2 }, | ||
| 267 | { -5, 1, 2 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 2, 6, 0 }, | ||
| 268 | { -2, 6, 0 }, { 1, 12, 0 }, { -1, 12, 0 }, { 3, 3, 1 }, { -3, 3, 1 }, { 6, 1, 2 }, | ||
| 269 | { -6, 1, 2 }, { 4, 2, 2 }, { -4, 2, 2 }, { 1, 13, 0 }, { -1, 13, 0 }, { 2, 7, 0 }, | ||
| 270 | { -2, 7, 0 }, { 3, 4, 1 }, { -3, 4, 1 }, { 1, 14, 0 }, { -1, 14, 0 } | ||
| 271 | }, | ||
| 272 | //level_add | ||
| 273 | { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 274 | 2, //golomb_order | ||
| 275 | 2, //inc_limit | ||
| 276 | 14 //max_run | ||
| 277 | }, | ||
| 278 | { | ||
| 279 | { //level / run | ||
| 280 | { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 }, | ||
| 281 | { -1, 2, 0 }, { 3, 1, 0 }, { -3, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 }, | ||
| 282 | { -2, 2, 0 }, { 4, 1, 1 }, { -4, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 1 }, | ||
| 283 | { -5, 1, 1 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 2, 3, 0 }, | ||
| 284 | { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 1 }, { -6, 1, 1 }, { 2, 4, 0 }, | ||
| 285 | { -2, 4, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 7, 1, 2 }, | ||
| 286 | { -7, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 2, 5, 0 }, | ||
| 287 | { -2, 5, 0 }, { 8, 1, 2 }, { -8, 1, 2 }, { 1, 9, 0 }, { -1, 9, 0 }, { 3, 4, 0 }, | ||
| 288 | { -3, 4, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 5, 2, 1 }, { -5, 2, 1 }, { 1, 10, 0 }, | ||
| 289 | { -1, 10, 0 }, { 9, 1, 2 }, { -9, 1, 2 }, { 4, 3, 1 }, { -4, 3, 1 } | ||
| 290 | }, | ||
| 291 | //level_add | ||
| 292 | { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 293 | 2, //golomb_order | ||
| 294 | 3, //inc_limit | ||
| 295 | 10 //max_run | ||
| 296 | }, | ||
| 297 | { | ||
| 298 | { //level / run | ||
| 299 | { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 300 | { -3, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, | ||
| 301 | { -5, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 6, 1, 0 }, | ||
| 302 | { -6, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 1, 4, 0 }, | ||
| 303 | { -1, 4, 0 }, { 8, 1, 1 }, { -8, 1, 1 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 2, 0 }, | ||
| 304 | { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 9, 1, 1 }, { -9, 1, 1 }, { 5, 2, 0 }, | ||
| 305 | { -5, 2, 0 }, { 2, 4, 0 }, { -2, 4, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 10, 1, 2 }, | ||
| 306 | {-10, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 11, 1, 2 }, {-11, 1, 2 }, { 1, 7, 0 }, | ||
| 307 | { -1, 7, 0 }, { 6, 2, 0 }, { -6, 2, 0 }, { 3, 4, 0 }, { -3, 4, 0 }, { 2, 5, 0 }, | ||
| 308 | { -2, 5, 0 }, { 12, 1, 2 }, {-12, 1, 2 }, { 4, 3, 0 }, { -4, 3, 0 } | ||
| 309 | }, | ||
| 310 | //level_add | ||
| 311 | { 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 312 | 2, //golomb_order | ||
| 313 | 6, //inc_limit | ||
| 314 | 7 //max_run | ||
| 315 | }, | ||
| 316 | { | ||
| 317 | { //level / run | ||
| 318 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 319 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 1, 2, 0 }, | ||
| 320 | { -1, 2, 0 }, { 6, 1, 0 }, { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, | ||
| 321 | { -8, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 1, 3, 0 }, | ||
| 322 | { -1, 3, 0 }, { 10, 1, 1 }, { -10, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 11, 1, 1 }, | ||
| 323 | { -11, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 12, 1, 1 }, { -12, 1, 1 }, { 1, 4, 0 }, | ||
| 324 | { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 13, 1, 1 }, { -13, 1, 1 }, { 5, 2, 0 }, | ||
| 325 | { -5, 2, 0 }, { 14, 1, 1 }, { -14, 1, 1 }, { 6, 2, 0 }, { -6, 2, 0 }, { 1, 5, 0 }, | ||
| 326 | { -1, 5, 0 }, { 15, 1, 1 }, { -15, 1, 1 }, { 3, 3, 0 }, { -3, 3, 0 }, { 16, 1, 1 }, | ||
| 327 | { -16, 1, 1 }, { 2, 4, 0 }, { -2, 4, 0 }, { 7, 2, 0 }, { -7, 2, 0 } | ||
| 328 | }, | ||
| 329 | //level_add | ||
| 330 | { 0, 17, 8, 4, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 331 | 2, //golomb_order | ||
| 332 | 9, //inc_limit | ||
| 333 | 5 //max_run | ||
| 334 | }, | ||
| 335 | { | ||
| 336 | { //level / run | ||
| 337 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 338 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 }, | ||
| 339 | { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 8, 1, 0 }, | ||
| 340 | { -8, 1, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 10, 1, 0 }, { -10, 1, 0 }, { 11, 1, 0 }, | ||
| 341 | { -11, 1, 0 }, { 12, 1, 0 }, { -12, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 13, 1, 0 }, | ||
| 342 | { -13, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 14, 1, 0 }, { -14, 1, 0 }, { 15, 1, 0 }, | ||
| 343 | { -15, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 16, 1, 0 }, { -16, 1, 0 }, { 17, 1, 0 }, | ||
| 344 | { -17, 1, 0 }, { 18, 1, 0 }, { -18, 1, 0 }, { 4, 2, 0 }, { -4, 2, 0 }, { 19, 1, 0 }, | ||
| 345 | { -19, 1, 0 }, { 20, 1, 0 }, { -20, 1, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 1, 4, 0 }, | ||
| 346 | { -1, 4, 0 }, { 5, 2, 0 }, { -5, 2, 0 }, { 21, 1, 0 }, { -21, 1, 0 } | ||
| 347 | }, | ||
| 348 | //level_add | ||
| 349 | { 0, 22, 6, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 350 | 2, //golomb_order | ||
| 351 | INT_MAX, //inc_limit | ||
| 352 | 4 //max_run | ||
| 353 | } | ||
| 354 | }; | ||
| 355 | |||
| 356 | static const struct dec_2dvlc chroma_dec[5] = { | ||
| 357 | { | ||
| 358 | { //level / run | ||
| 359 | { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 }, | ||
| 360 | { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 }, | ||
| 361 | { 1, 7, 1 }, { -1, 7, 1 }, { 2, 1, 2 }, { -2, 1, 2 }, { 1, 8, 1 }, { -1, 8, 1 }, | ||
| 362 | { 1, 9, 1 }, { -1, 9, 1 }, { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 }, | ||
| 363 | { 1, 12, 1 }, { -1, 12, 1 }, { 1, 13, 1 }, { -1, 13, 1 }, { 1, 14, 1 }, { -1, 14, 1 }, | ||
| 364 | { 1, 15, 1 }, { -1, 15, 1 }, { 3, 1, 3 }, { -3, 1, 3 }, { 1, 16, 1 }, { -1, 16, 1 }, | ||
| 365 | { 1, 17, 1 }, { -1, 17, 1 }, { 1, 18, 1 }, { -1, 18, 1 }, { 1, 19, 1 }, { -1, 19, 1 }, | ||
| 366 | { 1, 20, 1 }, { -1, 20, 1 }, { 1, 21, 1 }, { -1, 21, 1 }, { 1, 22, 1 }, { -1, 22, 1 }, | ||
| 367 | { 2, 2, 2 }, { -2, 2, 2 }, { 1, 23, 1 }, { -1, 23, 1 }, { 1, 24, 1 }, { -1, 24, 1 }, | ||
| 368 | { 1, 25, 1 }, { -1, 25, 1 }, { 4, 1, 3 }, { -4, 1, 3 }, { EOB } | ||
| 369 | }, | ||
| 370 | //level_add | ||
| 371 | { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1 }, | ||
| 372 | 2, //golomb_order | ||
| 373 | 0, //inc_limit | ||
| 374 | 25 //max_run | ||
| 375 | }, | ||
| 376 | { | ||
| 377 | { //level / run | ||
| 378 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 }, | ||
| 379 | { -2, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 }, | ||
| 380 | { -1, 5, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 3, 1, 2 }, { -3, 1, 2 }, { 1, 7, 0 }, | ||
| 381 | { -1, 7, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 2, 2, 1 }, { -2, 2, 1 }, { 1, 9, 0 }, | ||
| 382 | { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 4, 1, 2 }, | ||
| 383 | { -4, 1, 2 }, { 1, 12, 0 }, { -1, 12, 0 }, { 1, 13, 0 }, { -1, 13, 0 }, { 1, 14, 0 }, | ||
| 384 | { -1, 14, 0 }, { 2, 3, 1 }, { -2, 3, 1 }, { 1, 15, 0 }, { -1, 15, 0 }, { 2, 4, 1 }, | ||
| 385 | { -2, 4, 1 }, { 5, 1, 3 }, { -5, 1, 3 }, { 3, 2, 2 }, { -3, 2, 2 }, { 1, 16, 0 }, | ||
| 386 | { -1, 16, 0 }, { 1, 17, 0 }, { -1, 17, 0 }, { 1, 18, 0 }, { -1, 18, 0 }, { 2, 5, 1 }, | ||
| 387 | { -2, 5, 1 }, { 1, 19, 0 }, { -1, 19, 0 }, { 1, 20, 0 }, { -1, 20, 0 } | ||
| 388 | }, | ||
| 389 | //level_add | ||
| 390 | { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1 }, | ||
| 391 | 0, //golomb_order | ||
| 392 | 1, //inc_limit | ||
| 393 | 20 //max_run | ||
| 394 | }, | ||
| 395 | { | ||
| 396 | { //level / run | ||
| 397 | { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 }, | ||
| 398 | { -1, 2, 0 }, { 3, 1, 1 }, { -3, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 4, 1, 1 }, | ||
| 399 | { -4, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 2 }, | ||
| 400 | { -5, 1, 2 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 3, 0 }, | ||
| 401 | { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 2 }, { -6, 1, 2 }, { 1, 7, 0 }, | ||
| 402 | { -1, 7, 0 }, { 2, 4, 0 }, { -2, 4, 0 }, { 7, 1, 2 }, { -7, 1, 2 }, { 1, 8, 0 }, | ||
| 403 | { -1, 8, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 1, 9, 0 }, { -1, 9, 0 }, { 3, 3, 1 }, | ||
| 404 | { -3, 3, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 8, 1, 2 }, | ||
| 405 | { -8, 1, 2 }, { 1, 10, 0 }, { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 9, 1, 2 }, | ||
| 406 | { -9, 1, 2 }, { 5, 2, 2 }, { -5, 2, 2 }, { 3, 4, 1 }, { -3, 4, 1 }, | ||
| 407 | }, | ||
| 408 | //level_add | ||
| 409 | { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 410 | 1, //golomb_order | ||
| 411 | 2, //inc_limit | ||
| 412 | 11 //max_run | ||
| 413 | }, | ||
| 414 | { | ||
| 415 | { //level / run | ||
| 416 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 417 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 5, 1, 1 }, | ||
| 418 | { -5, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 6, 1, 1 }, { -6, 1, 1 }, { 1, 3, 0 }, | ||
| 419 | { -1, 3, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 8, 1, 1 }, | ||
| 420 | { -8, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 9, 1, 1 }, | ||
| 421 | { -9, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 10, 1, 1 }, | ||
| 422 | {-10, 1, 1 }, { 3, 3, 0 }, { -3, 3, 0 }, { 5, 2, 1 }, { -5, 2, 1 }, { 2, 4, 0 }, | ||
| 423 | { -2, 4, 0 }, { 11, 1, 1 }, {-11, 1, 1 }, { 1, 6, 0 }, { -1, 6, 0 }, { 12, 1, 1 }, | ||
| 424 | {-12, 1, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 6, 2, 1 }, { -6, 2, 1 }, { 13, 1, 1 }, | ||
| 425 | {-13, 1, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, | ||
| 426 | }, | ||
| 427 | //level_add | ||
| 428 | { 0, 14, 7, 4, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 429 | 1, //golomb_order | ||
| 430 | 4, //inc_limit | ||
| 431 | 8 //max_run | ||
| 432 | }, | ||
| 433 | { | ||
| 434 | { //level / run | ||
| 435 | { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, | ||
| 436 | { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 }, | ||
| 437 | { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 1, 2, 0 }, | ||
| 438 | { -1, 2, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 10, 1, 0 }, { -10, 1, 0 }, { 11, 1, 0 }, | ||
| 439 | { -11, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 12, 1, 0 }, { -12, 1, 0 }, { 13, 1, 0 }, | ||
| 440 | { -13, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 14, 1, 0 }, { -14, 1, 0 }, { 1, 3, 0 }, | ||
| 441 | { -1, 3, 0 }, { 15, 1, 0 }, { -15, 1, 0 }, { 4, 2, 0 }, { -4, 2, 0 }, { 16, 1, 0 }, | ||
| 442 | { -16, 1, 0 }, { 17, 1, 0 }, { -17, 1, 0 }, { 5, 2, 0 }, { -5, 2, 0 }, { 1, 4, 0 }, | ||
| 443 | { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 18, 1, 0 }, { -18, 1, 0 }, { 6, 2, 0 }, | ||
| 444 | { -6, 2, 0 }, { 19, 1, 0 }, { -19, 1, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, | ||
| 445 | }, | ||
| 446 | //level_add | ||
| 447 | { 0, 20, 7, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | ||
| 448 | 0, //golomb_order | ||
| 449 | INT_MAX, //inc_limit | ||
| 450 | 5, //max_run | ||
| 451 | } | ||
| 452 | }; | ||
| 453 | |||
| 454 | #undef EOB | ||
| 455 | |||
| 456 | /***************************************************************************** | ||
| 457 | * | ||
| 458 | * motion vector prediction | ||
| 459 | * | ||
| 460 | ****************************************************************************/ | ||
| 461 | |||
| 462 | 83018 | static inline void store_mvs(AVSContext *h) | |
| 463 | { | ||
| 464 | 83018 | h->col_mv[h->mbidx * 4 + 0] = h->mv[MV_FWD_X0]; | |
| 465 | 83018 | h->col_mv[h->mbidx * 4 + 1] = h->mv[MV_FWD_X1]; | |
| 466 | 83018 | h->col_mv[h->mbidx * 4 + 2] = h->mv[MV_FWD_X2]; | |
| 467 | 83018 | h->col_mv[h->mbidx * 4 + 3] = h->mv[MV_FWD_X3]; | |
| 468 | 83018 | } | |
| 469 | |||
| 470 | 529812 | static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw, | |
| 471 | cavs_vector *col_mv) | ||
| 472 | { | ||
| 473 | 529812 | cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS; | |
| 474 | 529812 | unsigned den = h->direct_den[col_mv->ref]; | |
| 475 | 529812 | int m = FF_SIGNBIT(col_mv->x); | |
| 476 | |||
| 477 | 529812 | pmv_fw->dist = h->dist[1]; | |
| 478 | 529812 | pmv_bw->dist = h->dist[0]; | |
| 479 | 529812 | pmv_fw->ref = 1; | |
| 480 | 529812 | pmv_bw->ref = 0; | |
| 481 | /* scale the co-located motion vector according to its temporal span */ | ||
| 482 | 529812 | pmv_fw->x = (((den + (den * col_mv->x * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m; | |
| 483 | 529812 | pmv_bw->x = m - (((den + (den * col_mv->x * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m); | |
| 484 | 529812 | m = FF_SIGNBIT(col_mv->y); | |
| 485 | 529812 | pmv_fw->y = (((den + (den * col_mv->y * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m; | |
| 486 | 529812 | pmv_bw->y = m - (((den + (den * col_mv->y * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m); | |
| 487 | 529812 | } | |
| 488 | |||
| 489 | 28390 | static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, | |
| 490 | enum cavs_block size) | ||
| 491 | { | ||
| 492 | 28390 | cavs_vector *dst = src + MV_BWD_OFFS; | |
| 493 | |||
| 494 | /* backward mv is the scaled and negated forward mv */ | ||
| 495 | 28390 | dst->x = -((src->x * h->sym_factor + 256) >> 9); | |
| 496 | 28390 | dst->y = -((src->y * h->sym_factor + 256) >> 9); | |
| 497 | 28390 | dst->ref = 0; | |
| 498 | 28390 | dst->dist = h->dist[0]; | |
| 499 | 28390 | set_mvs(dst, size); | |
| 500 | 28390 | } | |
| 501 | |||
| 502 | /***************************************************************************** | ||
| 503 | * | ||
| 504 | * residual data decoding | ||
| 505 | * | ||
| 506 | ****************************************************************************/ | ||
| 507 | |||
| 508 | /** kth-order exponential golomb code */ | ||
| 509 | 2771829 | static inline int get_ue_code(GetBitContext *gb, int order) | |
| 510 | { | ||
| 511 | 2771829 | unsigned ret = get_ue_golomb(gb); | |
| 512 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2771826 times.
|
2771829 | if (ret >= ((1U<<31)>>order)) { |
| 513 | 3 | av_log(NULL, AV_LOG_ERROR, "get_ue_code: value too large\n"); | |
| 514 | 3 | return AVERROR_INVALIDDATA; | |
| 515 | } | ||
| 516 |
2/2✓ Branch 0 taken 2385003 times.
✓ Branch 1 taken 386823 times.
|
2771826 | if (order) { |
| 517 | 2385003 | return (ret<<order) + get_bits(gb, order); | |
| 518 | } | ||
| 519 | 386823 | return ret; | |
| 520 | } | ||
| 521 | |||
| 522 | 351853 | static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf, | |
| 523 | int16_t *dst, int mul, int shift, int coeff_num) | ||
| 524 | { | ||
| 525 | 351853 | int round = 1 << (shift - 1); | |
| 526 | 351853 | int pos = -1; | |
| 527 | 351853 | const uint8_t *scantab = h->permutated_scantable; | |
| 528 | |||
| 529 | /* inverse scan and dequantization */ | ||
| 530 |
2/2✓ Branch 0 taken 2347328 times.
✓ Branch 1 taken 351853 times.
|
2699181 | while (--coeff_num >= 0) { |
| 531 | 2347328 | pos += run_buf[coeff_num]; | |
| 532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2347328 times.
|
2347328 | if (pos > 63) { |
| 533 | ✗ | av_log(h->avctx, AV_LOG_ERROR, | |
| 534 | "position out of block bounds at pic %d MB(%d,%d)\n", | ||
| 535 | h->cur.poc, h->mbx, h->mby); | ||
| 536 | ✗ | return AVERROR_INVALIDDATA; | |
| 537 | } | ||
| 538 | 2347328 | dst[scantab[pos]] = (level_buf[coeff_num] * mul + round) >> shift; | |
| 539 | } | ||
| 540 | 351853 | return 0; | |
| 541 | } | ||
| 542 | |||
| 543 | /** | ||
| 544 | * decode coefficients from one 8x8 block, dequantize, inverse transform | ||
| 545 | * and add them to sample block | ||
| 546 | * @param r pointer to 2D VLC table | ||
| 547 | * @param esc_golomb_order escape codes are k-golomb with this order k | ||
| 548 | * @param qp quantizer | ||
| 549 | * @param dst location of sample block | ||
| 550 | * @param stride line stride in frame buffer | ||
| 551 | */ | ||
| 552 | 351856 | static int decode_residual_block(AVSContext *h, GetBitContext *gb, | |
| 553 | const struct dec_2dvlc *r, int esc_golomb_order, | ||
| 554 | int qp, uint8_t *dst, ptrdiff_t stride) | ||
| 555 | { | ||
| 556 | int i, esc_code, level, mask, ret; | ||
| 557 | unsigned int level_code, run; | ||
| 558 | int16_t level_buf[65]; | ||
| 559 | uint8_t run_buf[65]; | ||
| 560 | 351856 | int16_t *block = h->block; | |
| 561 | |||
| 562 |
1/2✓ Branch 0 taken 2699187 times.
✗ Branch 1 not taken.
|
2699187 | for (i = 0; i < 65; i++) { |
| 563 | 2699187 | level_code = get_ue_code(gb, r->golomb_order); | |
| 564 |
2/2✓ Branch 0 taken 72645 times.
✓ Branch 1 taken 2626542 times.
|
2699187 | if (level_code >= ESCAPE_CODE) { |
| 565 | 72645 | run = ((level_code - ESCAPE_CODE) >> 1) + 1; | |
| 566 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 72642 times.
|
72645 | if(run > 64) { |
| 567 | 3 | av_log(h->avctx, AV_LOG_ERROR, "run %d is too large\n", run); | |
| 568 | 3 | return AVERROR_INVALIDDATA; | |
| 569 | } | ||
| 570 | 72642 | esc_code = get_ue_code(gb, esc_golomb_order); | |
| 571 |
2/4✓ Branch 0 taken 72642 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 72642 times.
|
72642 | if (esc_code < 0 || esc_code > 32767) { |
| 572 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "esc_code invalid\n"); | |
| 573 | ✗ | return AVERROR_INVALIDDATA; | |
| 574 | } | ||
| 575 | |||
| 576 |
2/2✓ Branch 0 taken 38396 times.
✓ Branch 1 taken 34246 times.
|
72642 | level = esc_code + (run > r->max_run ? 1 : r->level_add[run]); |
| 577 |
2/2✓ Branch 0 taken 68905 times.
✓ Branch 1 taken 72642 times.
|
141547 | while (level > r->inc_limit) |
| 578 | 68905 | r++; | |
| 579 | 72642 | mask = -(level_code & 1); | |
| 580 | 72642 | level = (level ^ mask) - mask; | |
| 581 | } else { | ||
| 582 | 2626542 | level = r->rltab[level_code][0]; | |
| 583 |
2/2✓ Branch 0 taken 351853 times.
✓ Branch 1 taken 2274689 times.
|
2626542 | if (!level) //end of block signal |
| 584 | 351853 | break; | |
| 585 | 2274689 | run = r->rltab[level_code][1]; | |
| 586 | 2274689 | r += r->rltab[level_code][2]; | |
| 587 | } | ||
| 588 | 2347331 | level_buf[i] = level; | |
| 589 | 2347331 | run_buf[i] = run; | |
| 590 | } | ||
| 591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 351853 times.
|
351853 | if ((ret = dequant(h, level_buf, run_buf, block, dequant_mul[qp], |
| 592 | 351853 | dequant_shift[qp], i)) < 0) | |
| 593 | ✗ | return ret; | |
| 594 | 351853 | h->cdsp.cavs_idct8_add(dst, block, stride); | |
| 595 | 351853 | h->bdsp.clear_block(block); | |
| 596 | 351853 | return 0; | |
| 597 | } | ||
| 598 | |||
| 599 | |||
| 600 | 167967 | static inline int decode_residual_chroma(AVSContext *h) | |
| 601 | { | ||
| 602 |
2/2✓ Branch 0 taken 62645 times.
✓ Branch 1 taken 105322 times.
|
167967 | if (h->cbp & (1 << 4)) { |
| 603 | 62645 | int ret = decode_residual_block(h, &h->gb, chroma_dec, 0, | |
| 604 | 62645 | ff_cavs_chroma_qp[h->qp], h->cu, h->c_stride); | |
| 605 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 62644 times.
|
62645 | if (ret < 0) |
| 606 | 1 | return ret; | |
| 607 | } | ||
| 608 |
2/2✓ Branch 0 taken 70265 times.
✓ Branch 1 taken 97701 times.
|
167966 | if (h->cbp & (1 << 5)) { |
| 609 | 70265 | int ret = decode_residual_block(h, &h->gb, chroma_dec, 0, | |
| 610 | 70265 | ff_cavs_chroma_qp[h->qp], h->cv, h->c_stride); | |
| 611 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70265 times.
|
70265 | if (ret < 0) |
| 612 | ✗ | return ret; | |
| 613 | } | ||
| 614 | 167966 | return 0; | |
| 615 | } | ||
| 616 | |||
| 617 | 145359 | static inline int decode_residual_inter(AVSContext *h) | |
| 618 | { | ||
| 619 | int block; | ||
| 620 | |||
| 621 | /* get coded block pattern */ | ||
| 622 | 145359 | int cbp = get_ue_golomb(&h->gb); | |
| 623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145359 times.
|
145359 | if (cbp > 63U) { |
| 624 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp %d\n", cbp); | |
| 625 | ✗ | return AVERROR_INVALIDDATA; | |
| 626 | } | ||
| 627 | 145359 | h->cbp = cbp_tab[cbp][1]; | |
| 628 | |||
| 629 | /* get quantizer */ | ||
| 630 |
3/4✓ Branch 0 taken 125734 times.
✓ Branch 1 taken 19625 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 125734 times.
|
145359 | if (h->cbp && !h->qp_fixed) |
| 631 | ✗ | h->qp = (h->qp + (unsigned)get_se_golomb(&h->gb)) & 63; | |
| 632 |
2/2✓ Branch 0 taken 581436 times.
✓ Branch 1 taken 145359 times.
|
726795 | for (block = 0; block < 4; block++) |
| 633 |
2/2✓ Branch 0 taken 182411 times.
✓ Branch 1 taken 399025 times.
|
581436 | if (h->cbp & (1 << block)) |
| 634 | 182411 | decode_residual_block(h, &h->gb, inter_dec, 0, h->qp, | |
| 635 | 182411 | h->cy + h->luma_scan[block], h->l_stride); | |
| 636 | 145359 | decode_residual_chroma(h); | |
| 637 | |||
| 638 | 145359 | return 0; | |
| 639 | } | ||
| 640 | |||
| 641 | /***************************************************************************** | ||
| 642 | * | ||
| 643 | * macroblock level | ||
| 644 | * | ||
| 645 | ****************************************************************************/ | ||
| 646 | |||
| 647 | 22608 | static inline void set_mv_intra(AVSContext *h) | |
| 648 | { | ||
| 649 | 22608 | h->mv[MV_FWD_X0] = ff_cavs_intra_mv; | |
| 650 | 22608 | set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); | |
| 651 | 22608 | h->mv[MV_BWD_X0] = ff_cavs_intra_mv; | |
| 652 | 22608 | set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); | |
| 653 |
2/2✓ Branch 0 taken 19042 times.
✓ Branch 1 taken 3566 times.
|
22608 | if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) |
| 654 | 19042 | h->col_type_base[h->mbidx] = I_8X8; | |
| 655 | 22608 | } | |
| 656 | |||
| 657 | 22608 | static int decode_mb_i(AVSContext *h, int cbp_code) | |
| 658 | { | ||
| 659 | 22608 | GetBitContext *gb = &h->gb; | |
| 660 | unsigned pred_mode_uv; | ||
| 661 | int block; | ||
| 662 | uint8_t top[18]; | ||
| 663 | 22608 | uint8_t *left = NULL; | |
| 664 | uint8_t *d; | ||
| 665 | int ret; | ||
| 666 | |||
| 667 | 22608 | ff_cavs_init_mb(h); | |
| 668 | |||
| 669 | /* get intra prediction modes from stream */ | ||
| 670 |
2/2✓ Branch 0 taken 90432 times.
✓ Branch 1 taken 22608 times.
|
113040 | for (block = 0; block < 4; block++) { |
| 671 | int nA, nB, predpred; | ||
| 672 | 90432 | int pos = scan3x3[block]; | |
| 673 | |||
| 674 | 90432 | nA = h->pred_mode_Y[pos - 1]; | |
| 675 | 90432 | nB = h->pred_mode_Y[pos - 3]; | |
| 676 | 90432 | predpred = FFMIN(nA, nB); | |
| 677 |
2/2✓ Branch 0 taken 1555 times.
✓ Branch 1 taken 88877 times.
|
90432 | if (predpred == NOT_AVAIL) // if either is not available |
| 678 | 1555 | predpred = INTRA_L_LP; | |
| 679 |
2/2✓ Branch 1 taken 16265 times.
✓ Branch 2 taken 74167 times.
|
90432 | if (!get_bits1(gb)) { |
| 680 | 16265 | int rem_mode = get_bits(gb, 2); | |
| 681 | 16265 | predpred = rem_mode + (rem_mode >= predpred); | |
| 682 | } | ||
| 683 | 90432 | h->pred_mode_Y[pos] = predpred; | |
| 684 | } | ||
| 685 | 22608 | pred_mode_uv = get_ue_golomb_31(gb); | |
| 686 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22608 times.
|
22608 | if (pred_mode_uv > 6) { |
| 687 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n"); | |
| 688 | ✗ | return AVERROR_INVALIDDATA; | |
| 689 | } | ||
| 690 | 22608 | ff_cavs_modify_mb_i(h, &pred_mode_uv); | |
| 691 | |||
| 692 | /* get coded block pattern */ | ||
| 693 |
2/2✓ Branch 0 taken 11340 times.
✓ Branch 1 taken 11268 times.
|
22608 | if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) |
| 694 | 11340 | cbp_code = get_ue_golomb(gb); | |
| 695 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22608 times.
|
22608 | if (cbp_code > 63U) { |
| 696 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "illegal intra cbp\n"); | |
| 697 | ✗ | return AVERROR_INVALIDDATA; | |
| 698 | } | ||
| 699 | 22608 | h->cbp = cbp_tab[cbp_code][0]; | |
| 700 |
3/4✓ Branch 0 taken 14306 times.
✓ Branch 1 taken 8302 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14306 times.
|
22608 | if (h->cbp && !h->qp_fixed) |
| 701 | ✗ | h->qp = (h->qp + (unsigned)get_se_golomb(gb)) & 63; //qp_delta | |
| 702 | |||
| 703 | /* luma intra prediction interleaved with residual decode/transform/add */ | ||
| 704 |
2/2✓ Branch 0 taken 90432 times.
✓ Branch 1 taken 22608 times.
|
113040 | for (block = 0; block < 4; block++) { |
| 705 | 90432 | d = h->cy + h->luma_scan[block]; | |
| 706 | 90432 | ff_cavs_load_intra_pred_luma(h, top, &left, block); | |
| 707 | 90432 | h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]] | |
| 708 | (d, top, left, h->l_stride); | ||
| 709 |
2/2✓ Branch 0 taken 36535 times.
✓ Branch 1 taken 53897 times.
|
90432 | if (h->cbp & (1<<block)) { |
| 710 | 36535 | ret = decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride); | |
| 711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36535 times.
|
36535 | if (ret < 0) |
| 712 | ✗ | return ret; | |
| 713 | } | ||
| 714 | } | ||
| 715 | |||
| 716 | /* chroma intra prediction */ | ||
| 717 | 22608 | ff_cavs_load_intra_pred_chroma(h); | |
| 718 | 22608 | h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx * 10], | |
| 719 | 22608 | h->left_border_u, h->c_stride); | |
| 720 | 22608 | h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx * 10], | |
| 721 | 22608 | h->left_border_v, h->c_stride); | |
| 722 | |||
| 723 | 22608 | ret = decode_residual_chroma(h); | |
| 724 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22608 times.
|
22608 | if (ret < 0) |
| 725 | ✗ | return ret; | |
| 726 | 22608 | ff_cavs_filter(h, I_8X8); | |
| 727 | 22608 | set_mv_intra(h); | |
| 728 | 22608 | return 0; | |
| 729 | } | ||
| 730 | |||
| 731 | 275137 | static inline void set_intra_mode_default(AVSContext *h) | |
| 732 | { | ||
| 733 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 275137 times.
|
275137 | if (h->stream_revision > 0) { |
| 734 | ✗ | h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; | |
| 735 | ✗ | h->top_pred_Y[h->mbx * 2 + 0] = h->top_pred_Y[h->mbx * 2 + 1] = NOT_AVAIL; | |
| 736 | } else { | ||
| 737 | 275137 | h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP; | |
| 738 | 275137 | h->top_pred_Y[h->mbx * 2 + 0] = h->top_pred_Y[h->mbx * 2 + 1] = INTRA_L_LP; | |
| 739 | } | ||
| 740 | 275137 | } | |
| 741 | |||
| 742 | 83018 | static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) | |
| 743 | { | ||
| 744 | 83018 | GetBitContext *gb = &h->gb; | |
| 745 | int ref[4]; | ||
| 746 | |||
| 747 | 83018 | ff_cavs_init_mb(h); | |
| 748 |
5/6✓ Branch 0 taken 20801 times.
✓ Branch 1 taken 48877 times.
✓ Branch 2 taken 3399 times.
✓ Branch 3 taken 3154 times.
✓ Branch 4 taken 6787 times.
✗ Branch 5 not taken.
|
83018 | switch (mb_type) { |
| 749 | 20801 | case P_SKIP: | |
| 750 | 20801 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0); | |
| 751 | 20801 | break; | |
| 752 | 48877 | case P_16X16: | |
| 753 |
2/2✓ Branch 0 taken 45007 times.
✓ Branch 1 taken 3870 times.
|
48877 | ref[0] = h->ref_flag ? 0 : get_bits1(gb); |
| 754 | 48877 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, ref[0]); | |
| 755 | 48877 | break; | |
| 756 | 3399 | case P_16X8: | |
| 757 |
2/2✓ Branch 0 taken 3234 times.
✓ Branch 1 taken 165 times.
|
3399 | ref[0] = h->ref_flag ? 0 : get_bits1(gb); |
| 758 |
2/2✓ Branch 0 taken 3234 times.
✓ Branch 1 taken 165 times.
|
3399 | ref[2] = h->ref_flag ? 0 : get_bits1(gb); |
| 759 | 3399 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, ref[0]); | |
| 760 | 3399 | ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, ref[2]); | |
| 761 | 3399 | break; | |
| 762 | 3154 | case P_8X16: | |
| 763 |
2/2✓ Branch 0 taken 2987 times.
✓ Branch 1 taken 167 times.
|
3154 | ref[0] = h->ref_flag ? 0 : get_bits1(gb); |
| 764 |
2/2✓ Branch 0 taken 2987 times.
✓ Branch 1 taken 167 times.
|
3154 | ref[1] = h->ref_flag ? 0 : get_bits1(gb); |
| 765 | 3154 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, ref[0]); | |
| 766 | 3154 | ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, ref[1]); | |
| 767 | 3154 | break; | |
| 768 | 6787 | case P_8X8: | |
| 769 |
2/2✓ Branch 0 taken 6455 times.
✓ Branch 1 taken 332 times.
|
6787 | ref[0] = h->ref_flag ? 0 : get_bits1(gb); |
| 770 |
2/2✓ Branch 0 taken 6455 times.
✓ Branch 1 taken 332 times.
|
6787 | ref[1] = h->ref_flag ? 0 : get_bits1(gb); |
| 771 |
2/2✓ Branch 0 taken 6455 times.
✓ Branch 1 taken 332 times.
|
6787 | ref[2] = h->ref_flag ? 0 : get_bits1(gb); |
| 772 |
2/2✓ Branch 0 taken 6455 times.
✓ Branch 1 taken 332 times.
|
6787 | ref[3] = h->ref_flag ? 0 : get_bits1(gb); |
| 773 | 6787 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_MEDIAN, BLK_8X8, ref[0]); | |
| 774 | 6787 | ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_MEDIAN, BLK_8X8, ref[1]); | |
| 775 | 6787 | ff_cavs_mv(h, MV_FWD_X2, MV_FWD_X1, MV_PRED_MEDIAN, BLK_8X8, ref[2]); | |
| 776 | 6787 | ff_cavs_mv(h, MV_FWD_X3, MV_FWD_X0, MV_PRED_MEDIAN, BLK_8X8, ref[3]); | |
| 777 | } | ||
| 778 | 83018 | ff_cavs_inter(h, mb_type); | |
| 779 | 83018 | set_intra_mode_default(h); | |
| 780 | 83018 | store_mvs(h); | |
| 781 |
2/2✓ Branch 0 taken 62217 times.
✓ Branch 1 taken 20801 times.
|
83018 | if (mb_type != P_SKIP) |
| 782 | 62217 | decode_residual_inter(h); | |
| 783 | 83018 | ff_cavs_filter(h, mb_type); | |
| 784 | 83018 | h->col_type_base[h->mbidx] = mb_type; | |
| 785 | 83018 | } | |
| 786 | |||
| 787 | 192119 | static int decode_mb_b(AVSContext *h, enum cavs_mb mb_type) | |
| 788 | { | ||
| 789 | int block; | ||
| 790 | enum cavs_sub_mb sub_type[4]; | ||
| 791 | int flags; | ||
| 792 | |||
| 793 | 192119 | ff_cavs_init_mb(h); | |
| 794 | |||
| 795 | /* reset all MVs */ | ||
| 796 | 192119 | h->mv[MV_FWD_X0] = ff_cavs_dir_mv; | |
| 797 | 192119 | set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); | |
| 798 | 192119 | h->mv[MV_BWD_X0] = ff_cavs_dir_mv; | |
| 799 | 192119 | set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); | |
| 800 |
6/6✓ Branch 0 taken 146934 times.
✓ Branch 1 taken 7402 times.
✓ Branch 2 taken 3134 times.
✓ Branch 3 taken 5806 times.
✓ Branch 4 taken 13958 times.
✓ Branch 5 taken 14885 times.
|
192119 | switch (mb_type) { |
| 801 | 146934 | case B_SKIP: | |
| 802 | case B_DIRECT: | ||
| 803 |
2/2✓ Branch 0 taken 14481 times.
✓ Branch 1 taken 132453 times.
|
146934 | if (!h->col_type_base[h->mbidx]) { |
| 804 | /* intra MB at co-location, do in-plane prediction */ | ||
| 805 | 14481 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1); | |
| 806 | 14481 | ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0); | |
| 807 | } else | ||
| 808 | /* direct prediction from co-located P MB, block-wise */ | ||
| 809 |
2/2✓ Branch 0 taken 529812 times.
✓ Branch 1 taken 132453 times.
|
662265 | for (block = 0; block < 4; block++) |
| 810 | 529812 | mv_pred_direct(h, &h->mv[mv_scan[block]], | |
| 811 | 529812 | &h->col_mv[h->mbidx * 4 + block]); | |
| 812 | 146934 | break; | |
| 813 | 7402 | case B_FWD_16X16: | |
| 814 | 7402 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); | |
| 815 | 7402 | break; | |
| 816 | 3134 | case B_SYM_16X16: | |
| 817 | 3134 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); | |
| 818 | 3134 | mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16); | |
| 819 | 3134 | break; | |
| 820 | 5806 | case B_BWD_16X16: | |
| 821 | 5806 | ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0); | |
| 822 | 5806 | break; | |
| 823 | 13958 | case B_8X8: | |
| 824 | #define TMP_UNUSED_INX 7 | ||
| 825 | 13958 | flags = 0; | |
| 826 |
2/2✓ Branch 0 taken 55832 times.
✓ Branch 1 taken 13958 times.
|
69790 | for (block = 0; block < 4; block++) |
| 827 | 55832 | sub_type[block] = get_bits(&h->gb, 2); | |
| 828 |
2/2✓ Branch 0 taken 55832 times.
✓ Branch 1 taken 13958 times.
|
69790 | for (block = 0; block < 4; block++) { |
| 829 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 20568 times.
✓ Branch 2 taken 16611 times.
✓ Branch 3 taken 18653 times.
|
55832 | switch (sub_type[block]) { |
| 830 | ✗ | case B_SUB_DIRECT: | |
| 831 | ✗ | if (!h->col_type_base[h->mbidx]) { | |
| 832 | /* intra MB at co-location, do in-plane prediction */ | ||
| 833 | ✗ | if(flags==0) { | |
| 834 | // if col-MB is a Intra MB, current Block size is 16x16. | ||
| 835 | // AVS standard section 9.9.1 | ||
| 836 | ✗ | if(block>0){ | |
| 837 | ✗ | h->mv[TMP_UNUSED_INX ] = h->mv[MV_FWD_X0 ]; | |
| 838 | ✗ | h->mv[TMP_UNUSED_INX + MV_BWD_OFFS] = h->mv[MV_FWD_X0 + MV_BWD_OFFS]; | |
| 839 | } | ||
| 840 | ✗ | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, | |
| 841 | MV_PRED_BSKIP, BLK_8X8, 1); | ||
| 842 | ✗ | ff_cavs_mv(h, MV_FWD_X0+MV_BWD_OFFS, | |
| 843 | MV_FWD_C2+MV_BWD_OFFS, | ||
| 844 | MV_PRED_BSKIP, BLK_8X8, 0); | ||
| 845 | ✗ | if(block>0) { | |
| 846 | ✗ | flags = mv_scan[block]; | |
| 847 | ✗ | h->mv[flags ] = h->mv[MV_FWD_X0 ]; | |
| 848 | ✗ | h->mv[flags + MV_BWD_OFFS] = h->mv[MV_FWD_X0 + MV_BWD_OFFS]; | |
| 849 | ✗ | h->mv[MV_FWD_X0 ] = h->mv[TMP_UNUSED_INX ]; | |
| 850 | ✗ | h->mv[MV_FWD_X0 + MV_BWD_OFFS] = h->mv[TMP_UNUSED_INX + MV_BWD_OFFS]; | |
| 851 | } else | ||
| 852 | ✗ | flags = MV_FWD_X0; | |
| 853 | } else { | ||
| 854 | ✗ | h->mv[mv_scan[block] ] = h->mv[flags ]; | |
| 855 | ✗ | h->mv[mv_scan[block] + MV_BWD_OFFS] = h->mv[flags + MV_BWD_OFFS]; | |
| 856 | } | ||
| 857 | } else | ||
| 858 | ✗ | mv_pred_direct(h, &h->mv[mv_scan[block]], | |
| 859 | ✗ | &h->col_mv[h->mbidx * 4 + block]); | |
| 860 | ✗ | break; | |
| 861 | 20568 | case B_SUB_FWD: | |
| 862 | 20568 | ff_cavs_mv(h, mv_scan[block], mv_scan[block] - 3, | |
| 863 | MV_PRED_MEDIAN, BLK_8X8, 1); | ||
| 864 | 20568 | break; | |
| 865 | 16611 | case B_SUB_SYM: | |
| 866 | 16611 | ff_cavs_mv(h, mv_scan[block], mv_scan[block] - 3, | |
| 867 | MV_PRED_MEDIAN, BLK_8X8, 1); | ||
| 868 | 16611 | mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8); | |
| 869 | 16611 | break; | |
| 870 | } | ||
| 871 | } | ||
| 872 | #undef TMP_UNUSED_INX | ||
| 873 |
2/2✓ Branch 0 taken 55832 times.
✓ Branch 1 taken 13958 times.
|
69790 | for (block = 0; block < 4; block++) { |
| 874 |
2/2✓ Branch 0 taken 18653 times.
✓ Branch 1 taken 37179 times.
|
55832 | if (sub_type[block] == B_SUB_BWD) |
| 875 | 18653 | ff_cavs_mv(h, mv_scan[block] + MV_BWD_OFFS, | |
| 876 | 18653 | mv_scan[block] + MV_BWD_OFFS - 3, | |
| 877 | MV_PRED_MEDIAN, BLK_8X8, 0); | ||
| 878 | } | ||
| 879 | 13958 | break; | |
| 880 | 14885 | default: | |
| 881 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14885 times.
|
14885 | if (mb_type <= B_SYM_16X16) { |
| 882 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "Invalid mb_type %d in B frame\n", mb_type); | |
| 883 | ✗ | return AVERROR_INVALIDDATA; | |
| 884 | } | ||
| 885 | av_assert2(mb_type < B_8X8); | ||
| 886 | 14885 | flags = ff_cavs_partition_flags[mb_type]; | |
| 887 |
2/2✓ Branch 0 taken 7963 times.
✓ Branch 1 taken 6922 times.
|
14885 | if (mb_type & 1) { /* 16x8 macroblock types */ |
| 888 |
2/2✓ Branch 0 taken 5332 times.
✓ Branch 1 taken 2631 times.
|
7963 | if (flags & FWD0) |
| 889 | 5332 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); | |
| 890 |
2/2✓ Branch 0 taken 2146 times.
✓ Branch 1 taken 5817 times.
|
7963 | if (flags & SYM0) |
| 891 | 2146 | mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8); | |
| 892 |
2/2✓ Branch 0 taken 5436 times.
✓ Branch 1 taken 2527 times.
|
7963 | if (flags & FWD1) |
| 893 | 5436 | ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1); | |
| 894 |
2/2✓ Branch 0 taken 2500 times.
✓ Branch 1 taken 5463 times.
|
7963 | if (flags & SYM1) |
| 895 | 2500 | mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8); | |
| 896 |
2/2✓ Branch 0 taken 2631 times.
✓ Branch 1 taken 5332 times.
|
7963 | if (flags & BWD0) |
| 897 | 2631 | ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0); | |
| 898 |
2/2✓ Branch 0 taken 2527 times.
✓ Branch 1 taken 5436 times.
|
7963 | if (flags & BWD1) |
| 899 | 2527 | ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0); | |
| 900 | } else { /* 8x16 macroblock types */ | ||
| 901 |
2/2✓ Branch 0 taken 4634 times.
✓ Branch 1 taken 2288 times.
|
6922 | if (flags & FWD0) |
| 902 | 4634 | ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1); | |
| 903 |
2/2✓ Branch 0 taken 1978 times.
✓ Branch 1 taken 4944 times.
|
6922 | if (flags & SYM0) |
| 904 | 1978 | mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16); | |
| 905 |
2/2✓ Branch 0 taken 4590 times.
✓ Branch 1 taken 2332 times.
|
6922 | if (flags & FWD1) |
| 906 | 4590 | ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, 1); | |
| 907 |
2/2✓ Branch 0 taken 2021 times.
✓ Branch 1 taken 4901 times.
|
6922 | if (flags & SYM1) |
| 908 | 2021 | mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16); | |
| 909 |
2/2✓ Branch 0 taken 2288 times.
✓ Branch 1 taken 4634 times.
|
6922 | if (flags & BWD0) |
| 910 | 2288 | ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0); | |
| 911 |
2/2✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 4590 times.
|
6922 | if (flags & BWD1) |
| 912 | 2332 | ff_cavs_mv(h, MV_BWD_X1, MV_BWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, 0); | |
| 913 | } | ||
| 914 | } | ||
| 915 | 192119 | ff_cavs_inter(h, mb_type); | |
| 916 | 192119 | set_intra_mode_default(h); | |
| 917 |
2/2✓ Branch 0 taken 83142 times.
✓ Branch 1 taken 108977 times.
|
192119 | if (mb_type != B_SKIP) |
| 918 | 83142 | decode_residual_inter(h); | |
| 919 | 192119 | ff_cavs_filter(h, mb_type); | |
| 920 | |||
| 921 | 192119 | return 0; | |
| 922 | } | ||
| 923 | |||
| 924 | /***************************************************************************** | ||
| 925 | * | ||
| 926 | * slice level | ||
| 927 | * | ||
| 928 | ****************************************************************************/ | ||
| 929 | |||
| 930 | ✗ | static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) | |
| 931 | { | ||
| 932 | ✗ | if (h->stc > 0xAF) | |
| 933 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc); | |
| 934 | |||
| 935 | ✗ | if (h->stc >= h->mb_height) { | |
| 936 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "stc 0x%02x is too large\n", h->stc); | |
| 937 | ✗ | return AVERROR_INVALIDDATA; | |
| 938 | } | ||
| 939 | |||
| 940 | ✗ | h->mby = h->stc; | |
| 941 | ✗ | h->mbidx = h->mby * h->mb_width; | |
| 942 | |||
| 943 | /* mark top macroblocks as unavailable */ | ||
| 944 | ✗ | h->flags &= ~(B_AVAIL | C_AVAIL); | |
| 945 | ✗ | if (!h->pic_qp_fixed) { | |
| 946 | ✗ | h->qp_fixed = get_bits1(gb); | |
| 947 | ✗ | h->qp = get_bits(gb, 6); | |
| 948 | } | ||
| 949 | /* inter frame or second slice can have weighting params */ | ||
| 950 | ✗ | if ((h->cur.f->pict_type != AV_PICTURE_TYPE_I) || | |
| 951 | ✗ | (!h->pic_structure && h->mby >= h->mb_width / 2)) | |
| 952 | ✗ | if (get_bits1(gb)) { //slice_weighting_flag | |
| 953 | ✗ | av_log(h->avctx, AV_LOG_ERROR, | |
| 954 | "weighted prediction not yet supported\n"); | ||
| 955 | } | ||
| 956 | ✗ | return 0; | |
| 957 | } | ||
| 958 | |||
| 959 | 297746 | static inline int check_for_slice(AVSContext *h) | |
| 960 | { | ||
| 961 | 297746 | GetBitContext *gb = &h->gb; | |
| 962 | int align; | ||
| 963 | |||
| 964 |
2/2✓ Branch 0 taken 291129 times.
✓ Branch 1 taken 6617 times.
|
297746 | if (h->mbx) |
| 965 | 291129 | return 0; | |
| 966 | 6617 | align = (-get_bits_count(gb)) & 7; | |
| 967 | /* check for stuffing byte */ | ||
| 968 |
4/4✓ Branch 0 taken 776 times.
✓ Branch 1 taken 5841 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 773 times.
|
6617 | if (!align && (show_bits(gb, 8) == 0x80)) |
| 969 | 3 | align = 8; | |
| 970 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6617 times.
|
6617 | if ((show_bits_long(gb, 24 + align) & 0xFFFFFF) == 0x000001) { |
| 971 | ✗ | skip_bits_long(gb, 24 + align); | |
| 972 | ✗ | h->stc = get_bits(gb, 8); | |
| 973 | ✗ | if (h->stc >= h->mb_height) | |
| 974 | ✗ | return 0; | |
| 975 | ✗ | decode_slice_header(h, gb); | |
| 976 | ✗ | return 1; | |
| 977 | } | ||
| 978 | 6617 | return 0; | |
| 979 | } | ||
| 980 | |||
| 981 | /***************************************************************************** | ||
| 982 | * | ||
| 983 | * frame level | ||
| 984 | * | ||
| 985 | ****************************************************************************/ | ||
| 986 | |||
| 987 | 184 | static int decode_pic(AVSContext *h) | |
| 988 | { | ||
| 989 | int ret; | ||
| 990 | 184 | int skip_count = -1; | |
| 991 | enum cavs_mb mb_type; | ||
| 992 | |||
| 993 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (!h->top_qp) { |
| 994 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "No sequence header decoded yet\n"); | |
| 995 | ✗ | return AVERROR_INVALIDDATA; | |
| 996 | } | ||
| 997 | |||
| 998 | 184 | av_frame_unref(h->cur.f); | |
| 999 | |||
| 1000 | 184 | skip_bits(&h->gb, 16);//bbv_dwlay | |
| 1001 |
2/2✓ Branch 0 taken 177 times.
✓ Branch 1 taken 7 times.
|
184 | if (h->stc == PIC_PB_START_CODE) { |
| 1002 | 177 | h->cur.f->pict_type = get_bits(&h->gb, 2) + AV_PICTURE_TYPE_I; | |
| 1003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 177 times.
|
177 | if (h->cur.f->pict_type > AV_PICTURE_TYPE_B) { |
| 1004 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "illegal picture type\n"); | |
| 1005 | ✗ | return AVERROR_INVALIDDATA; | |
| 1006 | } | ||
| 1007 | /* make sure we have the reference frames we need */ | ||
| 1008 |
1/2✓ Branch 0 taken 177 times.
✗ Branch 1 not taken.
|
177 | if (!h->DPB[0].f->data[0] || |
| 1009 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 175 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
177 | (!h->DPB[1].f->data[0] && h->cur.f->pict_type == AV_PICTURE_TYPE_B)) |
| 1010 | ✗ | return AVERROR_INVALIDDATA; | |
| 1011 | } else { | ||
| 1012 | 7 | h->cur.f->pict_type = AV_PICTURE_TYPE_I; | |
| 1013 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
|
7 | if (get_bits1(&h->gb)) |
| 1014 | ✗ | skip_bits(&h->gb, 24);//time_code | |
| 1015 | /* old sample clips were all progressive and no low_delay, | ||
| 1016 | bump stream revision if detected otherwise */ | ||
| 1017 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
|
7 | if (h->low_delay || !(show_bits(&h->gb, 9) & 1)) |
| 1018 | ✗ | h->stream_revision = 1; | |
| 1019 | /* similarly test top_field_first and repeat_first_field */ | ||
| 1020 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
|
7 | else if (show_bits(&h->gb, 11) & 3) |
| 1021 | ✗ | h->stream_revision = 1; | |
| 1022 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if (h->stream_revision > 0) |
| 1023 | ✗ | skip_bits(&h->gb, 1); //marker_bit | |
| 1024 | } | ||
| 1025 | |||
| 1026 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
|
184 | if (get_bits_left(&h->gb) < 23) |
| 1027 | ✗ | return AVERROR_INVALIDDATA; | |
| 1028 | |||
| 1029 | 184 | ret = ff_get_buffer(h->avctx, h->cur.f, h->cur.f->pict_type == AV_PICTURE_TYPE_B ? | |
| 1030 | 0 : AV_GET_BUFFER_FLAG_REF); | ||
| 1031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (ret < 0) |
| 1032 | ✗ | return ret; | |
| 1033 | |||
| 1034 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 182 times.
|
184 | if (!h->edge_emu_buffer) { |
| 1035 | 2 | int alloc_size = FFALIGN(FFABS(h->cur.f->linesize[0]) + 32, 32); | |
| 1036 | 2 | h->edge_emu_buffer = av_mallocz(alloc_size * 2 * 24); | |
| 1037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!h->edge_emu_buffer) |
| 1038 | ✗ | return AVERROR(ENOMEM); | |
| 1039 | } | ||
| 1040 | |||
| 1041 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
|
184 | if ((ret = ff_cavs_init_pic(h)) < 0) |
| 1042 | ✗ | return ret; | |
| 1043 | 184 | h->cur.poc = get_bits(&h->gb, 8) * 2; | |
| 1044 | |||
| 1045 | /* get temporal distances and MV scaling factors */ | ||
| 1046 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 121 times.
|
184 | if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { |
| 1047 | 63 | h->dist[0] = (h->cur.poc - h->DPB[0].poc) & 511; | |
| 1048 | } else { | ||
| 1049 | 121 | h->dist[0] = (h->DPB[0].poc - h->cur.poc) & 511; | |
| 1050 | } | ||
| 1051 | 184 | h->dist[1] = (h->cur.poc - h->DPB[1].poc) & 511; | |
| 1052 |
2/2✓ Branch 0 taken 182 times.
✓ Branch 1 taken 2 times.
|
184 | h->scale_den[0] = h->dist[0] ? 512/h->dist[0] : 0; |
| 1053 |
2/2✓ Branch 0 taken 182 times.
✓ Branch 1 taken 2 times.
|
184 | h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0; |
| 1054 |
2/2✓ Branch 0 taken 121 times.
✓ Branch 1 taken 63 times.
|
184 | if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) { |
| 1055 | 121 | h->sym_factor = h->dist[0] * h->scale_den[1]; | |
| 1056 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 121 times.
|
121 | if (FFABS(h->sym_factor) > 32768) { |
| 1057 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "sym_factor %d too large\n", h->sym_factor); | |
| 1058 | ✗ | return AVERROR_INVALIDDATA; | |
| 1059 | } | ||
| 1060 | } else { | ||
| 1061 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 2 times.
|
63 | h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0; |
| 1062 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 2 times.
|
63 | h->direct_den[1] = h->dist[1] ? 16384 / h->dist[1] : 0; |
| 1063 | } | ||
| 1064 | |||
| 1065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (h->low_delay) |
| 1066 | ✗ | get_ue_golomb(&h->gb); //bbv_check_times | |
| 1067 | 184 | h->progressive = get_bits1(&h->gb); | |
| 1068 | 184 | h->pic_structure = 1; | |
| 1069 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (!h->progressive) |
| 1070 | ✗ | h->pic_structure = get_bits1(&h->gb); | |
| 1071 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
184 | if (!h->pic_structure && h->stc == PIC_PB_START_CODE) |
| 1072 | ✗ | skip_bits1(&h->gb); //advanced_pred_mode_disable | |
| 1073 | 184 | skip_bits1(&h->gb); //top_field_first | |
| 1074 | 184 | skip_bits1(&h->gb); //repeat_first_field | |
| 1075 | 184 | h->pic_qp_fixed = | |
| 1076 | 184 | h->qp_fixed = get_bits1(&h->gb); | |
| 1077 | 184 | h->qp = get_bits(&h->gb, 6); | |
| 1078 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 177 times.
|
184 | if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) { |
| 1079 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | if (!h->progressive && !h->pic_structure) |
| 1080 | ✗ | skip_bits1(&h->gb);//what is this? | |
| 1081 | 7 | skip_bits(&h->gb, 4); //reserved bits | |
| 1082 | } else { | ||
| 1083 |
3/4✓ Branch 0 taken 121 times.
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 121 times.
|
177 | if (!(h->cur.f->pict_type == AV_PICTURE_TYPE_B && h->pic_structure == 1)) |
| 1084 | 56 | h->ref_flag = get_bits1(&h->gb); | |
| 1085 | 177 | skip_bits(&h->gb, 4); //reserved bits | |
| 1086 | 177 | h->skip_mode_flag = get_bits1(&h->gb); | |
| 1087 | } | ||
| 1088 | 184 | h->loop_filter_disable = get_bits1(&h->gb); | |
| 1089 |
2/4✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 184 times.
|
184 | if (!h->loop_filter_disable && get_bits1(&h->gb)) { |
| 1090 | ✗ | h->alpha_offset = get_se_golomb(&h->gb); | |
| 1091 | ✗ | h->beta_offset = get_se_golomb(&h->gb); | |
| 1092 | ✗ | if ( h->alpha_offset < -64 || h->alpha_offset > 64 | |
| 1093 | ✗ | || h-> beta_offset < -64 || h-> beta_offset > 64) { | |
| 1094 | ✗ | h->alpha_offset = h->beta_offset = 0; | |
| 1095 | ✗ | return AVERROR_INVALIDDATA; | |
| 1096 | } | ||
| 1097 | } else { | ||
| 1098 | 184 | h->alpha_offset = h->beta_offset = 0; | |
| 1099 | } | ||
| 1100 | |||
| 1101 | 184 | ret = 0; | |
| 1102 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 177 times.
|
184 | if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) { |
| 1103 | do { | ||
| 1104 | 11340 | check_for_slice(h); | |
| 1105 | 11340 | ret = decode_mb_i(h, 0); | |
| 1106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11340 times.
|
11340 | if (ret < 0) |
| 1107 | ✗ | break; | |
| 1108 |
2/2✓ Branch 1 taken 11333 times.
✓ Branch 2 taken 7 times.
|
11340 | } while (ff_cavs_next_mb(h)); |
| 1109 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 121 times.
|
177 | } else if (h->cur.f->pict_type == AV_PICTURE_TYPE_P) { |
| 1110 | do { | ||
| 1111 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 90720 times.
|
90720 | if (check_for_slice(h)) |
| 1112 | ✗ | skip_count = -1; | |
| 1113 |
3/4✓ Branch 0 taken 90720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69924 times.
✓ Branch 3 taken 20796 times.
|
90720 | if (h->skip_mode_flag && (skip_count < 0)) { |
| 1114 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 69924 times.
|
69924 | if (get_bits_left(&h->gb) < 1) { |
| 1115 | ✗ | ret = AVERROR_INVALIDDATA; | |
| 1116 | ✗ | break; | |
| 1117 | } | ||
| 1118 | 69924 | skip_count = get_ue_golomb(&h->gb); | |
| 1119 | } | ||
| 1120 |
3/4✓ Branch 0 taken 90720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20801 times.
✓ Branch 3 taken 69919 times.
|
90720 | if (h->skip_mode_flag && skip_count--) { |
| 1121 | 20801 | decode_mb_p(h, P_SKIP); | |
| 1122 | } else { | ||
| 1123 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 69919 times.
|
69919 | if (get_bits_left(&h->gb) < 1) { |
| 1124 | ✗ | ret = AVERROR_INVALIDDATA; | |
| 1125 | ✗ | break; | |
| 1126 | } | ||
| 1127 | 69919 | mb_type = get_ue_golomb(&h->gb) + P_SKIP + h->skip_mode_flag; | |
| 1128 |
2/2✓ Branch 0 taken 7702 times.
✓ Branch 1 taken 62217 times.
|
69919 | if (mb_type > P_8X8) |
| 1129 | 7702 | ret = decode_mb_i(h, mb_type - P_8X8 - 1); | |
| 1130 | else | ||
| 1131 | 62217 | decode_mb_p(h, mb_type); | |
| 1132 | } | ||
| 1133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 90720 times.
|
90720 | if (ret < 0) |
| 1134 | ✗ | break; | |
| 1135 |
2/2✓ Branch 1 taken 90664 times.
✓ Branch 2 taken 56 times.
|
90720 | } while (ff_cavs_next_mb(h)); |
| 1136 | } else { /* AV_PICTURE_TYPE_B */ | ||
| 1137 | do { | ||
| 1138 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 195686 times.
|
195686 | if (check_for_slice(h)) |
| 1139 | ✗ | skip_count = -1; | |
| 1140 |
3/4✓ Branch 0 taken 195686 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 86746 times.
✓ Branch 3 taken 108940 times.
|
195686 | if (h->skip_mode_flag && (skip_count < 0)) { |
| 1141 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 86745 times.
|
86746 | if (get_bits_left(&h->gb) < 1) { |
| 1142 | 1 | ret = AVERROR_INVALIDDATA; | |
| 1143 | 1 | break; | |
| 1144 | } | ||
| 1145 | 86745 | skip_count = get_ue_golomb(&h->gb); | |
| 1146 | } | ||
| 1147 |
3/4✓ Branch 0 taken 195685 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 108977 times.
✓ Branch 3 taken 86708 times.
|
195685 | if (h->skip_mode_flag && skip_count--) { |
| 1148 | 108977 | ret = decode_mb_b(h, B_SKIP); | |
| 1149 | } else { | ||
| 1150 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 86708 times.
|
86708 | if (get_bits_left(&h->gb) < 1) { |
| 1151 | ✗ | ret = AVERROR_INVALIDDATA; | |
| 1152 | ✗ | break; | |
| 1153 | } | ||
| 1154 | 86708 | mb_type = get_ue_golomb(&h->gb) + B_SKIP + h->skip_mode_flag; | |
| 1155 |
2/2✓ Branch 0 taken 3566 times.
✓ Branch 1 taken 83142 times.
|
86708 | if (mb_type > B_8X8) |
| 1156 | 3566 | ret = decode_mb_i(h, mb_type - B_8X8 - 1); | |
| 1157 | else | ||
| 1158 | 83142 | ret = decode_mb_b(h, mb_type); | |
| 1159 | } | ||
| 1160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 195685 times.
|
195685 | if (ret < 0) |
| 1161 | ✗ | break; | |
| 1162 |
2/2✓ Branch 1 taken 195565 times.
✓ Branch 2 taken 120 times.
|
195685 | } while (ff_cavs_next_mb(h)); |
| 1163 | } | ||
| 1164 | 184 | emms_c(); | |
| 1165 |
4/4✓ Branch 0 taken 183 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 120 times.
|
184 | if (ret >= 0 && h->cur.f->pict_type != AV_PICTURE_TYPE_B) { |
| 1166 | 63 | av_frame_unref(h->DPB[1].f); | |
| 1167 | 63 | FFSWAP(AVSFrame, h->cur, h->DPB[1]); | |
| 1168 | 63 | FFSWAP(AVSFrame, h->DPB[0], h->DPB[1]); | |
| 1169 | } | ||
| 1170 | 184 | return ret; | |
| 1171 | } | ||
| 1172 | |||
| 1173 | /***************************************************************************** | ||
| 1174 | * | ||
| 1175 | * headers and interface | ||
| 1176 | * | ||
| 1177 | ****************************************************************************/ | ||
| 1178 | |||
| 1179 | 7 | static int decode_seq_header(AVSContext *h) | |
| 1180 | { | ||
| 1181 | int frame_rate_code; | ||
| 1182 | int width, height; | ||
| 1183 | int ret; | ||
| 1184 | |||
| 1185 | 7 | h->profile = get_bits(&h->gb, 8); | |
| 1186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if (h->profile != 0x20) { |
| 1187 | ✗ | avpriv_report_missing_feature(h->avctx, | |
| 1188 | "only support JiZhun profile"); | ||
| 1189 | ✗ | return AVERROR_PATCHWELCOME; | |
| 1190 | } | ||
| 1191 | 7 | h->level = get_bits(&h->gb, 8); | |
| 1192 | 7 | skip_bits1(&h->gb); //progressive sequence | |
| 1193 | |||
| 1194 | 7 | width = get_bits(&h->gb, 14); | |
| 1195 | 7 | height = get_bits(&h->gb, 14); | |
| 1196 |
5/8✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
|
7 | if ((h->width || h->height) && (h->width != width || h->height != height)) { |
| 1197 | ✗ | avpriv_report_missing_feature(h->avctx, | |
| 1198 | "Width/height changing in CAVS"); | ||
| 1199 | ✗ | return AVERROR_PATCHWELCOME; | |
| 1200 | } | ||
| 1201 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | if (width <= 0 || height <= 0) { |
| 1202 | ✗ | av_log(h->avctx, AV_LOG_ERROR, "Dimensions invalid\n"); | |
| 1203 | ✗ | return AVERROR_INVALIDDATA; | |
| 1204 | } | ||
| 1205 | 7 | skip_bits(&h->gb, 2); //chroma format | |
| 1206 | 7 | skip_bits(&h->gb, 3); //sample_precision | |
| 1207 | 7 | h->aspect_ratio = get_bits(&h->gb, 4); | |
| 1208 | 7 | frame_rate_code = get_bits(&h->gb, 4); | |
| 1209 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | if (frame_rate_code == 0 || frame_rate_code > 13) { |
| 1210 | ✗ | av_log(h->avctx, AV_LOG_WARNING, | |
| 1211 | "frame_rate_code %d is invalid\n", frame_rate_code); | ||
| 1212 | ✗ | frame_rate_code = 1; | |
| 1213 | } | ||
| 1214 | |||
| 1215 | 7 | skip_bits(&h->gb, 18); //bit_rate_lower | |
| 1216 | 7 | skip_bits1(&h->gb); //marker_bit | |
| 1217 | 7 | skip_bits(&h->gb, 12); //bit_rate_upper | |
| 1218 | 7 | h->low_delay = get_bits1(&h->gb); | |
| 1219 | |||
| 1220 | 7 | ret = ff_set_dimensions(h->avctx, width, height); | |
| 1221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if (ret < 0) |
| 1222 | ✗ | return ret; | |
| 1223 | |||
| 1224 | 7 | h->width = width; | |
| 1225 | 7 | h->height = height; | |
| 1226 | 7 | h->mb_width = (h->width + 15) >> 4; | |
| 1227 | 7 | h->mb_height = (h->height + 15) >> 4; | |
| 1228 | 7 | h->avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code]; | |
| 1229 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
|
7 | if (!h->top_qp) |
| 1230 | 2 | return ff_cavs_init_top_lines(h); | |
| 1231 | 5 | return 0; | |
| 1232 | } | ||
| 1233 | |||
| 1234 | ✗ | static av_cold void cavs_flush(AVCodecContext * avctx) | |
| 1235 | { | ||
| 1236 | ✗ | AVSContext *h = avctx->priv_data; | |
| 1237 | ✗ | h->got_keyframe = 0; | |
| 1238 | ✗ | } | |
| 1239 | |||
| 1240 | 186 | static int cavs_decode_frame(AVCodecContext *avctx, AVFrame *rframe, | |
| 1241 | int *got_frame, AVPacket *avpkt) | ||
| 1242 | { | ||
| 1243 | 186 | AVSContext *h = avctx->priv_data; | |
| 1244 | 186 | const uint8_t *buf = avpkt->data; | |
| 1245 | 186 | int buf_size = avpkt->size; | |
| 1246 | 186 | uint32_t stc = -1; | |
| 1247 | int input_size, ret; | ||
| 1248 | const uint8_t *buf_end; | ||
| 1249 | const uint8_t *buf_ptr; | ||
| 1250 | 186 | int frame_start = 0; | |
| 1251 | |||
| 1252 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 184 times.
|
186 | if (buf_size == 0) { |
| 1253 |
3/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
|
2 | if (!h->low_delay && h->DPB[0].f->data[0]) { |
| 1254 | 1 | *got_frame = 1; | |
| 1255 | 1 | av_frame_move_ref(rframe, h->DPB[0].f); | |
| 1256 | } | ||
| 1257 | 2 | return 0; | |
| 1258 | } | ||
| 1259 | |||
| 1260 | 184 | h->stc = 0; | |
| 1261 | |||
| 1262 | 184 | buf_ptr = buf; | |
| 1263 | 184 | buf_end = buf + buf_size; | |
| 1264 | for(;;) { | ||
| 1265 | 379 | buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &stc); | |
| 1266 |
3/4✓ Branch 0 taken 195 times.
✓ Branch 1 taken 184 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 195 times.
|
379 | if ((stc & 0xFFFFFE00) || buf_ptr == buf_end) { |
| 1267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (!h->stc) |
| 1268 | ✗ | av_log(h->avctx, AV_LOG_WARNING, "no frame decoded\n"); | |
| 1269 | 184 | return FFMAX(0, buf_ptr - buf); | |
| 1270 | } | ||
| 1271 | 195 | input_size = (buf_end - buf_ptr) * 8; | |
| 1272 |
5/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 177 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
195 | switch (stc) { |
| 1273 | 7 | case CAVS_START_CODE: | |
| 1274 | 7 | init_get_bits(&h->gb, buf_ptr, input_size); | |
| 1275 | 7 | decode_seq_header(h); | |
| 1276 | 7 | break; | |
| 1277 | 7 | case PIC_I_START_CODE: | |
| 1278 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
|
7 | if (!h->got_keyframe) { |
| 1279 | 2 | av_frame_unref(h->DPB[0].f); | |
| 1280 | 2 | av_frame_unref(h->DPB[1].f); | |
| 1281 | 2 | h->got_keyframe = 1; | |
| 1282 | } | ||
| 1283 | case PIC_PB_START_CODE: | ||
| 1284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (frame_start > 1) |
| 1285 | ✗ | return AVERROR_INVALIDDATA; | |
| 1286 | 184 | frame_start ++; | |
| 1287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (*got_frame) |
| 1288 | ✗ | av_frame_unref(rframe); | |
| 1289 | 184 | *got_frame = 0; | |
| 1290 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 184 times.
|
184 | if (!h->got_keyframe) |
| 1291 | ✗ | break; | |
| 1292 | 184 | init_get_bits(&h->gb, buf_ptr, input_size); | |
| 1293 | 184 | h->stc = stc; | |
| 1294 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 183 times.
|
184 | if (decode_pic(h)) |
| 1295 | 1 | break; | |
| 1296 | 183 | *got_frame = 1; | |
| 1297 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 120 times.
|
183 | if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { |
| 1298 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 2 times.
|
63 | if (h->DPB[!h->low_delay].f->data[0]) { |
| 1299 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
|
61 | if ((ret = av_frame_ref(rframe, h->DPB[!h->low_delay].f)) < 0) |
| 1300 | ✗ | return ret; | |
| 1301 | } else { | ||
| 1302 | 2 | *got_frame = 0; | |
| 1303 | } | ||
| 1304 | } else { | ||
| 1305 | 120 | av_frame_move_ref(rframe, h->cur.f); | |
| 1306 | } | ||
| 1307 | 183 | break; | |
| 1308 | 2 | case EXT_START_CODE: | |
| 1309 | //mpeg_decode_extension(avctx, buf_ptr, input_size); | ||
| 1310 | 2 | break; | |
| 1311 | 2 | case USER_START_CODE: | |
| 1312 | //mpeg_decode_user_data(avctx, buf_ptr, input_size); | ||
| 1313 | 2 | break; | |
| 1314 | ✗ | default: | |
| 1315 | ✗ | if (stc <= SLICE_MAX_START_CODE) { | |
| 1316 | ✗ | init_get_bits(&h->gb, buf_ptr, input_size); | |
| 1317 | ✗ | decode_slice_header(h, &h->gb); | |
| 1318 | } | ||
| 1319 | ✗ | break; | |
| 1320 | } | ||
| 1321 | } | ||
| 1322 | } | ||
| 1323 | |||
| 1324 | const FFCodec ff_cavs_decoder = { | ||
| 1325 | .p.name = "cavs", | ||
| 1326 | CODEC_LONG_NAME("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"), | ||
| 1327 | .p.type = AVMEDIA_TYPE_VIDEO, | ||
| 1328 | .p.id = AV_CODEC_ID_CAVS, | ||
| 1329 | .priv_data_size = sizeof(AVSContext), | ||
| 1330 | .init = ff_cavs_init, | ||
| 1331 | .close = ff_cavs_end, | ||
| 1332 | FF_CODEC_DECODE_CB(cavs_decode_frame), | ||
| 1333 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, | ||
| 1334 | .flush = cavs_flush, | ||
| 1335 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, | ||
| 1336 | }; | ||
| 1337 |