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