OSDN Git Service

dnxhd: allow encoding with Avid Nitris compatibility.
[coroid/libav_saccubus.git] / 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 #include "libavcodec/mpegvideo.h"
29 #include "libavcodec/dnxhddata.h"
30
31 typedef struct {
32     uint16_t mb;
33     int value;
34 } RCCMPEntry;
35
36 typedef struct {
37     int ssd;
38     int bits;
39 } RCEntry;
40
41 typedef struct DNXHDEncContext {
42     MpegEncContext m; ///< Used for quantization dsp functions
43
44     AVFrame frame;
45     int cid;
46     const CIDEntry *cid_table;
47     uint8_t *msip; ///< Macroblock Scan Indexes Payload
48     uint32_t *slice_size;
49     uint32_t *slice_offs;
50
51     struct DNXHDEncContext *thread[MAX_THREADS];
52
53     unsigned dct_y_offset;
54     unsigned dct_uv_offset;
55     int interlaced;
56     int cur_field;
57
58     int nitris_compat;
59     unsigned min_padding;
60
61     DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64];
62
63     int      (*qmatrix_c)     [64];
64     int      (*qmatrix_l)     [64];
65     uint16_t (*qmatrix_l16)[2][64];
66     uint16_t (*qmatrix_c16)[2][64];
67
68     unsigned frame_bits;
69     uint8_t *src[3];
70
71     uint32_t *vlc_codes;
72     uint8_t  *vlc_bits;
73     uint16_t *run_codes;
74     uint8_t  *run_bits;
75
76     /** Rate control */
77     unsigned slice_bits;
78     unsigned qscale;
79     unsigned lambda;
80
81     unsigned thread_size;
82
83     uint16_t *mb_bits;
84     uint8_t  *mb_qscale;
85
86     RCCMPEntry *mb_cmp;
87     RCEntry   (*mb_rc)[8160];
88
89     void (*get_pixels_8x4_sym)(DCTELEM */*align 16*/, const uint8_t *, int);
90 } DNXHDEncContext;
91
92 void ff_dnxhd_init_mmx(DNXHDEncContext *ctx);
93
94 #endif /* AVCODEC_DNXHDENC_H */