2 * Copyright (C) 2016 Open Broadcast Systems Ltd.
3 * Author 2016 Rostislav Pehlivanov <rpehlivanov@obe.tv>
5 * This file is part of FFmpeg.
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.
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.
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
22 #ifndef AVCODEC_DIRAC_VLC_H
23 #define AVCODEC_DIRAC_VLC_H
25 #include "libavutil/avutil.h"
27 /* Can be 32 bits wide for some performance gain on some machines, but it will
28 * incorrectly decode very long coefficients (usually only 1 or 2 per frame) */
29 typedef uint64_t residual;
33 /* Exactly 64 bytes */
34 typedef struct DiracGolombLUT {
35 residual preamble, leftover;
36 int32_t ready[LUT_BITS];
37 int32_t preamble_bits, leftover_bits, ready_num;
41 av_cold int ff_dirac_golomb_reader_init(DiracGolombLUT **lut_ctx);
43 int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
44 int bytes, uint8_t *dst, int coeffs);
46 int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
47 int bytes, uint8_t *_dst, int coeffs);
49 av_cold void ff_dirac_golomb_reader_end(DiracGolombLUT **lut_ctx);
51 #endif /* AVCODEC_DIRAC_VLC_H */