avformat/mpeg: demux ivtv captions
[ffmpeg.git] / libavcodec / intrax8.h
blobb9f8c4250b29e50b2ce369826a6bd7dd19e468a3
1 /*
2 * This file is part of FFmpeg.
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.
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.
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
19 #ifndef AVCODEC_INTRAX8_H
20 #define AVCODEC_INTRAX8_H
22 #include "blockdsp.h"
23 #include "get_bits.h"
24 #include "intrax8dsp.h"
25 #include "wmv2dsp.h"
26 #include "mpegpicture.h"
28 typedef struct IntraX8Context {
29 const VLCElem *j_ac_vlc_table[4]; // they point to the static j_mb_vlc.table
30 const VLCElem *j_orient_vlc_table;
31 const VLCElem *j_dc_vlc_table[3];
33 int use_quant_matrix;
35 // set by ff_intrax8_common_init
36 uint8_t *prediction_table; // 2 * (mb_w * 2)
37 uint8_t permutated_scantable[3][64];
38 WMV2DSPContext wdsp;
39 uint8_t idct_permutation[64];
40 AVCodecContext *avctx;
41 int *block_last_index; ///< last nonzero coefficient in block
42 int16_t (*block)[64];
44 // set by the caller codec
45 IntraX8DSPContext dsp;
46 BlockDSPContext bdsp;
47 int quant;
48 int dquant;
49 int qsum;
50 int loopfilter;
51 AVFrame *frame;
52 GetBitContext *gb;
54 // calculated per frame
55 int quant_dc_chroma;
56 int divide_quant_dc_luma;
57 int divide_quant_dc_chroma;
58 uint8_t *dest[3];
59 uint8_t scratchpad[42]; // size of the block is fixed (8x8 plus padding)
61 // changed per block
62 int edges;
63 int flat_dc;
64 int predicted_dc;
65 int raw_orient;
66 int chroma_orient;
67 int orient;
68 int est_run;
70 // block props
71 int mb_x, mb_y;
72 int mb_width, mb_height;
73 } IntraX8Context;
75 /**
76 * Initialize IntraX8 frame decoder.
77 * @param avctx pointer to AVCodecContext
78 * @param w pointer to IntraX8Context
79 * @param block pointer to block array
80 * @param block_last_index pointer to index array
81 * @param mb_width macroblock width
82 * @param mb_height macroblock height
83 * @return 0 on success, a negative AVERROR value on error
85 int ff_intrax8_common_init(AVCodecContext *avctx,
86 IntraX8Context *w,
87 int16_t (*block)[64],
88 int block_last_index[12],
89 int mb_width, int mb_height);
91 /**
92 * Destroy IntraX8 frame structure.
93 * @param w pointer to IntraX8Context
95 void ff_intrax8_common_end(IntraX8Context *w);
97 /**
98 * Decode single IntraX8 frame.
99 * lowres decoding is theoretically impossible.
100 * @param w pointer to IntraX8Context
101 * @param pict the output Picture containing an AVFrame
102 * @param gb open bitstream reader
103 * @param mb_x pointer to the x coordinate of the current macroblock
104 * @param mb_y pointer to the y coordinate of the current macroblock
105 * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
106 * @param quant_offset offset away from zero
107 * @param loopfilter enable filter after decoding a block
109 int ff_intrax8_decode_picture(IntraX8Context *w, MPVPicture *pict,
110 GetBitContext *gb, int *mb_x, int *mb_y,
111 int quant, int halfpq,
112 int loopfilter, int lowdelay);
114 #endif /* AVCODEC_INTRAX8_H */