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