]> git.sesse.net Git - ffmpeg/blob - libavcodec/intrax8.h
Merge commit '65127450add50c3bca307edc0517d2e8382717a0'
[ffmpeg] / libavcodec / intrax8.h
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_INTRAX8_H
20 #define AVCODEC_INTRAX8_H
21
22 #include "get_bits.h"
23 #include "mpegvideo.h"
24 #include "intrax8dsp.h"
25 #include "wmv2dsp.h"
26
27 typedef struct IntraX8Context {
28     VLC *j_ac_vlc[4]; // they point to the static j_mb_vlc
29     VLC *j_orient_vlc;
30     VLC *j_dc_vlc[3];
31
32     int use_quant_matrix;
33
34     // set by ff_intrax8_common_init
35     uint8_t *prediction_table; // 2 * (mb_w * 2)
36     ScanTable scantable[3];
37     WMV2DSPContext wdsp;
38     uint8_t idct_permutation[64];
39
40     //set by the caller codec
41     MpegEncContext * s;
42     IntraX8DSPContext dsp;
43     int quant;
44     int dquant;
45     int qsum;
46
47     // calculated per frame
48     int quant_dc_chroma;
49     int divide_quant_dc_luma;
50     int divide_quant_dc_chroma;
51     uint8_t *dest[3];
52
53     // changed per block
54     int edges;
55     int flat_dc;
56     int predicted_dc;
57     int raw_orient;
58     int chroma_orient;
59     int orient;
60     int est_run;
61 } IntraX8Context;
62
63 /**
64  * Initialize IntraX8 frame decoder.
65  * Requires valid MpegEncContext with valid s->mb_width before calling.
66  * @param w pointer to IntraX8Context
67  * @param s pointer to MpegEncContext of the parent codec
68  * @return 0 on success, a negative AVERROR value on error
69  */
70 int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
71
72 /**
73  * Destroy IntraX8 frame structure.
74  * @param w pointer to IntraX8Context
75  */
76 void ff_intrax8_common_end(IntraX8Context *w);
77
78 /**
79  * Decode single IntraX8 frame.
80  * The parent codec must fill s->loopfilter and s->gb (bitstream).
81  * The parent codec must call ff_mpv_frame_start() before calling this function.
82  * The parent codec must call ff_mpv_frame_end() after calling this function.
83  * This function does not use ff_mpv_decode_mb().
84  * lowres decoding is theoretically impossible.
85  * @param w pointer to IntraX8Context
86  * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
87  * @param quant_offset offset away from zero
88  */
89 int ff_intrax8_decode_picture(IntraX8Context *w, int quant, int halfpq);
90
91 #endif /* AVCODEC_INTRAX8_H */