FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 "get_bits.h"
34 #include "h264chroma.h"
35 #include "h263dsp.h"
36 #include "hpeldsp.h"
37 #include "idctdsp.h"
38 #include "mpegpicture.h"
39 #include "qpeldsp.h"
40 #include "videodsp.h"
41 
42 #define MAX_THREADS 32
43 
44 /**
45  * Scantable.
46  */
47 typedef struct ScanTable {
48  const uint8_t *scantable;
49  uint8_t permutated[64];
50  uint8_t raster_end[64];
51 } ScanTable;
52 
59 };
60 
61 /**
62  * MpegEncContext.
63  */
64 typedef struct MpegEncContext {
65  AVClass *class;
66 
68  int ac_pred;
69  int block_last_index[12]; ///< last non zero coefficient in block
70  int h263_aic; ///< Advanced INTRA Coding (AIC)
71 
72  /* scantables */
73  ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce the cache usage
74 
75  /* WARNING: changes above this line require updates to hardcoded
76  * offsets used in ASM. */
77 
81 
83  union {
84  const struct MpegEncContext *parent;
86  };
87  /* The following pointer is intended for codecs sharing code
88  * between decoder and encoder and in need of a common context to do so. */
89  void *private_ctx;
90  /* the following parameters must be initialized before encoding */
91  int width, height;///< picture size. must be a multiple of 16
92  enum OutputFormat out_format; ///< output format
93  int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions
94  int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
95 
96 /* the following codec id fields are deprecated in favor of codec_id */
97  int h263_plus; ///< H.263+ headers
98  int h263_flv; ///< use flv H.263 header
99 
100  enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
101  int encoding; ///< true if we are encoding (vs decoding)
102  int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically
103  int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag
104  /* the following fields are managed internally by the encoder */
105 
106  /* sequence parameters */
108  int picture_number; //FIXME remove, unclear definition
109  int mb_width, mb_height; ///< number of MBs horizontally & vertically
110  int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
111  int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
112  int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication)
113  int mb_num; ///< number of MBs of a picture
114  ptrdiff_t linesize; ///< line size, in bytes, may be different from width
115  ptrdiff_t uvlinesize; ///< line size, for chroma in bytes, may be different from width
116  struct AVRefStructPool *picture_pool; ///< Pool for MPVPictures
117 
119 
120  int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
121  int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
122  union {
125  };
126  int slice_context_count; ///< number of used thread_contexts
127 
128  /**
129  * copy of the previous picture structure.
130  * note, linesize & data, might not match the previous picture (for field pictures)
131  */
133 
134  /**
135  * copy of the next picture structure.
136  * note, linesize & data, might not match the next picture (for field pictures)
137  */
139 
140  /**
141  * copy of the current picture structure.
142  * note, linesize & data, might not match the current picture (for field pictures)
143  */
145 
147  int last_dc[3]; ///< last DC values for MPEG-1
148  int16_t *dc_val_base;
149  int16_t *dc_val[3]; ///< used for MPEG-4 DC prediction, all 3 arrays must be continuous
150  const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
151  const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table
152  const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (H.263)
154  uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
155  int16_t (*ac_val_base)[16];
156  int16_t (*ac_val[3])[16]; ///< used for MPEG-4 AC prediction, all 3 arrays must be continuous
157  int mb_skipped; ///< MUST BE SET only during DECODING
158  uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example)
159  and used for B-frame encoding & decoding (contains skip table of next P-frame) */
160  uint8_t *mbintra_table; ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
161  uint8_t *cbp_table; ///< used to store cbp, ac_pred for partitioned decoding
162  uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding
163 
165 
166  int qscale; ///< QP
167  int chroma_qscale; ///< chroma QP
168  int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
170 
171  /* motion compensation */
172  int unrestricted_mv; ///< mv can point outside of the coded picture
173  int h263_long_vectors; ///< use horrible H.263v1 long vector mode
174 
182  int f_code; ///< forward MV resolution
183  int b_code; ///< backward MV resolution for B-frames (MPEG-4)
184  int16_t (*p_field_mv_table_base)[2];
185  int16_t (*p_field_mv_table[2][2])[2]; ///< MV table (2MV per MB) interlaced P-frame encoding
186 
187  int mv_dir;
188 #define MV_DIR_FORWARD 1
189 #define MV_DIR_BACKWARD 2
190 #define MV_DIRECT 4 ///< bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4)
191  int mv_type;
192 #define MV_TYPE_16X16 0 ///< 1 vector for the whole mb
193 #define MV_TYPE_8X8 1 ///< 4 vectors (H.263, MPEG-4 4MV)
194 #define MV_TYPE_16X8 2 ///< 2 vectors, one per 16x8 block
195 #define MV_TYPE_FIELD 3 ///< 2 vectors, one per field
196 #define MV_TYPE_DMV 4 ///< 2 vectors, special mpeg2 Dual Prime Vectors
197  /**motion vectors for a macroblock
198  first coordinate : 0 = forward 1 = backward
199  second " : depend on type
200  third " : 0 = x, 1 = y
201  */
202  int mv[2][4][2];
203  int field_select[2][2];
204  int last_mv[2][2][2]; ///< last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
205  int16_t direct_scale_mv[2][64]; ///< precomputed to avoid divisions in ff_mpeg4_set_direct_mv
206 
207  int no_rounding; /**< apply no rounding to motion compensation (MPEG-4, msmpeg4, ...)
208  for B-frames rounding mode is always 0 */
209 
210  /* macroblock layer */
211  int mb_x, mb_y;
213  int mb_intra;
214 
215  int block_index[6]; ///< index to current MB in block based arrays with edges
216  int block_wrap[6];
217  uint8_t *dest[3];
218 
219  int *mb_index2xy; ///< mb_index -> mb_x + mb_y*mb_stride
220 
221  /** matrix transmitted in the bitstream */
222  uint16_t intra_matrix[64];
223  uint16_t chroma_intra_matrix[64];
224  uint16_t inter_matrix[64];
225  uint16_t chroma_inter_matrix[64];
226 
227  /* error concealment / resync */
228  int resync_mb_x; ///< x position of last resync marker
229  int resync_mb_y; ///< y position of last resync marker
230  GetBitContext last_resync_gb; ///< used to search for the next resync marker
231  int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only)
232 
233  /* H.263 specific */
235  int obmc; ///< overlapped block motion compensation
236  int ehc_mode;
237 
238  /* H.263+ specific */
239  int umvplus; ///< == H.263+ && unrestricted_mv
240  int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top
242  int alt_inter_vlc; ///< alternative inter vlc
246 
247  /* MPEG-4 specific */
251  int time_base; ///< time in seconds of last I,P,S Frame
252  int64_t time; ///< time of current frame
254  uint16_t pp_time; ///< time distance between the last 2 p,s,i frames
255  uint16_t pb_time; ///< time distance between the last b and p,s,i frame
256  uint16_t pp_field_time;
257  uint16_t pb_field_time; ///< like above, just for interlaced
258  int mcsel;
259  int quarter_sample; ///< 1->qpel, 0->half pel ME/MC
260  int data_partitioning; ///< data partitioning flag from header
261  int partitioned_frame; ///< is current frame partitioned
262  int low_delay; ///< no reordering needed / has no B-frames
264  int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
265 
266  /* divx specific, used to workaround (many) bugs in divx5 */
268 
269  /* RV10 specific */
270  int rv10_version; ///< RV10 version: 0 or 3
272 
273  /* MSMPEG4 specific */
274  int slice_height; ///< in macroblocks
275  int first_slice_line; ///< used in MPEG-4 too to handle resync markers
277  enum {
284  MSMP4_VC1, ///< for VC1 (image), WMV3 (image) and MSS2.
285  } msmpeg4_version;
287  int mspel;
288 
289  /* decompression specific */
291 
292  /* MPEG-2-specific - I wished not to have to support this mess. */
294  int mpeg_f_code[2][2];
295 
296  // picture structure defines are loaded from mpegutils.h
298 
309 #define CHROMA_420 1
310 #define CHROMA_422 2
311 #define CHROMA_444 3
312  int chroma_x_shift;//depend on pix_format, that depend on chroma_format
314 
316  int full_pel[2];
318  int first_field; ///< is 1 for the first field of a field picture 0 otherwise
319 
320  int16_t (*block)[64]; ///< points to one of the following blocks
321  int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block
322  int (*decode_mb)(struct MpegEncContext *s, int16_t block[12][64]); // used by some codecs to avoid a switch()
323 
324 #define SLICE_OK 0
325 #define SLICE_ERROR -1
326 #define SLICE_END -2 ///<end marker found
327 #define SLICE_NOEND -3 ///<no end marker or error found but mb count exceeded
328 
329  void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (MPEG-4 can use both)
330  int16_t *block/*align 16*/, int n, int qscale);
331  void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (MPEG-4 can use both)
332  int16_t *block/*align 16*/, int n, int qscale);
333 
334  /* flag to indicate a reinitialization is required, e.g. after
335  * a frame size change */
337 
338  /// If set, ff_mpv_common_init() will allocate slice contexts of this size
339  unsigned slice_ctx_size;
340 
343 
344 
345 /**
346  * Set the given MpegEncContext to common defaults (same for encoding
347  * and decoding). The changed fields will not depend upon the prior
348  * state of the MpegEncContext.
349  */
351 
353 /**
354  * Initialize an MpegEncContext's thread contexts. Presumes that
355  * slice_context_count is already set and that all the fields
356  * that are freed/reset in free_duplicate_context() are NULL.
357  */
359 /**
360  * Initialize and allocates MpegEncContext fields dependent on the resolution.
361  */
363 /**
364  * Frees and resets MpegEncContext fields depending on the resolution
365  * as well as the slice thread contexts.
366  * Is used during resolution changes to avoid a full reinitialization of the
367  * codec.
368  */
370 
372 
374 
376 void ff_set_qscale(MpegEncContext * s, int qscale);
377 
379 void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
380  const uint8_t *src_scantable);
382 
384  uint8_t *dest_y, uint8_t *dest_cb,
385  uint8_t *dest_cr, int dir,
386  uint8_t *const *ref_picture,
387  const op_pixels_func (*pix_op)[4],
388  const qpel_mc_func (*qpix_op)[16]);
389 
390 static inline void ff_update_block_index(MpegEncContext *s, int bits_per_raw_sample,
391  int lowres, int chroma_x_shift)
392 {
393  const int bytes_per_pixel = 1 + (bits_per_raw_sample > 8);
394  const int block_size = (8 * bytes_per_pixel) >> lowres;
395 
396  s->block_index[0]+=2;
397  s->block_index[1]+=2;
398  s->block_index[2]+=2;
399  s->block_index[3]+=2;
400  s->block_index[4]++;
401  s->block_index[5]++;
402  s->dest[0]+= 2*block_size;
403  s->dest[1] += (2 >> chroma_x_shift) * block_size;
404  s->dest[2] += (2 >> chroma_x_shift) * block_size;
405 }
406 
407 #endif /* AVCODEC_MPEGVIDEO_H */
MpegEncContext::h264chroma
H264ChromaContext h264chroma
Definition: mpegvideo.h:176
MpegEncContext::mb_skipped
int mb_skipped
MUST BE SET only during DECODING.
Definition: mpegvideo.h:157
MpegEncContext::h263_flv
int h263_flv
use flv H.263 header
Definition: mpegvideo.h:98
MpegEncContext::progressive_sequence
int progressive_sequence
Definition: mpegvideo.h:293
MpegEncContext::data_partitioning
int data_partitioning
data partitioning flag from header
Definition: mpegvideo.h:260
MPVEncContext
Definition: mpegvideoenc.h:45
blockdsp.h
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:820
MpegEncContext::parent
const struct MpegEncContext * parent
Definition: mpegvideo.h:84
MpegEncContext::b_code
int b_code
backward MV resolution for B-frames (MPEG-4)
Definition: mpegvideo.h:183
MpegEncContext::gb
GetBitContext gb
Definition: mpegvideo.h:290
MpegEncContext::inter_intra_pred
int inter_intra_pred
Definition: mpegvideo.h:286
MpegEncContext::top_field_first
int top_field_first
Definition: mpegvideo.h:301
MpegEncContext::pp_time
uint16_t pp_time
time distance between the last 2 p,s,i frames
Definition: mpegvideo.h:254
MpegEncContext::block_index
int block_index[6]
index to current MB in block based arrays with edges
Definition: mpegvideo.h:215
int64_t
long long int64_t
Definition: coverity.c:34
MpegEncContext::slice_height
int slice_height
in macroblocks
Definition: mpegvideo.h:274
MpegEncContext::partitioned_frame
int partitioned_frame
is current frame partitioned
Definition: mpegvideo.h:261
MpegEncContext::y_dc_scale
int y_dc_scale
Definition: mpegvideo.h:67
MpegEncContext::mb_num
int mb_num
number of MBs of a picture
Definition: mpegvideo.h:113
MpegEncContext::ac_val_base
int16_t(* ac_val_base)[16]
Definition: mpegvideo.h:155
MpegEncContext::workaround_bugs
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
Definition: mpegvideo.h:102
MpegEncContext::h263dsp
H263DSPContext h263dsp
Definition: mpegvideo.h:181
MpegEncContext::mb_width
int mb_width
Definition: mpegvideo.h:109
h263dsp.h
MpegEncContext::last_dc
int last_dc[3]
last DC values for MPEG-1
Definition: mpegvideo.h:147
MpegEncContext::chroma_qscale
int chroma_qscale
chroma QP
Definition: mpegvideo.h:167
MpegEncContext::repeat_first_field
int repeat_first_field
Definition: mpegvideo.h:306
MpegEncContext::ac_val
int16_t(*[3] ac_val)[16]
used for MPEG-4 AC prediction, all 3 arrays must be continuous
Definition: mpegvideo.h:156
MpegEncContext::gob_index
int gob_index
Definition: mpegvideo.h:234
ERContext
Definition: error_resilience.h:54
MpegEncContext::unrestricted_mv
int unrestricted_mv
mv can point outside of the coded picture
Definition: mpegvideo.h:172
MpegEncContext::dest
uint8_t * dest[3]
Definition: mpegvideo.h:217
MpegEncContext::avctx
struct AVCodecContext * avctx
Definition: mpegvideo.h:82
MpegEncContext::last_non_b_time
int64_t last_non_b_time
Definition: mpegvideo.h:253
MpegEncContext::mcsel
int mcsel
Definition: mpegvideo.h:258
MpegEncContext::enc_contexts
struct MPVEncContext * enc_contexts[MAX_THREADS]
Definition: mpegvideo.h:124
FMT_H261
@ FMT_H261
Definition: mpegvideo.h:55
MpegEncContext::mb_num_left
int mb_num_left
number of MBs left in this video packet (for partitioned Slices only)
Definition: mpegvideo.h:231
BlockDSPContext
Definition: blockdsp.h:32
MpegEncContext::height
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:91
MpegEncContext::MSMP4_WMV2
@ MSMP4_WMV2
Definition: mpegvideo.h:283
MpegEncContext::last_resync_gb
GetBitContext last_resync_gb
used to search for the next resync marker
Definition: mpegvideo.h:230
MpegEncContext::mv
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
Definition: mpegvideo.h:202
ScratchpadContext
Definition: mpegpicture.h:34
MpegEncContext::out_format
enum OutputFormat out_format
output format
Definition: mpegvideo.h:92
MpegEncContext::time_base
int time_base
time in seconds of last I,P,S Frame
Definition: mpegvideo.h:251
MpegEncContext::mpeg_f_code
int mpeg_f_code[2][2]
Definition: mpegvideo.h:294
MpegEncContext::intra_scantable
ScanTable intra_scantable
Definition: mpegvideo.h:78
FMT_MJPEG
@ FMT_MJPEG
Definition: mpegvideo.h:57
MpegEncContext::mb_height
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:109
MpegEncContext::permutated_intra_v_scantable
uint8_t permutated_intra_v_scantable[64]
Definition: mpegvideo.h:80
MpegEncContext::pict_type
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:168
MpegEncContext::h263_pred
int h263_pred
use MPEG-4/H.263 ac/dc predictions
Definition: mpegvideo.h:93
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:160
FMT_MPEG1
@ FMT_MPEG1
Definition: mpegvideo.h:54
MpegEncContext::MSMP4_WMV1
@ MSMP4_WMV1
Definition: mpegvideo.h:282
MpegEncContext::chroma_y_shift
int chroma_y_shift
Definition: mpegvideo.h:313
MpegEncContext::picture_structure
int picture_structure
Definition: mpegvideo.h:297
FMT_SPEEDHQ
@ FMT_SPEEDHQ
Definition: mpegvideo.h:58
MpegEncContext::vdsp
VideoDSPContext vdsp
Definition: mpegvideo.h:180
MpegEncContext::padding_bug_score
int padding_bug_score
used to detect the VERY common padding bug in MPEG-4
Definition: mpegvideo.h:264
ff_init_scantable
void ff_init_scantable(const uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
Definition: mpegvideo.c:81
GetBitContext
Definition: get_bits.h:108
MpegEncContext::linesize
ptrdiff_t linesize
line size, in bytes, may be different from width
Definition: mpegvideo.h:114
MpegEncContext::bdsp
BlockDSPContext bdsp
Definition: mpegvideo.h:175
MpegEncContext::umvplus
int umvplus
== H.263+ && unrestricted_mv
Definition: mpegvideo.h:239
MpegEncContext::width
int width
Definition: mpegvideo.h:91
ff_mpv_idct_init
void ff_mpv_idct_init(MpegEncContext *s)
Definition: mpegvideo.c:95
MpegEncContext::frame_pred_frame_dct
int frame_pred_frame_dct
Definition: mpegvideo.h:300
MpegEncContext::slice_ctx_size
unsigned slice_ctx_size
If set, ff_mpv_common_init() will allocate slice contexts of this size.
Definition: mpegvideo.h:339
H263DSPContext
Definition: h263dsp.h:26
MpegEncContext::pb_frame
int pb_frame
PB-frame mode (0 = none, 1 = base, 2 = improved)
Definition: mpegvideo.h:94
ff_set_qscale
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
Definition: mpegvideo.c:585
MpegEncContext::coded_block
uint8_t * coded_block
used for coded block pattern prediction (msmpeg4v3, wmv1)
Definition: mpegvideo.h:154
MpegEncContext::pp_field_time
uint16_t pp_field_time
Definition: mpegvideo.h:256
s
#define s(width, name)
Definition: cbs_vp9.c:198
MpegEncContext::last_time_base
int last_time_base
Definition: mpegvideo.h:250
MpegEncContext::mv_dir
int mv_dir
Definition: mpegvideo.h:187
MpegEncContext::msmpeg4_version
enum MpegEncContext::@190 msmpeg4_version
MpegEncContext::h_edge_pos
int h_edge_pos
Definition: mpegvideo.h:112
MpegEncContext::mb_skip_run
int mb_skip_run
Definition: mpegvideo.h:212
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:230
MpegEncContext::skipped_last_frame
int skipped_last_frame
Definition: mpegvideo.h:146
MpegEncContext::p_field_mv_table_base
int16_t(* p_field_mv_table_base)[2]
Definition: mpegvideo.h:184
MpegEncContext::loop_filter
int loop_filter
Definition: mpegvideo.h:244
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:48
get_bits.h
MpegEncContext::divx_packed
int divx_packed
Definition: mpegvideo.h:267
MpegEncContext::MSMP4_UNUSED
@ MSMP4_UNUSED
Definition: mpegvideo.h:278
MpegEncContext::cur_pic
MPVWorkPicture cur_pic
copy of the current picture structure.
Definition: mpegvideo.h:144
FMT_H263
@ FMT_H263
Definition: mpegvideo.h:56
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:110
MpegEncContext::low_delay
int low_delay
no reordering needed / has no B-frames
Definition: mpegvideo.h:262
MpegEncContext::picture_pool
struct AVRefStructPool * picture_pool
Pool for MPVPictures.
Definition: mpegvideo.h:116
MpegEncContext::field_select
int field_select[2][2]
Definition: mpegvideo.h:203
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
MpegEncContext::chroma_420_type
int chroma_420_type
Definition: mpegvideo.h:307
ff_mpv_common_end
void ff_mpv_common_end(MpegEncContext *s)
Definition: mpegvideo.c:509
MpegEncContext::mb_y
int mb_y
Definition: mpegvideo.h:211
MpegEncContext::h263_long_vectors
int h263_long_vectors
use horrible H.263v1 long vector mode
Definition: mpegvideo.h:173
MpegEncContext::f_code
int f_code
forward MV resolution
Definition: mpegvideo.h:182
MpegEncContext::next_pic
MPVWorkPicture next_pic
copy of the next picture structure.
Definition: mpegvideo.h:138
MpegEncContext::h263_aic
int h263_aic
Advanced INTRA Coding (AIC)
Definition: mpegvideo.h:70
OutputFormat
OutputFormat
Definition: mpegvideo.h:53
MpegEncContext::y_dc_scale_table
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
Definition: mpegvideo.h:150
MpegEncContext::inter_matrix
uint16_t inter_matrix[64]
Definition: mpegvideo.h:224
MpegEncContext::hdsp
HpelDSPContext hdsp
Definition: mpegvideo.h:177
MpegEncContext::decode_mb
int(* decode_mb)(struct MpegEncContext *s, int16_t block[12][64])
Definition: mpegvideo.h:322
MpegEncContext::concealment_motion_vectors
int concealment_motion_vectors
Definition: mpegvideo.h:302
MpegEncContext::b8_stride
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
Definition: mpegvideo.h:111
lowres
static int lowres
Definition: ffplay.c:330
qpeldsp.h
MpegEncContext::slice_context_count
int slice_context_count
number of used thread_contexts
Definition: mpegvideo.h:126
op_pixels_func
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Definition: hpeldsp.h:38
MpegEncContext::pb_time
uint16_t pb_time
time distance between the last b and p,s,i frame
Definition: mpegvideo.h:255
MPVMainEncContext
Definition: mpegvideoenc.h:172
qpel_mc_func
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: qpeldsp.h:65
MpegEncContext::private_ctx
void * private_ctx
Definition: mpegvideo.h:89
MpegEncContext::blocks
int16_t(* blocks)[12][64]
Definition: mpegvideo.h:321
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
MpegEncContext::idsp
IDCTDSPContext idsp
Definition: mpegvideo.h:178
MpegEncContext::c_dc_scale
int c_dc_scale
Definition: mpegvideo.h:67
HpelDSPContext
Half-pel DSP context.
Definition: hpeldsp.h:45
MpegEncContext::pb_field_time
uint16_t pb_field_time
like above, just for interlaced
Definition: mpegvideo.h:257
MpegEncContext::coded_block_base
uint8_t * coded_block_base
Definition: mpegvideo.h:153
ff_mpv_init_duplicate_contexts
int ff_mpv_init_duplicate_contexts(MpegEncContext *s)
Initialize an MpegEncContext's thread contexts.
Definition: mpegvideo.c:140
MpegEncContext::mb_intra
int mb_intra
Definition: mpegvideo.h:213
MpegEncContext::chroma_qscale_table
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (H.263)
Definition: mpegvideo.h:152
MpegEncContext::qscale
int qscale
QP.
Definition: mpegvideo.h:166
MpegEncContext::first_slice_line
int first_slice_line
used in MPEG-4 too to handle resync markers
Definition: mpegvideo.h:275
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
MpegEncContext::intra_matrix
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
Definition: mpegvideo.h:222
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:390
MpegEncContext::v_edge_pos
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
Definition: mpegvideo.h:112
MpegEncContext::qdsp
QpelDSPContext qdsp
Definition: mpegvideo.h:179
h264chroma.h
MpegEncContext::interlaced_dct
int interlaced_dct
Definition: mpegvideo.h:317
MpegEncContext::encoding
int encoding
true if we are encoding (vs decoding)
Definition: mpegvideo.h:101
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:158
MAX_THREADS
#define MAX_THREADS
Definition: mpegvideo.h:42
MpegEncContext::dc_val
int16_t * dc_val[3]
used for MPEG-4 DC prediction, all 3 arrays must be continuous
Definition: mpegvideo.h:149
MpegEncContext::quarter_sample
int quarter_sample
1->qpel, 0->half pel ME/MC
Definition: mpegvideo.h:259
MpegEncContext::context_initialized
int context_initialized
Definition: mpegvideo.h:107
MpegEncContext::dct_precision
int dct_precision
Definition: mpegvideo.h:249
mpegpicture.h
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:252
MpegEncContext::context_reinit
int context_reinit
Definition: mpegvideo.h:336
MpegEncContext::buffer_pools
BufferPoolContext buffer_pools
Definition: mpegvideo.h:118
ff_mpv_common_init
int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
Definition: mpegvideo.c:422
ff_init_block_index
void ff_init_block_index(MpegEncContext *s)
Definition: mpegvideo.c:552
MpegEncContext::full_pel
int full_pel[2]
Definition: mpegvideo.h:316
MpegEncContext::block_last_index
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:69
MpegEncContext::dc_val_base
int16_t * dc_val_base
Definition: mpegvideo.h:148
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:204
MpegEncContext::uvlinesize
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
Definition: mpegvideo.h:115
MpegEncContext::progressive_frame
int progressive_frame
Definition: mpegvideo.h:315
MpegEncContext::chroma_inter_matrix
uint16_t chroma_inter_matrix[64]
Definition: mpegvideo.h:225
ff_update_duplicate_context
int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src)
Definition: mpegvideo.c:206
MpegEncContext::obmc
int obmc
overlapped block motion compensation
Definition: mpegvideo.h:235
MpegEncContext::MSMP4_VC1
@ MSMP4_VC1
for VC1 (image), WMV3 (image) and MSS2.
Definition: mpegvideo.h:284
MpegEncContext::mb_x
int mb_x
Definition: mpegvideo.h:211
MpegEncContext::thread_context
struct MpegEncContext * thread_context[MAX_THREADS]
Definition: mpegvideo.h:123
MpegEncContext::sc
ScratchpadContext sc
Definition: mpegvideo.h:164
MpegEncContext::last_pic
MPVWorkPicture last_pic
copy of the previous picture structure.
Definition: mpegvideo.h:132
MpegEncContext::intra_vlc_format
int intra_vlc_format
Definition: mpegvideo.h:304
MpegEncContext::permutated_intra_h_scantable
uint8_t permutated_intra_h_scantable[64]
Definition: mpegvideo.h:79
MpegEncContext::er
ERContext er
Definition: mpegvideo.h:341
MpegEncContext::picture_number
int picture_number
Definition: mpegvideo.h:108
MpegEncContext::dct_unquantize_inter
void(* dct_unquantize_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:331
idctdsp.h
MpegEncContext::h263_slice_structured
int h263_slice_structured
Definition: mpegvideo.h:241
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:528
MpegEncContext::mspel
int mspel
Definition: mpegvideo.h:287
IDCTDSPContext
Definition: idctdsp.h:43
MpegEncContext::rv10_version
int rv10_version
RV10 version: 0 or 3.
Definition: mpegvideo.h:270
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:185
MpegEncContext::block
int16_t(* block)[64]
points to one of the following blocks
Definition: mpegvideo.h:320
MpegEncContext::chroma_x_shift
int chroma_x_shift
Definition: mpegvideo.h:312
QpelDSPContext
quarterpel DSP context
Definition: qpeldsp.h:72
AVCodecContext
main external API structure.
Definition: avcodec.h:431
MpegEncContext::intra_dc_precision
int intra_dc_precision
Definition: mpegvideo.h:299
MpegEncContext::flipflop_rounding
int flipflop_rounding
Definition: mpegvideo.h:276
MpegEncContext::MSMP4_V1
@ MSMP4_V1
Definition: mpegvideo.h:279
MpegEncContext::ehc_mode
int ehc_mode
Definition: mpegvideo.h:236
MpegEncContext::modified_quant
int modified_quant
Definition: mpegvideo.h:243
error_resilience.h
MpegEncContext::rv10_first_dc_coded
int rv10_first_dc_coded[3]
Definition: mpegvideo.h:271
MpegEncContext::time
int64_t time
time of current frame
Definition: mpegvideo.h:252
MpegEncContext::pred_dir_table
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
Definition: mpegvideo.h:162
MpegEncContext::dct_unquantize_intra
void(* dct_unquantize_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:329
MpegEncContext::resync_mb_x
int resync_mb_x
x position of last resync marker
Definition: mpegvideo.h:228
VideoDSPContext
Definition: videodsp.h:40
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:207
MpegEncContext::h263_aic_dir
int h263_aic_dir
AIC direction: 0 = left, 1 = top.
Definition: mpegvideo.h:240
MpegEncContext::MSMP4_V3
@ MSMP4_V3
Definition: mpegvideo.h:281
MpegEncContext::mpeg_quant
int mpeg_quant
Definition: mpegvideo.h:263
MpegEncContext::inter_scantable
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
Definition: mpegvideo.h:73
MpegEncContext::droppable
int droppable
Definition: mpegvideo.h:169
MPVWorkPicture
Definition: mpegpicture.h:95
ScanTable
Scantable.
Definition: mpegvideo.h:47
MpegEncContext::cbp_table
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
Definition: mpegvideo.h:161
MpegEncContext::first_field
int first_field
is 1 for the first field of a field picture 0 otherwise
Definition: mpegvideo.h:318
MpegEncContext::q_scale_type
int q_scale_type
Definition: mpegvideo.h:303
H264ChromaContext
Definition: h264chroma.h:27
ScanTable::permutated
uint8_t permutated[64]
Definition: mpegvideo.h:49
videodsp.h
hpeldsp.h
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:484
BufferPoolContext
Definition: mpegpicture.h:44
MpegEncContext::resync_mb_y
int resync_mb_y
y position of last resync marker
Definition: mpegvideo.h:229
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:121
MpegEncContext::mb_index2xy
int * mb_index2xy
mb_index -> mb_x + mb_y*mb_stride
Definition: mpegvideo.h:219
MpegEncContext::h263_plus
int h263_plus
H.263+ headers.
Definition: mpegvideo.h:97
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:120
MpegEncContext::block_wrap
int block_wrap[6]
Definition: mpegvideo.h:216
MpegEncContext::alternate_scan
int alternate_scan
Definition: mpegvideo.h:305
MpegEncContext::custom_pcf
int custom_pcf
Definition: mpegvideo.h:245
MpegEncContext::direct_scale_mv
int16_t direct_scale_mv[2][64]
precomputed to avoid divisions in ff_mpeg4_set_direct_mv
Definition: mpegvideo.h:205
MpegEncContext::c_dc_scale_table
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
Definition: mpegvideo.h:151
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:64
MpegEncContext::encparent
const struct MPVMainEncContext * encparent
Definition: mpegvideo.h:85
MpegEncContext::codec_id
enum AVCodecID codec_id
Definition: mpegvideo.h:100
MpegEncContext::alt_inter_vlc
int alt_inter_vlc
alternative inter vlc
Definition: mpegvideo.h:242
src
#define src
Definition: vp8dsp.c:248
MpegEncContext::chroma_intra_matrix
uint16_t chroma_intra_matrix[64]
Definition: mpegvideo.h:223
ScanTable::raster_end
uint8_t raster_end[64]
Definition: mpegvideo.h:50
MpegEncContext::chroma_format
int chroma_format
Definition: mpegvideo.h:308
MpegEncContext::studio_profile
int studio_profile
Definition: mpegvideo.h:248
MpegEncContext::MSMP4_V2
@ MSMP4_V2
Definition: mpegvideo.h:280
MpegEncContext::ac_pred
int ac_pred
Definition: mpegvideo.h:68
MpegEncContext::codec_tag
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
Definition: mpegvideo.h:103