FFmpeg
apv_decode.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_APV_DECODE_H
20 #define AVCODEC_APV_DECODE_H
21 
22 #include <stdint.h>
23 
24 #include "apv.h"
25 #include "avcodec.h"
26 #include "get_bits.h"
27 
28 
29 // Number of bits in the entropy look-up tables.
30 // It may be desirable to tune this per-architecture, as a larger LUT
31 // trades greater memory use for fewer instructions.
32 // (N bits -> 24*2^N bytes of tables; 9 -> 12KB of tables.)
33 #define APV_VLC_LUT_BITS 9
34 #define APV_VLC_LUT_SIZE (1 << APV_VLC_LUT_BITS)
35 
36 typedef struct APVVLCLUTEntry {
37  uint16_t result; // Return value if not reading more.
38  uint8_t consume; // Number of bits to consume.
39  uint8_t more; // Whether to read additional bits.
41 
42 typedef struct APVVLCLUT {
44 } APVVLCLUT;
45 
46 typedef struct APVEntropyState {
47  void *log_ctx;
48 
50 
51  int16_t prev_dc;
52  int16_t prev_dc_diff;
55 
56 
57 /**
58  * Build the decoder VLC look-up table.
59  */
61 
62 /**
63  * Entropy decode a single 8x8 block to coefficients.
64  *
65  * Outputs in block order (dezigzag already applied).
66  */
68  GetBitContext *gbc,
70 
71 /**
72  * Read a single APV VLC code.
73  *
74  * This entrypoint is exposed for testing.
75  */
76 unsigned int ff_apv_read_vlc(GetBitContext *gbc, int k_param,
77  const APVVLCLUT *lut);
78 
79 
80 #endif /* AVCODEC_APV_DECODE_H */
ff_apv_entropy_decode_block
int ff_apv_entropy_decode_block(int16_t *coeff, GetBitContext *gbc, APVEntropyState *state)
Entropy decode a single 8x8 block to coefficients.
Definition: apv_entropy.c:104
state
static struct @501 state
APVVLCLUTEntry
Definition: apv_decode.h:36
APVVLCLUT::lut
APVVLCLUTEntry lut[6][APV_VLC_LUT_SIZE]
Definition: apv_decode.h:43
GetBitContext
Definition: get_bits.h:108
APVVLCLUTEntry::consume
uint8_t consume
Definition: apv_decode.h:38
APV_VLC_LUT_SIZE
#define APV_VLC_LUT_SIZE
Definition: apv_decode.h:34
get_bits.h
APVVLCLUTEntry::result
uint16_t result
Definition: apv_decode.h:37
ff_apv_entropy_build_decode_lut
void ff_apv_entropy_build_decode_lut(APVVLCLUT *decode_lut)
Build the decoder VLC look-up table.
Definition: apv_entropy.c:23
ff_apv_read_vlc
unsigned int ff_apv_read_vlc(GetBitContext *gbc, int k_param, const APVVLCLUT *lut)
Read a single APV VLC code.
Definition: apv_entropy.c:98
APVEntropyState
Definition: apv_decode.h:46
APVEntropyState::log_ctx
void * log_ctx
Definition: apv_decode.h:47
apv.h
APVVLCLUTEntry::more
uint8_t more
Definition: apv_decode.h:39
avcodec.h
APVVLCLUT
Definition: apv_decode.h:42
APVEntropyState::prev_1st_ac_level
int16_t prev_1st_ac_level
Definition: apv_decode.h:53
APVEntropyState::prev_dc_diff
int16_t prev_dc_diff
Definition: apv_decode.h:52
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:80
APVEntropyState::prev_dc
int16_t prev_dc
Definition: apv_decode.h:51
APVEntropyState::decode_lut
const APVVLCLUT * decode_lut
Definition: apv_decode.h:49