Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 1 | /* |
| 2 | * Bonk audio decoder |
| 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 | |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 21 | #include "libavutil/intreadwrite.h" |
Andreas Rheinhardt | 790f793 | 2024-03-25 00:30:37 | [diff] [blame] | 22 | #include "libavutil/mem.h" |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 23 | #include "avcodec.h" |
| 24 | #include "codec_internal.h" |
| 25 | #include "decode.h" |
| 26 | #define BITSTREAM_READER_LE |
| 27 | #include "get_bits.h" |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 28 | |
| 29 | typedef struct BitCount { |
| 30 | uint8_t bit; |
| 31 | unsigned count; |
| 32 | } BitCount; |
| 33 | |
| 34 | typedef struct BonkContext { |
| 35 | GetBitContext gb; |
| 36 | int skip; |
| 37 | |
| 38 | uint8_t *bitstream; |
| 39 | int64_t max_framesize; |
| 40 | int bitstream_size; |
| 41 | int bitstream_index; |
| 42 | |
| 43 | uint64_t nb_samples; |
| 44 | int lossless; |
| 45 | int mid_side; |
| 46 | int n_taps; |
| 47 | int down_sampling; |
| 48 | int samples_per_packet; |
| 49 | |
| 50 | int state[2][2048], k[2048]; |
| 51 | int *samples[2]; |
| 52 | int *input_samples; |
| 53 | uint8_t quant[2048]; |
| 54 | BitCount *bits; |
| 55 | } BonkContext; |
| 56 | |
| 57 | static av_cold int bonk_close(AVCodecContext *avctx) |
| 58 | { |
| 59 | BonkContext *s = avctx->priv_data; |
| 60 | |
| 61 | av_freep(&s->bitstream); |
| 62 | av_freep(&s->input_samples); |
| 63 | av_freep(&s->samples[0]); |
| 64 | av_freep(&s->samples[1]); |
| 65 | av_freep(&s->bits); |
| 66 | s->bitstream_size = 0; |
| 67 | |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | static av_cold int bonk_init(AVCodecContext *avctx) |
| 72 | { |
| 73 | BonkContext *s = avctx->priv_data; |
| 74 | |
| 75 | avctx->sample_fmt = AV_SAMPLE_FMT_S16P; |
| 76 | if (avctx->extradata_size < 17) |
| 77 | return AVERROR(EINVAL); |
| 78 | |
| 79 | if (avctx->extradata[0]) { |
| 80 | av_log(avctx, AV_LOG_ERROR, "Unsupported version.\n"); |
| 81 | return AVERROR_INVALIDDATA; |
| 82 | } |
| 83 | |
| 84 | if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) |
| 85 | return AVERROR_INVALIDDATA; |
| 86 | |
| 87 | s->nb_samples = AV_RL32(avctx->extradata + 1) / avctx->ch_layout.nb_channels; |
| 88 | if (!s->nb_samples) |
| 89 | s->nb_samples = UINT64_MAX; |
| 90 | s->lossless = avctx->extradata[10] != 0; |
| 91 | s->mid_side = avctx->extradata[11] != 0; |
| 92 | s->n_taps = AV_RL16(avctx->extradata + 12); |
| 93 | if (!s->n_taps || s->n_taps > 2048) |
| 94 | return AVERROR(EINVAL); |
| 95 | |
| 96 | s->down_sampling = avctx->extradata[14]; |
| 97 | if (!s->down_sampling) |
| 98 | return AVERROR(EINVAL); |
| 99 | |
| 100 | s->samples_per_packet = AV_RL16(avctx->extradata + 15); |
| 101 | if (!s->samples_per_packet) |
| 102 | return AVERROR(EINVAL); |
Michael Niedermayer | 8e58d20 | 2023-01-11 20:07:13 | [diff] [blame] | 103 | |
| 104 | if (s->down_sampling * s->samples_per_packet < s->n_taps) |
| 105 | return AVERROR_INVALIDDATA; |
| 106 | |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 107 | s->max_framesize = s->samples_per_packet * avctx->ch_layout.nb_channels * s->down_sampling * 16LL; |
| 108 | if (s->max_framesize > (INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) / 8) |
| 109 | return AVERROR_INVALIDDATA; |
| 110 | |
| 111 | s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE, sizeof(*s->bitstream)); |
| 112 | if (!s->bitstream) |
| 113 | return AVERROR(ENOMEM); |
| 114 | |
| 115 | s->input_samples = av_calloc(s->samples_per_packet, sizeof(*s->input_samples)); |
| 116 | if (!s->input_samples) |
| 117 | return AVERROR(ENOMEM); |
| 118 | |
| 119 | s->samples[0] = av_calloc(s->samples_per_packet * s->down_sampling, sizeof(*s->samples[0])); |
| 120 | s->samples[1] = av_calloc(s->samples_per_packet * s->down_sampling, sizeof(*s->samples[0])); |
| 121 | if (!s->samples[0] || !s->samples[1]) |
| 122 | return AVERROR(ENOMEM); |
| 123 | |
| 124 | s->bits = av_calloc(s->max_framesize * 8, sizeof(*s->bits)); |
| 125 | if (!s->bits) |
| 126 | return AVERROR(ENOMEM); |
| 127 | |
| 128 | for (int i = 0; i < 512; i++) { |
| 129 | s->quant[i] = sqrt(i + 1); |
| 130 | } |
| 131 | |
| 132 | return 0; |
| 133 | } |
| 134 | |
| 135 | static unsigned read_uint_max(BonkContext *s, uint32_t max) |
| 136 | { |
| 137 | unsigned value = 0; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 138 | |
| 139 | if (max == 0) |
| 140 | return 0; |
| 141 | |
Michael Niedermayer | 00b489b | 2022-11-06 12:34:26 | [diff] [blame] | 142 | av_assert0(max >> 31 == 0); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 143 | |
Michael Niedermayer | 9f00286 | 2022-11-06 09:34:39 | [diff] [blame] | 144 | for (unsigned i = 1; i <= max - value; i+=i) |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 145 | if (get_bits1(&s->gb)) |
Michael Niedermayer | 9f00286 | 2022-11-06 09:34:39 | [diff] [blame] | 146 | value += i; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 147 | |
| 148 | return value; |
| 149 | } |
| 150 | |
| 151 | static int intlist_read(BonkContext *s, int *buf, int entries, int base_2_part) |
| 152 | { |
| 153 | int i, low_bits = 0, x = 0, max_x; |
| 154 | int n_zeros = 0, step = 256, dominant = 0; |
| 155 | int pos = 0, level = 0; |
| 156 | BitCount *bits = s->bits; |
Michael Niedermayer | 957106a | 2022-11-05 18:33:33 | [diff] [blame] | 157 | int passes = 1; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 158 | |
| 159 | memset(buf, 0, entries * sizeof(*buf)); |
| 160 | if (base_2_part) { |
| 161 | low_bits = get_bits(&s->gb, 4); |
| 162 | |
| 163 | if (low_bits) |
| 164 | for (i = 0; i < entries; i++) |
| 165 | buf[i] = get_bits(&s->gb, low_bits); |
| 166 | } |
| 167 | |
| 168 | while (n_zeros < entries) { |
| 169 | int steplet = step >> 8; |
| 170 | |
| 171 | if (get_bits_left(&s->gb) <= 0) |
| 172 | return AVERROR_INVALIDDATA; |
| 173 | |
| 174 | if (!get_bits1(&s->gb)) { |
Michael Niedermayer | 8e59e72 | 2022-11-06 10:29:38 | [diff] [blame] | 175 | av_assert0(steplet >= 0); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 176 | |
| 177 | if (steplet > 0) { |
| 178 | bits[x ].bit = dominant; |
| 179 | bits[x++].count = steplet; |
| 180 | } |
| 181 | |
| 182 | if (!dominant) |
| 183 | n_zeros += steplet; |
| 184 | |
Michael Niedermayer | 3263185 | 2022-11-06 10:26:51 | [diff] [blame] | 185 | if (step > INT32_MAX*8LL/9 + 1) |
| 186 | return AVERROR_INVALIDDATA; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 187 | step += step / 8; |
| 188 | } else if (steplet > 0) { |
| 189 | int actual_run = read_uint_max(s, steplet - 1); |
| 190 | |
Michael Niedermayer | 5df8c30 | 2022-11-06 12:34:27 | [diff] [blame] | 191 | av_assert0(actual_run >= 0); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 192 | |
| 193 | if (actual_run > 0) { |
| 194 | bits[x ].bit = dominant; |
| 195 | bits[x++].count = actual_run; |
| 196 | } |
| 197 | |
| 198 | bits[x ].bit = !dominant; |
| 199 | bits[x++].count = 1; |
| 200 | |
| 201 | if (!dominant) |
| 202 | n_zeros += actual_run; |
| 203 | else |
| 204 | n_zeros++; |
| 205 | |
| 206 | step -= step / 8; |
| 207 | } |
| 208 | |
| 209 | if (step < 256) { |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 210 | step = 65536 / step; |
| 211 | dominant = !dominant; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | max_x = x; |
| 216 | x = 0; |
| 217 | n_zeros = 0; |
| 218 | for (i = 0; n_zeros < entries; i++) { |
Michael Niedermayer | 957106a | 2022-11-05 18:33:33 | [diff] [blame] | 219 | if (x >= max_x) |
| 220 | return AVERROR_INVALIDDATA; |
| 221 | |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 222 | if (pos >= entries) { |
| 223 | pos = 0; |
Michael Niedermayer | 957106a | 2022-11-05 18:33:33 | [diff] [blame] | 224 | level += passes << low_bits; |
| 225 | passes = 1; |
| 226 | if (bits[x].bit && bits[x].count > entries - n_zeros) |
| 227 | passes = bits[x].count / (entries - n_zeros); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 228 | } |
| 229 | |
Paul B Mahol | 5852682 | 2023-01-02 17:41:37 | [diff] [blame] | 230 | if (level > 1 << 16) |
Paul B Mahol | abb5ff3 | 2022-11-22 10:27:39 | [diff] [blame] | 231 | return AVERROR_INVALIDDATA; |
| 232 | |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 233 | if (buf[pos] >= level) { |
| 234 | if (bits[x].bit) |
Michael Niedermayer | 957106a | 2022-11-05 18:33:33 | [diff] [blame] | 235 | buf[pos] += passes << low_bits; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 236 | else |
| 237 | n_zeros++; |
| 238 | |
Michael Niedermayer | 957106a | 2022-11-05 18:33:33 | [diff] [blame] | 239 | av_assert1(bits[x].count >= passes); |
| 240 | bits[x].count -= passes; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 241 | x += bits[x].count == 0; |
| 242 | } |
| 243 | |
| 244 | pos++; |
| 245 | } |
| 246 | |
| 247 | for (i = 0; i < entries; i++) { |
| 248 | if (buf[i] && get_bits1(&s->gb)) { |
| 249 | buf[i] = -buf[i]; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | return 0; |
| 254 | } |
| 255 | |
| 256 | static inline int shift_down(int a, int b) |
| 257 | { |
| 258 | return (a >> b) + (a < 0); |
| 259 | } |
| 260 | |
| 261 | static inline int shift(int a, int b) |
| 262 | { |
| 263 | return a + (1 << b - 1) >> b; |
| 264 | } |
| 265 | |
| 266 | #define LATTICE_SHIFT 10 |
| 267 | #define SAMPLE_SHIFT 4 |
| 268 | #define SAMPLE_FACTOR (1 << SAMPLE_SHIFT) |
| 269 | |
| 270 | static int predictor_calc_error(int *k, int *state, int order, int error) |
| 271 | { |
Michael Niedermayer | cd66606 | 2023-10-05 12:17:05 | [diff] [blame] | 272 | int i, x = error - (unsigned)shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 273 | int *k_ptr = &(k[order-2]), |
| 274 | *state_ptr = &(state[order-2]); |
| 275 | |
| 276 | for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--) { |
Michael Niedermayer | f4df49e | 2022-11-05 19:03:52 | [diff] [blame] | 277 | unsigned k_value = *k_ptr, state_value = *state_ptr; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 278 | |
Michael Niedermayer | 2b25a51 | 2023-06-03 00:00:51 | [diff] [blame] | 279 | x -= (unsigned) shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 280 | state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT); |
| 281 | } |
| 282 | |
| 283 | // don't drift too far, to avoid overflows |
Andreas Rheinhardt | 8d12f3d | 2022-09-12 12:17:32 | [diff] [blame] | 284 | x = av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 285 | |
| 286 | state[0] = x; |
| 287 | |
| 288 | return x; |
| 289 | } |
| 290 | |
Michael Niedermayer | 8f97564 | 2022-11-16 13:11:51 | [diff] [blame] | 291 | static void predictor_init_state(int *k, unsigned *state, int order) |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 292 | { |
| 293 | for (int i = order - 2; i >= 0; i--) { |
Michael Niedermayer | 8f97564 | 2022-11-16 13:11:51 | [diff] [blame] | 294 | unsigned x = state[i]; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 295 | |
| 296 | for (int j = 0, p = i + 1; p < order; j++, p++) { |
| 297 | int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT); |
| 298 | |
| 299 | state[p] += shift_down(k[j] * x, LATTICE_SHIFT); |
| 300 | x = tmp; |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | static int bonk_decode(AVCodecContext *avctx, AVFrame *frame, |
| 306 | int *got_frame_ptr, AVPacket *pkt) |
| 307 | { |
| 308 | BonkContext *s = avctx->priv_data; |
| 309 | GetBitContext *gb = &s->gb; |
| 310 | const uint8_t *buf; |
| 311 | int quant, n, buf_size, input_buf_size; |
| 312 | int ret = AVERROR_INVALIDDATA; |
| 313 | |
| 314 | if ((!pkt->size && !s->bitstream_size) || s->nb_samples == 0) { |
| 315 | *got_frame_ptr = 0; |
| 316 | return pkt->size; |
| 317 | } |
| 318 | |
| 319 | buf_size = FFMIN(pkt->size, s->max_framesize - s->bitstream_size); |
| 320 | input_buf_size = buf_size; |
| 321 | if (s->bitstream_index + s->bitstream_size + buf_size + AV_INPUT_BUFFER_PADDING_SIZE > s->max_framesize) { |
| 322 | memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); |
| 323 | s->bitstream_index = 0; |
| 324 | } |
| 325 | if (pkt->data) |
| 326 | memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], pkt->data, buf_size); |
| 327 | buf = &s->bitstream[s->bitstream_index]; |
| 328 | buf_size += s->bitstream_size; |
| 329 | s->bitstream_size = buf_size; |
| 330 | if (buf_size < s->max_framesize && pkt->data) { |
| 331 | *got_frame_ptr = 0; |
| 332 | return input_buf_size; |
| 333 | } |
| 334 | |
| 335 | frame->nb_samples = FFMIN(s->samples_per_packet * s->down_sampling, s->nb_samples); |
| 336 | if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) |
Paul B Mahol | 0c7af7b | 2023-02-07 15:26:40 | [diff] [blame] | 337 | goto fail; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 338 | |
| 339 | if ((ret = init_get_bits8(gb, buf, buf_size)) < 0) |
Paul B Mahol | 0c7af7b | 2023-02-07 15:26:40 | [diff] [blame] | 340 | goto fail; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 341 | |
| 342 | skip_bits(gb, s->skip); |
| 343 | if ((ret = intlist_read(s, s->k, s->n_taps, 0)) < 0) |
Paul B Mahol | abb5ff3 | 2022-11-22 10:27:39 | [diff] [blame] | 344 | goto fail; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 345 | |
| 346 | for (int i = 0; i < s->n_taps; i++) |
| 347 | s->k[i] *= s->quant[i]; |
| 348 | quant = s->lossless ? 1 : get_bits(&s->gb, 16) * SAMPLE_FACTOR; |
| 349 | |
| 350 | for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { |
| 351 | const int samples_per_packet = s->samples_per_packet; |
| 352 | const int down_sampling = s->down_sampling; |
| 353 | const int offset = samples_per_packet * down_sampling - 1; |
| 354 | int *state = s->state[ch]; |
| 355 | int *sample = s->samples[ch]; |
| 356 | |
| 357 | predictor_init_state(s->k, state, s->n_taps); |
| 358 | if ((ret = intlist_read(s, s->input_samples, samples_per_packet, 1)) < 0) |
Paul B Mahol | abb5ff3 | 2022-11-22 10:27:39 | [diff] [blame] | 359 | goto fail; |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 360 | |
| 361 | for (int i = 0; i < samples_per_packet; i++) { |
| 362 | for (int j = 0; j < s->down_sampling - 1; j++) { |
| 363 | sample[0] = predictor_calc_error(s->k, state, s->n_taps, 0); |
| 364 | sample++; |
| 365 | } |
| 366 | |
Michael Niedermayer | 977028f | 2022-11-05 18:57:21 | [diff] [blame] | 367 | sample[0] = predictor_calc_error(s->k, state, s->n_taps, s->input_samples[i] * (unsigned)quant); |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 368 | sample++; |
| 369 | } |
| 370 | |
| 371 | sample = s->samples[ch]; |
| 372 | for (int i = 0; i < s->n_taps; i++) |
| 373 | state[i] = sample[offset - i]; |
| 374 | } |
| 375 | |
| 376 | if (s->mid_side && avctx->ch_layout.nb_channels == 2) { |
| 377 | for (int i = 0; i < frame->nb_samples; i++) { |
| 378 | s->samples[1][i] += shift(s->samples[0][i], 1); |
| 379 | s->samples[0][i] -= s->samples[1][i]; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | if (!s->lossless) { |
| 384 | for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { |
| 385 | int *samples = s->samples[ch]; |
| 386 | for (int i = 0; i < frame->nb_samples; i++) |
| 387 | samples[i] = shift(samples[i], 4); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { |
| 392 | int16_t *osamples = (int16_t *)frame->extended_data[ch]; |
| 393 | int *samples = s->samples[ch]; |
| 394 | for (int i = 0; i < frame->nb_samples; i++) |
| 395 | osamples[i] = av_clip_int16(samples[i]); |
| 396 | } |
| 397 | |
| 398 | s->nb_samples -= frame->nb_samples; |
| 399 | |
| 400 | s->skip = get_bits_count(gb) - 8 * (get_bits_count(gb) / 8); |
| 401 | n = get_bits_count(gb) / 8; |
| 402 | |
| 403 | if (n > buf_size) { |
Paul B Mahol | abb5ff3 | 2022-11-22 10:27:39 | [diff] [blame] | 404 | fail: |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 405 | s->bitstream_size = 0; |
| 406 | s->bitstream_index = 0; |
| 407 | return AVERROR_INVALIDDATA; |
| 408 | } |
| 409 | |
| 410 | *got_frame_ptr = 1; |
| 411 | |
| 412 | if (s->bitstream_size) { |
| 413 | s->bitstream_index += n; |
| 414 | s->bitstream_size -= n; |
| 415 | return input_buf_size; |
| 416 | } |
| 417 | return n; |
| 418 | } |
| 419 | |
| 420 | const FFCodec ff_bonk_decoder = { |
| 421 | .p.name = "bonk", |
| 422 | CODEC_LONG_NAME("Bonk audio"), |
| 423 | .p.type = AVMEDIA_TYPE_AUDIO, |
| 424 | .p.id = AV_CODEC_ID_BONK, |
| 425 | .priv_data_size = sizeof(BonkContext), |
| 426 | .init = bonk_init, |
| 427 | FF_CODEC_DECODE_CB(bonk_decode), |
| 428 | .close = bonk_close, |
| 429 | .p.capabilities = AV_CODEC_CAP_DELAY | |
Anton Khirnov | 8b20d0d | 2023-05-09 10:28:10 | [diff] [blame] | 430 | AV_CODEC_CAP_DR1, |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 431 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, |
Andreas Rheinhardt | 0971fcf | 2025-03-07 00:19:27 | [diff] [blame] | 432 | CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P), |
Paul B Mahol | 8817007 | 2022-09-07 11:58:53 | [diff] [blame] | 433 | }; |