FFmpeg
mpegvideo.h
Go to the documentation of this file.
1 /*
2  * Generic DCT based hybrid video encoder
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * mpegvideo header.
26  */
27 
28 #ifndef AVCODEC_MPEGVIDEO_H
29 #define AVCODEC_MPEGVIDEO_H
30 
31 #include "blockdsp.h"
32 #include "error_resilience.h"
33 #include "h264chroma.h"
34 #include "h263dsp.h"
35 #include "hpeldsp.h"
36 #include "idctdsp.h"
37 #include "mpegpicture.h"
38 #include "qpeldsp.h"
39 #include "videodsp.h"
40 
41 #include "libavutil/mem_internal.h"
42 
43 #define MAX_THREADS 32
44 
45 /**
46  * Scantable.
47  */
48 typedef struct ScanTable {
49  const uint8_t *scantable;
50  uint8_t permutated[64];
51  uint8_t raster_end[64];
52 } ScanTable;
53 
60 };
61 
62 typedef struct MpegEncContext MPVContext;
63 
64 /**
65  * MpegEncContext.
66  */
67 typedef struct MpegEncContext {
68  AVClass *class;
69 
71  int ac_pred;
72  int block_last_index[12]; ///< last non zero coefficient in block
73  int h263_aic; ///< Advanced INTRA Coding (AIC)
74 
75  /* scantables */
76  ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce the cache usage
78 
79  /* WARNING: changes above this line require updates to hardcoded
80  * offsets used in ASM. */
81 
84 
86  /* The following pointer is intended for codecs sharing code
87  * between decoder and encoder and in need of a common context to do so. */
88  void *private_ctx;
89  /* the following parameters must be initialized before encoding */
90  int width, height;///< picture size. must be a multiple of 16
91  enum OutputFormat out_format; ///< output format
92  int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions
93 
94  enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
95  int encoding; ///< true if we are encoding (vs decoding)
96  int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically
97  int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag
98  /* the following fields are managed internally by the encoder */
99 
100  /* sequence parameters */
102  int mb_width, mb_height; ///< number of MBs horizontally & vertically
103  int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
104  int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
105  int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication)
106  int mb_num; ///< number of MBs of a picture
107  ptrdiff_t linesize; ///< line size, in bytes, may be different from width
108  ptrdiff_t uvlinesize; ///< line size, for chroma in bytes, may be different from width
109  struct AVRefStructPool *picture_pool; ///< Pool for MPVPictures
110 
112 
113  int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
114  int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
115  union {
119  };
120  int slice_context_count; ///< number of used thread_contexts
121 
122  /**
123  * copy of the previous picture structure.
124  * note, linesize & data, might not match the previous picture (for field pictures)
125  */
127 
128  /**
129  * copy of the next picture structure.
130  * note, linesize & data, might not match the next picture (for field pictures)
131  */
133 
134  /**
135  * copy of the current picture structure.
136  * note, linesize & data, might not match the current picture (for field pictures)
137  */
139 
140  int16_t *dc_val_base;
141  const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
142  const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table
143  const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (H.263)
145  uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
146  int16_t (*ac_val_base)[16];
147  int16_t *dc_val; ///< used for H.263 AIC/MPEG-4 DC prediction and ER
148  int16_t (*ac_val)[16]; ///< used for H.263 AIC, MPEG-4 AC prediction
149  int mb_skipped; ///< MUST BE SET only during DECODING
150  uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example)
151  and used for B-frame encoding & decoding (contains skip table of next P-frame) */
152  uint8_t *mbintra_table; ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
153  uint8_t *cbp_table; ///< used to store cbp, ac_pred for partitioned decoding
154  uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding
155 
157 
158  int qscale; ///< QP
159  int chroma_qscale; ///< chroma QP
160  enum AVPictureType pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
162 
170  int16_t (*p_field_mv_table_base)[2];
171  int16_t (*p_field_mv_table[2][2])[2]; ///< MV table (2MV per MB) interlaced P-frame encoding
172 
173  int mv_dir;
174 #define MV_DIR_FORWARD 1
175 #define MV_DIR_BACKWARD 2
176 #define MV_DIRECT 4 ///< bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4)
177  int mv_type;
178 #define MV_TYPE_16X16 0 ///< 1 vector for the whole mb
179 #define MV_TYPE_8X8 1 ///< 4 vectors (H.263, MPEG-4 4MV)
180 #define MV_TYPE_16X8 2 ///< 2 vectors, one per 16x8 block
181 #define MV_TYPE_FIELD 3 ///< 2 vectors, one per field
182 #define MV_TYPE_DMV 4 ///< 2 vectors, special mpeg2 Dual Prime Vectors
183  /**motion vectors for a macroblock
184  first coordinate : 0 = forward 1 = backward
185  second " : depend on type
186  third " : 0 = x, 1 = y
187  */
188  int mv[2][4][2];
189  int field_select[2][2];
190  int last_mv[2][2][2]; ///< last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
191  int16_t direct_scale_mv[2][64]; ///< precomputed to avoid divisions in ff_mpeg4_set_direct_mv
192 
193  int no_rounding; /**< apply no rounding to motion compensation (MPEG-4, msmpeg4, ...)
194  for B-frames rounding mode is always 0 */
195 
196  /* macroblock layer */
197  int mb_x, mb_y;
198  int mb_intra;
199 
200  int block_index[6]; ///< index to current MB in block based arrays with edges
201  int block_wrap[6];
202  uint8_t *dest[3];
203 
204  int *mb_index2xy; ///< mb_index -> mb_x + mb_y*mb_stride
205 
206  /** matrix transmitted in the bitstream */
207  DECLARE_ALIGNED(16, uint16_t, intra_matrix)[64];
209  DECLARE_ALIGNED(16, uint16_t, inter_matrix)[64];
211 
212  /* error concealment / resync */
213  int resync_mb_x; ///< x position of last resync marker
214  int resync_mb_y; ///< y position of last resync marker
215 
216  /* H.263 specific */
217  int obmc; ///< overlapped block motion compensation
218 
219  /* H.263+ specific */
220  int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top
221 
222  /* MPEG-4 specific */
225  int time_base; ///< time in seconds of last I,P,S Frame
226  int64_t time; ///< time of current frame
228  uint16_t pp_time; ///< time distance between the last 2 p,s,i frames
229  uint16_t pb_time; ///< time distance between the last b and p,s,i frame
230  uint16_t pp_field_time;
231  uint16_t pb_field_time; ///< like above, just for interlaced
232  int mcsel;
233  int quarter_sample; ///< 1->qpel, 0->half pel ME/MC
234  int low_delay; ///< no reordering needed / has no B-frames
235 
236  /* MSMPEG4 specific */
237  int first_slice_line; ///< used in MPEG-4 too to handle resync markers
238  enum {
245  MSMP4_VC1, ///< for VC1 (image), WMV3 (image) and MSS2.
246  } msmpeg4_version;
248  int mspel;
249 
250  /* MPEG-2-specific - I wished not to have to support this mess. */
252  int mpeg_f_code[2][2];
253 
254  // picture structure defines are loaded from mpegutils.h
256 
267 #define CHROMA_420 1
268 #define CHROMA_422 2
269 #define CHROMA_444 3
270  int chroma_x_shift;//depend on pix_format, that depend on chroma_format
272 
274  int full_pel[2];
276  int first_field; ///< is 1 for the first field of a field picture 0 otherwise
277 
278  void (*dct_unquantize_intra)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both)
279  int16_t *block/*align 16*/, int n, int qscale);
280  void (*dct_unquantize_inter)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both)
281  int16_t *block/*align 16*/, int n, int qscale);
282 
283  /* flag to indicate a reinitialization is required, e.g. after
284  * a frame size change */
286 
287  /// If set, ff_mpv_common_init() will allocate slice contexts of this size
288  unsigned slice_ctx_size;
289 
292 
293 /**
294  * Set the given MpegEncContext to common defaults (same for encoding
295  * and decoding). The changed fields will not depend upon the prior
296  * state of the MpegEncContext.
297  */
299 
301 /**
302  * Initialize an MpegEncContext's thread contexts. Presumes that
303  * slice_context_count is already set and that all the fields
304  * that are freed/reset in free_duplicate_context() are NULL.
305  */
307 /**
308  * Initialize and allocates MpegEncContext fields dependent on the resolution.
309  */
311 /**
312  * Frees and resets MpegEncContext fields depending on the resolution
313  * as well as the slice thread contexts.
314  * Is used during resolution changes to avoid a full reinitialization of the
315  * codec.
316  */
318 
320 
322 
324 void ff_set_qscale(MpegEncContext * s, int qscale);
325 
327 void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
328  const uint8_t *src_scantable);
330 
332  uint8_t *dest_y, uint8_t *dest_cb,
333  uint8_t *dest_cr, int dir,
334  uint8_t *const *ref_picture,
335  const op_pixels_func (*pix_op)[4],
336  const qpel_mc_func (*qpix_op)[16]);
337 
338 static inline void ff_update_block_index(MpegEncContext *s, int bits_per_raw_sample,
339  int lowres, int chroma_x_shift)
340 {
341  const int bytes_per_pixel = 1 + (bits_per_raw_sample > 8);
342  const int block_size = (8 * bytes_per_pixel) >> lowres;
343 
344  s->block_index[0]+=2;
345  s->block_index[1]+=2;
346  s->block_index[2]+=2;
347  s->block_index[3]+=2;
348  s->block_index[4]++;
349  s->block_index[5]++;
350  s->dest[0]+= 2*block_size;
351  s->dest[1] += (2 >> chroma_x_shift) * block_size;
352  s->dest[2] += (2 >> chroma_x_shift) * block_size;
353 }
354 
355 #endif /* AVCODEC_MPEGVIDEO_H */
MpegEncContext::hdsp
HpelDSPContext hdsp
Definition: mpegvideo.h:165
MpegEncContext::codec_tag
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
Definition: mpegvideo.h:97
MpegEncContext::mb_y
int mb_y
Definition: mpegvideo.h:197
MPVEncContext
Definition: mpegvideoenc.h:46
MpegEncContext::first_field
int first_field
is 1 for the first field of a field picture 0 otherwise
Definition: mpegvideo.h:276
blockdsp.h
MpegEncContext::buffer_pools
BufferPoolContext buffer_pools
Definition: mpegvideo.h:111
ff_mpv_motion
void ff_mpv_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t *const *ref_picture, const op_pixels_func(*pix_op)[4], const qpel_mc_func(*qpix_op)[16])
Definition: mpegvideo_motion.c:821
MpegEncContext::v_edge_pos
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
Definition: mpegvideo.h:105
mem_internal.h
MpegEncContext::dc_val
int16_t * dc_val
used for H.263 AIC/MPEG-4 DC prediction and ER
Definition: mpegvideo.h:147
MpegEncContext::next_pic
MPVWorkPicture next_pic
copy of the next picture structure.
Definition: mpegvideo.h:132
MpegEncContext::intra_matrix
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
Definition: mpegvideo.h:207
MpegEncContext::mpeg12_contexts
struct Mpeg12SliceContext * mpeg12_contexts[MAX_THREADS]
Definition: mpegvideo.h:117
MpegEncContext::chroma_qscale
int chroma_qscale
chroma QP
Definition: mpegvideo.h:159
AVPictureType
AVPictureType
Definition: avutil.h:276
int64_t
long long int64_t
Definition: coverity.c:34
MpegEncContext::dest
uint8_t * dest[3]
Definition: mpegvideo.h:202
MpegEncContext::MSMP4_UNUSED
@ MSMP4_UNUSED
Definition: mpegvideo.h:239
MpegEncContext::pict_type
enum AVPictureType pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:160
h263dsp.h
MpegEncContext::pb_field_time
uint16_t pb_field_time
like above, just for interlaced
Definition: mpegvideo.h:231
MpegEncContext::mb_skipped
int mb_skipped
MUST BE SET only during DECODING.
Definition: mpegvideo.h:149
ERContext
Definition: error_resilience.h:54
MpegEncContext::MSMP4_V3
@ MSMP4_V3
Definition: mpegvideo.h:242
MpegEncContext::h263_aic
int h263_aic
Advanced INTRA Coding (AIC)
Definition: mpegvideo.h:73
MpegEncContext::b8_stride
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
Definition: mpegvideo.h:104
MpegEncContext::vdsp
VideoDSPContext vdsp
Definition: mpegvideo.h:168
MpegEncContext::chroma_qscale_table
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (H.263)
Definition: mpegvideo.h:143
FMT_H261
@ FMT_H261
Definition: mpegvideo.h:56
BlockDSPContext
Definition: blockdsp.h:32
MpegEncContext::time
int64_t time
time of current frame
Definition: mpegvideo.h:226
ScratchpadContext
Definition: mpegpicture.h:34
MpegEncContext::mbskip_table
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encodin...
Definition: mpegvideo.h:150
MpegEncContext::last_non_b_time
int64_t last_non_b_time
Definition: mpegvideo.h:227
FMT_MJPEG
@ FMT_MJPEG
Definition: mpegvideo.h:58
FMT_MPEG1
@ FMT_MPEG1
Definition: mpegvideo.h:55
MpegEncContext::pp_time
uint16_t pp_time
time distance between the last 2 p,s,i frames
Definition: mpegvideo.h:228
MpegEncContext::enc_contexts
struct MPVEncContext * enc_contexts[MAX_THREADS]
Definition: mpegvideo.h:118
FMT_SPEEDHQ
@ FMT_SPEEDHQ
Definition: mpegvideo.h:59
MpegEncContext::progressive_frame
int progressive_frame
Definition: mpegvideo.h:273
ff_init_scantable
void ff_init_scantable(const uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
Definition: mpegvideo_unquantize.c:36
MpegEncContext::uvlinesize
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
Definition: mpegvideo.h:108
MpegEncContext::context_reinit
int context_reinit
Definition: mpegvideo.h:285
MpegEncContext::h263_aic_dir
int h263_aic_dir
AIC direction: 0 = left, 1 = top.
Definition: mpegvideo.h:220
ff_mpv_idct_init
void ff_mpv_idct_init(MpegEncContext *s)
Definition: mpegvideo.c:81
MpegEncContext::chroma_y_shift
int chroma_y_shift
Definition: mpegvideo.h:271
MpegEncContext::time_base
int time_base
time in seconds of last I,P,S Frame
Definition: mpegvideo.h:225
MpegEncContext::h264chroma
H264ChromaContext h264chroma
Definition: mpegvideo.h:164
MpegEncContext::slice_context_count
int slice_context_count
number of used thread_contexts
Definition: mpegvideo.h:120
H263DSPContext
Definition: h263dsp.h:26
MpegEncContext::qdsp
QpelDSPContext qdsp
Definition: mpegvideo.h:167
MpegEncContext::repeat_first_field
int repeat_first_field
Definition: mpegvideo.h:264
MpegEncContext::cur_pic
MPVWorkPicture cur_pic
copy of the current picture structure.
Definition: mpegvideo.h:138
ff_set_qscale
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
Definition: mpegvideo.c:509
MpegEncContext::slice_ctx_size
unsigned slice_ctx_size
If set, ff_mpv_common_init() will allocate slice contexts of this size.
Definition: mpegvideo.h:288
MpegEncContext::resync_mb_y
int resync_mb_y
y position of last resync marker
Definition: mpegvideo.h:214
s
#define s(width, name)
Definition: cbs_vp9.c:198
MpegEncContext::chroma_420_type
int chroma_420_type
Definition: mpegvideo.h:265
ff_mpv_common_defaults
void ff_mpv_common_defaults(MpegEncContext *s)
Set the given MpegEncContext to common defaults (same for encoding and decoding).
Definition: mpegvideo.c:175
MpegEncContext::coded_block_base
uint8_t * coded_block_base
Definition: mpegvideo.h:144
MpegEncContext::y_dc_scale_table
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
Definition: mpegvideo.h:141
MpegEncContext::mb_num
int mb_num
number of MBs of a picture
Definition: mpegvideo.h:106
MpegEncContext::picture_pool
struct AVRefStructPool * picture_pool
Pool for MPVPictures.
Definition: mpegvideo.h:109
MpegEncContext::start_mb_y
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
Definition: mpegvideo.h:113
MpegEncContext::c_dc_scale_table
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
Definition: mpegvideo.h:142
AVRefStructPool
AVRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
Definition: refstruct.c:183
ScanTable::scantable
const uint8_t * scantable
Definition: mpegvideo.h:49
MpegEncContext::mbintra_table
uint8_t * mbintra_table
used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
Definition: mpegvideo.h:152
MpegEncContext::p_field_mv_table
int16_t(*[2][2] p_field_mv_table)[2]
MV table (2MV per MB) interlaced P-frame encoding.
Definition: mpegvideo.h:171
MpegEncContext::mcsel
int mcsel
Definition: mpegvideo.h:232
FMT_H263
@ FMT_H263
Definition: mpegvideo.h:57
Mpeg12SliceContext
Definition: mpeg12dec.c:72
MpegEncContext::mpeg_f_code
int mpeg_f_code[2][2]
Definition: mpegvideo.h:252
MpegEncContext::pred_dir_table
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
Definition: mpegvideo.h:154
MpegEncContext::mb_index2xy
int * mb_index2xy
mb_index -> mb_x + mb_y*mb_stride
Definition: mpegvideo.h:204
MpegEncContext::inter_matrix
uint16_t inter_matrix[64]
Definition: mpegvideo.h:209
MpegEncContext::qscale
int qscale
QP.
Definition: mpegvideo.h:158
MpegEncContext::block_wrap
int block_wrap[6]
Definition: mpegvideo.h:201
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
MpegEncContext::direct_scale_mv
int16_t direct_scale_mv[2][64]
precomputed to avoid divisions in ff_mpeg4_set_direct_mv
Definition: mpegvideo.h:191
MpegEncContext::msmpeg4_version
enum MpegEncContext::@211 msmpeg4_version
ff_mpv_common_end
void ff_mpv_common_end(MpegEncContext *s)
Definition: mpegvideo.c:432
MpegEncContext::top_field_first
int top_field_first
Definition: mpegvideo.h:259
MpegEncContext::MSMP4_VC1
@ MSMP4_VC1
for VC1 (image), WMV3 (image) and MSS2.
Definition: mpegvideo.h:245
MpegEncContext::pb_time
uint16_t pb_time
time distance between the last b and p,s,i frame
Definition: mpegvideo.h:229
MpegEncContext::encoding
int encoding
true if we are encoding (vs decoding)
Definition: mpegvideo.h:95
OutputFormat
OutputFormat
Definition: mpegvideo.h:54
MpegEncContext::frame_pred_frame_dct
int frame_pred_frame_dct
Definition: mpegvideo.h:258
MpegEncContext::permutated_intra_h_scantable
uint8_t permutated_intra_h_scantable[64]
Definition: mpegvideo.h:82
lowres
static int lowres
Definition: ffplay.c:330
qpeldsp.h
MpegEncContext::ac_val
int16_t(* ac_val)[16]
used for H.263 AIC, MPEG-4 AC prediction
Definition: mpegvideo.h:148
MpegEncContext::pp_field_time
uint16_t pp_field_time
Definition: mpegvideo.h:230
MpegEncContext::mb_width
int mb_width
Definition: mpegvideo.h:102
MpegEncContext::dct_unquantize_intra
void(* dct_unquantize_intra)(const MPVContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:278
op_pixels_func
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Average and put pixel Widths can be 16, 8, 4 or 2.
Definition: hpeldsp.h:39
MpegEncContext::mb_intra
int mb_intra
Definition: mpegvideo.h:198
qpel_mc_func
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: qpeldsp.h:65
MpegEncContext::permutated_intra_v_scantable
uint8_t permutated_intra_v_scantable[64]
Definition: mpegvideo.h:83
MpegEncContext::concealment_motion_vectors
int concealment_motion_vectors
Definition: mpegvideo.h:260
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
MpegEncContext::thread_context
struct MpegEncContext * thread_context[MAX_THREADS]
Definition: mpegvideo.h:116
HpelDSPContext
Half-pel DSP context.
Definition: hpeldsp.h:46
MpegEncContext::intra_scantable
ScanTable intra_scantable
Definition: mpegvideo.h:77
MpegEncContext::picture_structure
int picture_structure
Definition: mpegvideo.h:255
ff_mpv_init_duplicate_contexts
int ff_mpv_init_duplicate_contexts(MpegEncContext *s)
Initialize an MpegEncContext's thread contexts.
Definition: mpegvideo.c:103
MpegEncContext::quarter_sample
int quarter_sample
1->qpel, 0->half pel ME/MC
Definition: mpegvideo.h:233
MpegEncContext::last_pic
MPVWorkPicture last_pic
copy of the previous picture structure.
Definition: mpegvideo.h:126
MpegEncContext::c_dc_scale
int c_dc_scale
Definition: mpegvideo.h:70
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
ff_update_block_index
static void ff_update_block_index(MpegEncContext *s, int bits_per_raw_sample, int lowres, int chroma_x_shift)
Definition: mpegvideo.h:338
MpegEncContext::context_initialized
int context_initialized
Definition: mpegvideo.h:101
MpegEncContext::mb_stride
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
Definition: mpegvideo.h:103
MpegEncContext::alternate_scan
int alternate_scan
Definition: mpegvideo.h:263
h264chroma.h
MpegEncContext::field_select
int field_select[2][2]
Definition: mpegvideo.h:189
MAX_THREADS
#define MAX_THREADS
Definition: mpegvideo.h:43
MpegEncContext::avctx
struct AVCodecContext * avctx
Definition: mpegvideo.h:85
MpegEncContext::workaround_bugs
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
Definition: mpegvideo.h:96
MpegEncContext::ac_val_base
int16_t(* ac_val_base)[16]
Definition: mpegvideo.h:146
mpegpicture.h
MpegEncContext::last_time_base
int last_time_base
Definition: mpegvideo.h:224
ff_mpv_init_context_frame
int ff_mpv_init_context_frame(MpegEncContext *s)
Initialize and allocates MpegEncContext fields dependent on the resolution.
Definition: mpegvideo.c:195
MpegEncContext::bdsp
BlockDSPContext bdsp
Definition: mpegvideo.h:163
MpegEncContext::p_field_mv_table_base
int16_t(* p_field_mv_table_base)[2]
Definition: mpegvideo.h:170
MpegEncContext::private_ctx
void * private_ctx
Definition: mpegvideo.h:88
MpegEncContext::dct_unquantize_inter
void(* dct_unquantize_inter)(const MPVContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:280
ff_mpv_common_init
int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
Definition: mpegvideo.c:363
ff_init_block_index
void ff_init_block_index(MpegEncContext *s)
Definition: mpegvideo.c:476
MpegEncContext::chroma_intra_matrix
uint16_t chroma_intra_matrix[64]
Definition: mpegvideo.h:208
MpegEncContext::idsp
IDCTDSPContext idsp
Definition: mpegvideo.h:166
MpegEncContext::h_edge_pos
int h_edge_pos
Definition: mpegvideo.h:105
MpegEncContext::q_scale_type
int q_scale_type
Definition: mpegvideo.h:261
ff_update_duplicate_context
int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src)
Definition: mpegvideo.c:143
MpegEncContext::mv
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
Definition: mpegvideo.h:188
MpegEncContext::MSMP4_V2
@ MSMP4_V2
Definition: mpegvideo.h:241
MpegEncContext::intra_vlc_format
int intra_vlc_format
Definition: mpegvideo.h:262
MpegEncContext::MSMP4_V1
@ MSMP4_V1
Definition: mpegvideo.h:240
idctdsp.h
MpegEncContext::intra_dc_precision
int intra_dc_precision
Definition: mpegvideo.h:257
ff_clean_intra_table_entries
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac for the current non-intra MB.
Definition: mpegvideo.c:451
MpegEncContext::y_dc_scale
int y_dc_scale
Definition: mpegvideo.h:70
MpegEncContext::mspel
int mspel
Definition: mpegvideo.h:248
MpegEncContext::block_last_index
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:72
MpegEncContext::mv_dir
int mv_dir
Definition: mpegvideo.h:173
MpegEncContext::interlaced_dct
int interlaced_dct
Definition: mpegvideo.h:275
IDCTDSPContext
Definition: idctdsp.h:43
MpegEncContext::no_rounding
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
Definition: mpegvideo.h:193
MpegEncContext::studio_profile
int studio_profile
Definition: mpegvideo.h:223
MpegEncContext::h263_pred
int h263_pred
use MPEG-4/H.263 ac/dc predictions
Definition: mpegvideo.h:92
QpelDSPContext
quarterpel DSP context
Definition: qpeldsp.h:72
AVCodecContext
main external API structure.
Definition: avcodec.h:439
MpegEncContext::inter_intra_pred
int inter_intra_pred
Definition: mpegvideo.h:247
MpegEncContext::last_mv
int last_mv[2][2][2]
last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
Definition: mpegvideo.h:190
error_resilience.h
MpegEncContext::end_mb_y
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
Definition: mpegvideo.h:114
MpegEncContext::height
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:90
MpegEncContext::er
ERContext er
Definition: mpegvideo.h:290
VideoDSPContext
Definition: videodsp.h:40
MpegEncContext::cbp_table
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
Definition: mpegvideo.h:153
MpegEncContext::block_index
int block_index[6]
index to current MB in block based arrays with edges
Definition: mpegvideo.h:200
MpegEncContext::obmc
int obmc
overlapped block motion compensation
Definition: mpegvideo.h:217
MpegEncContext::codec_id
enum AVCodecID codec_id
Definition: mpegvideo.h:94
MpegEncContext::h263dsp
H263DSPContext h263dsp
Definition: mpegvideo.h:169
MPVWorkPicture
Definition: mpegpicture.h:95
MpegEncContext::chroma_x_shift
int chroma_x_shift
Definition: mpegvideo.h:270
ScanTable
Scantable.
Definition: mpegvideo.h:48
H264ChromaContext
Definition: h264chroma.h:27
ScanTable::permutated
uint8_t permutated[64]
Definition: mpegvideo.h:50
MpegEncContext::mb_x
int mb_x
Definition: mpegvideo.h:197
MpegEncContext::progressive_sequence
int progressive_sequence
Definition: mpegvideo.h:251
videodsp.h
hpeldsp.h
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
ff_mpv_free_context_frame
void ff_mpv_free_context_frame(MpegEncContext *s)
Frees and resets MpegEncContext fields depending on the resolution as well as the slice thread contex...
Definition: mpegvideo.c:406
BufferPoolContext
Definition: mpegpicture.h:44
MpegEncContext::ac_pred
int ac_pred
Definition: mpegvideo.h:71
MpegEncContext::chroma_inter_matrix
uint16_t chroma_inter_matrix[64]
Definition: mpegvideo.h:210
MpegEncContext::out_format
enum OutputFormat out_format
output format
Definition: mpegvideo.h:91
MpegEncContext::sc
ScratchpadContext sc
Definition: mpegvideo.h:156
MpegEncContext::low_delay
int low_delay
no reordering needed / has no B-frames
Definition: mpegvideo.h:234
MpegEncContext::resync_mb_x
int resync_mb_x
x position of last resync marker
Definition: mpegvideo.h:213
MpegEncContext::chroma_format
int chroma_format
Definition: mpegvideo.h:266
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:67
MpegEncContext::MSMP4_WMV2
@ MSMP4_WMV2
Definition: mpegvideo.h:244
MpegEncContext::width
int width
Definition: mpegvideo.h:90
MpegEncContext::MSMP4_WMV1
@ MSMP4_WMV1
Definition: mpegvideo.h:243
MpegEncContext::full_pel
int full_pel[2]
Definition: mpegvideo.h:274
src
#define src
Definition: vp8dsp.c:248
MpegEncContext::coded_block
uint8_t * coded_block
used for coded block pattern prediction (msmpeg4v3, wmv1)
Definition: mpegvideo.h:145
MpegEncContext::linesize
ptrdiff_t linesize
line size, in bytes, may be different from width
Definition: mpegvideo.h:107
MpegEncContext::inter_scantable
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
Definition: mpegvideo.h:76
ScanTable::raster_end
uint8_t raster_end[64]
Definition: mpegvideo.h:51
MpegEncContext::first_slice_line
int first_slice_line
used in MPEG-4 too to handle resync markers
Definition: mpegvideo.h:237
MpegEncContext::dc_val_base
int16_t * dc_val_base
Definition: mpegvideo.h:140
MpegEncContext::mb_height
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:102
MpegEncContext::droppable
int droppable
Definition: mpegvideo.h:161