FFmpeg
dnxhdenc.h
Go to the documentation of this file.
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 "libavutil/mem_internal.h"
30 
31 #include "mpegvideo.h"
32 #include "dnxhddata.h"
33 
34 typedef struct RCCMPEntry {
35  uint32_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  MpegEncContext m; ///< Used for quantization dsp functions
47 
48  int cid;
49  int profile;
50  int bit_depth;
51  int is_444;
53  uint8_t *msip; ///< Macroblock Scan Indexes Payload
54  uint32_t *slice_size;
55  uint32_t *slice_offs;
56 
58 
59  // Because our samples are either 8 or 16 bits for 8-bit and 10-bit
60  // encoding respectively, these refer either to bytes or to two-byte words.
61  unsigned dct_y_offset;
62  unsigned dct_uv_offset;
63  unsigned block_width_l2;
64 
68 
70  int cur_field;
71 
73  unsigned min_padding;
75 
76  DECLARE_ALIGNED(32, int16_t, blocks)[12][64];
77  DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[512]; // has to hold 16x16 uint16 when depth=10
78  DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][512]; // has to hold 16x16 uint16_t when depth=10
79 
80  int (*qmatrix_c) [64];
81  int (*qmatrix_l) [64];
82  uint16_t (*qmatrix_l16)[2][64];
83  uint16_t (*qmatrix_c16)[2][64];
84 
85  unsigned frame_bits;
86  const uint8_t *src[3];
87 
88  uint32_t *orig_vlc_codes;
89  uint8_t *orig_vlc_bits;
90  uint32_t *vlc_codes;
91  uint8_t *vlc_bits;
92  uint16_t *run_codes;
93  uint8_t *run_bits;
94 
95  /** Rate control */
96  unsigned slice_bits;
97  unsigned qscale;
98  unsigned lambda;
99 
100  uint32_t *mb_bits;
101  uint8_t *mb_qscale;
102 
106 
107  void (*get_pixels_8x4_sym)(int16_t *restrict /* align 16 */ block,
108  const uint8_t *pixels, ptrdiff_t line_size);
110 
113 
114 #endif /* AVCODEC_DNXHDENC_H */
DNXHDEncContext::vlc_codes
uint32_t * vlc_codes
Definition: dnxhdenc.h:90
DNXHDEncContext::cid
int cid
Definition: dnxhdenc.h:48
DNXHDEncContext::mb_rc
RCEntry * mb_rc
Definition: dnxhdenc.h:105
DNXHDEncContext::edge_buf_uv
uint8_t edge_buf_uv[2][512]
Definition: dnxhdenc.h:78
RCCMPEntry::mb
uint32_t mb
Definition: dnxhdenc.h:35
mem_internal.h
DNXHDEncContext::intra_quant_bias
int intra_quant_bias
Definition: dnxhdenc.h:74
RCEntry::bits
int bits
Definition: dnxhdenc.h:41
DNXHDEncContext::mb_cmp_tmp
RCCMPEntry * mb_cmp_tmp
Definition: dnxhdenc.h:104
DNXHDEncContext::thread
struct DNXHDEncContext * thread[MAX_THREADS]
Definition: dnxhdenc.h:57
mpegvideo.h
DNXHDEncContext::frame_size
int frame_size
Definition: dnxhdenc.h:65
DNXHDEncContext::is_444
int is_444
Definition: dnxhdenc.h:51
DNXHDEncContext::bit_depth
int bit_depth
Definition: dnxhdenc.h:50
DNXHDEncContext::qscale
unsigned qscale
Definition: dnxhdenc.h:97
DNXHDEncContext::qmatrix_c
int(* qmatrix_c)[64]
Definition: dnxhdenc.h:80
DNXHDEncContext::mb_qscale
uint8_t * mb_qscale
Definition: dnxhdenc.h:101
DNXHDEncContext::orig_vlc_bits
uint8_t * orig_vlc_bits
Definition: dnxhdenc.h:89
MAX_THREADS
#define MAX_THREADS
Definition: frame_thread_encoder.c:37
DNXHDEncContext
Definition: dnxhdenc.h:44
CIDEntry
Definition: dnxhddata.h:43
dnxhddata.h
DNXHDEncContext::mb_bits
uint32_t * mb_bits
Definition: dnxhdenc.h:100
ctx
AVFormatContext * ctx
Definition: movenc.c:49
DNXHDEncContext::dct_uv_offset
unsigned dct_uv_offset
Definition: dnxhdenc.h:62
DNXHDEncContext::run_codes
uint16_t * run_codes
Definition: dnxhdenc.h:92
DNXHDEncContext::msip
uint8_t * msip
Macroblock Scan Indexes Payload.
Definition: dnxhdenc.h:53
RCCMPEntry::value
int value
Definition: dnxhdenc.h:36
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
DNXHDEncContext::edge_buf_y
uint8_t edge_buf_y[512]
Definition: dnxhdenc.h:77
RCCMPEntry
Definition: dnxhdenc.h:34
DNXHDEncContext::data_offset
int data_offset
Definition: dnxhdenc.h:67
ff_dnxhdenc_init
void ff_dnxhdenc_init(DNXHDEncContext *ctx)
Definition: dnxhdenc.c:1377
DNXHDEncContext::frame_bits
unsigned frame_bits
Definition: dnxhdenc.h:85
DNXHDEncContext::slice_offs
uint32_t * slice_offs
Definition: dnxhdenc.h:55
DNXHDEncContext::interlaced
int interlaced
Definition: dnxhdenc.h:69
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
ff_dnxhdenc_init_x86
void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
Definition: dnxhdenc_init.c:31
DNXHDEncContext::mb_cmp
RCCMPEntry * mb_cmp
Definition: dnxhdenc.h:103
DNXHDEncContext::get_pixels_8x4_sym
void(* get_pixels_8x4_sym)(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t line_size)
Definition: dnxhdenc.h:107
DNXHDEncContext::slice_bits
unsigned slice_bits
Rate control.
Definition: dnxhdenc.h:96
DNXHDEncContext::nitris_compat
int nitris_compat
Definition: dnxhdenc.h:72
DNXHDEncContext::qmatrix_l16
uint16_t(* qmatrix_l16)[2][64]
Definition: dnxhdenc.h:82
DNXHDEncContext::lambda
unsigned lambda
Definition: dnxhdenc.h:98
DNXHDEncContext::cur_field
int cur_field
Definition: dnxhdenc.h:70
RCEntry
Definition: dnxhdenc.h:39
DNXHDEncContext::orig_vlc_codes
uint32_t * orig_vlc_codes
Definition: dnxhdenc.h:88
DNXHDEncContext::profile
int profile
Definition: dnxhdenc.h:49
DNXHDEncContext::blocks
int16_t blocks[12][64]
Definition: dnxhdenc.h:76
DNXHDEncContext::m
MpegEncContext m
Used for quantization dsp functions.
Definition: dnxhdenc.h:46
DNXHDEncContext::run_bits
uint8_t * run_bits
Definition: dnxhdenc.h:93
DNXHDEncContext::dct_y_offset
unsigned dct_y_offset
Definition: dnxhdenc.h:61
DNXHDEncContext::cid_table
const CIDEntry * cid_table
Definition: dnxhdenc.h:52
DNXHDEncContext::block_width_l2
unsigned block_width_l2
Definition: dnxhdenc.h:63
DNXHDEncContext::vlc_bits
uint8_t * vlc_bits
Definition: dnxhdenc.h:91
DNXHDEncContext::qmatrix_c16
uint16_t(* qmatrix_c16)[2][64]
Definition: dnxhdenc.h:83
DNXHDEncContext::min_padding
unsigned min_padding
Definition: dnxhdenc.h:73
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
DNXHDEncContext::coding_unit_size
int coding_unit_size
Definition: dnxhdenc.h:66
DNXHDEncContext::qmatrix_l
int(* qmatrix_l)[64]
Definition: dnxhdenc.h:81
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:73
DNXHDEncContext::src
const uint8_t * src[3]
Definition: dnxhdenc.h:86
RCEntry::ssd
int ssd
Definition: dnxhdenc.h:40
DNXHDEncContext::slice_size
uint32_t * slice_size
Definition: dnxhdenc.h:54