xref: /third_party/ffmpeg/libavcodec/dcahuff.h (revision cabdff1a)
1/*
2 * DCA compatible decoder - huffman tables
3 * Copyright (C) 2004 Gildas Bazin
4 * Copyright (C) 2007 Konstantin Shishkov
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_DCAHUFF_H
24#define AVCODEC_DCAHUFF_H
25
26#include <stdint.h>
27
28#include "libavutil/attributes.h"
29
30#include "put_bits.h"
31#include "vlc.h"
32
33#define DCA_CODE_BOOKS      10
34#define DCA_BITALLOC_12_COUNT    5
35
36typedef struct DCAVLC {
37    int offset;         ///< Code values offset
38    int max_depth;      ///< Parameter for get_vlc2()
39    VLC vlc[7];         ///< Actual codes
40} DCAVLC;
41
42extern DCAVLC   ff_dca_vlc_bit_allocation;
43extern DCAVLC   ff_dca_vlc_transition_mode;
44extern DCAVLC   ff_dca_vlc_scale_factor;
45extern DCAVLC   ff_dca_vlc_quant_index[DCA_CODE_BOOKS];
46
47extern VLC  ff_dca_vlc_tnl_grp[5];
48extern VLC  ff_dca_vlc_tnl_scf;
49extern VLC  ff_dca_vlc_damp;
50extern VLC  ff_dca_vlc_dph;
51extern VLC  ff_dca_vlc_fst_rsd_amp;
52extern VLC  ff_dca_vlc_rsd_apprx;
53extern VLC  ff_dca_vlc_rsd_amp;
54extern VLC  ff_dca_vlc_avg_g3;
55extern VLC  ff_dca_vlc_st_grid;
56extern VLC  ff_dca_vlc_grid_2;
57extern VLC  ff_dca_vlc_grid_3;
58extern VLC  ff_dca_vlc_rsd;
59
60av_cold void ff_dca_init_vlcs(void);
61uint32_t ff_dca_vlc_calc_quant_bits(int *values, uint8_t n, uint8_t sel, uint8_t abits);
62void ff_dca_vlc_enc_quant(PutBitContext *pb, int *values, uint8_t n, uint8_t sel, uint8_t abits);
63uint32_t ff_dca_vlc_calc_alloc_bits(int *values, uint8_t n, uint8_t sel);
64void ff_dca_vlc_enc_alloc(PutBitContext *pb, int *values, uint8_t n, uint8_t sel);
65
66#endif /* AVCODEC_DCAHUFF_H */
67