]> git.sesse.net Git - ffmpeg/blob - libavcodec/dnxhdenc.h
Merge commit 'd860a3cc0a12360a92b9ffd179a0c34413beaf88'
[ffmpeg] / libavcodec / dnxhdenc.h
1 /*
2  * VC3/DNxHD encoder structure definitions and prototypes
3  * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
4  *
5  * VC-3 encoder funded by the British Broadcasting Corporation
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23
24 #ifndef AVCODEC_DNXHDENC_H
25 #define AVCODEC_DNXHDENC_H
26
27 #include <stdint.h>
28
29 #include "config.h"
30
31 #include "mpegvideo.h"
32 #include "dnxhddata.h"
33
34 typedef struct RCCMPEntry {
35     uint16_t mb;
36     int value;
37 } RCCMPEntry;
38
39 typedef struct RCEntry {
40     int ssd;
41     int bits;
42 } RCEntry;
43
44 typedef struct DNXHDEncContext {
45     AVClass *class;
46     BlockDSPContext bdsp;
47     MpegEncContext m; ///< Used for quantization dsp functions
48
49     int cid;
50     int profile;
51     const CIDEntry *cid_table;
52     uint8_t *msip; ///< Macroblock Scan Indexes Payload
53     uint32_t *slice_size;
54     uint32_t *slice_offs;
55
56     struct DNXHDEncContext *thread[MAX_THREADS];
57
58     // Because our samples are either 8 or 16 bits for 8-bit and 10-bit
59     // encoding respectively, these refer either to bytes or to two-byte words.
60     unsigned dct_y_offset;
61     unsigned dct_uv_offset;
62     unsigned block_width_l2;
63
64     int frame_size;
65     int coding_unit_size;
66     int data_offset;
67
68     int interlaced;
69     int cur_field;
70
71     int nitris_compat;
72     unsigned min_padding;
73     int intra_quant_bias;
74
75     DECLARE_ALIGNED(16, int16_t, blocks)[8][64];
76     DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[256];
77     DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][128];
78
79     int      (*qmatrix_c)     [64];
80     int      (*qmatrix_l)     [64];
81     uint16_t (*qmatrix_l16)[2][64];
82     uint16_t (*qmatrix_c16)[2][64];
83
84     unsigned frame_bits;
85     uint8_t *src[3];
86
87     uint32_t *vlc_codes;
88     uint8_t  *vlc_bits;
89     uint16_t *run_codes;
90     uint8_t  *run_bits;
91
92     /** Rate control */
93     unsigned slice_bits;
94     unsigned qscale;
95     unsigned lambda;
96
97     uint16_t *mb_bits;
98     uint8_t  *mb_qscale;
99
100     RCCMPEntry *mb_cmp;
101     RCCMPEntry *mb_cmp_tmp;
102     RCEntry    *mb_rc;
103
104     void (*get_pixels_8x4_sym)(int16_t *av_restrict /* align 16 */ block,
105                                const uint8_t *pixels, ptrdiff_t line_size);
106 } DNXHDEncContext;
107
108 void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx);
109
110 #endif /* AVCODEC_DNXHDENC_H */