53 int16_t *
block,
int n,
int qscale)
55 int i,
level, nCoeffs;
56 const uint16_t *quant_matrix;
66 for(i=1;i<=nCoeffs;i++) {
72 level = (int)(level * qscale * quant_matrix[j]) >> 3;
73 level = (level - 1) | 1;
76 level = (int)(level * qscale * quant_matrix[j]) >> 3;
77 level = (level - 1) | 1;
85 int16_t *
block,
int n,
int qscale)
87 int i,
level, nCoeffs;
88 const uint16_t *quant_matrix;
93 for(i=0; i<=nCoeffs; i++) {
99 level = (((level << 1) + 1) * qscale *
100 ((int) (quant_matrix[j]))) >> 4;
101 level = (level - 1) | 1;
104 level = (((level << 1) + 1) * qscale *
105 ((int) (quant_matrix[j]))) >> 4;
106 level = (level - 1) | 1;
114 int16_t *
block,
int n,
int qscale)
116 int i,
level, nCoeffs;
117 const uint16_t *quant_matrix;
127 for(i=1;i<=nCoeffs;i++) {
133 level = (int)(level * qscale * quant_matrix[j]) >> 3;
136 level = (int)(level * qscale * quant_matrix[j]) >> 3;
144 int16_t *
block,
int n,
int qscale)
146 int i,
level, nCoeffs;
147 const uint16_t *quant_matrix;
158 for(i=1;i<=nCoeffs;i++) {
164 level = (int)(level * qscale * quant_matrix[j]) >> 3;
167 level = (int)(level * qscale * quant_matrix[j]) >> 3;
177 int16_t *
block,
int n,
int qscale)
179 int i,
level, nCoeffs;
180 const uint16_t *quant_matrix;
187 for(i=0; i<=nCoeffs; i++) {
193 level = (((level << 1) + 1) * qscale *
194 ((int) (quant_matrix[j]))) >> 4;
197 level = (((level << 1) + 1) * qscale *
198 ((int) (quant_matrix[j]))) >> 4;
208 int16_t *
block,
int n,
int qscale)
210 int i,
level, qmul, qadd;
222 qadd = (qscale - 1) | 1;
231 for(i=1; i<=nCoeffs; i++) {
235 level = level * qmul - qadd;
237 level = level * qmul + qadd;
245 int16_t *
block,
int n,
int qscale)
247 int i,
level, qmul, qadd;
252 qadd = (qscale - 1) | 1;
257 for(i=0; i<=nCoeffs; i++) {
261 level = level * qmul - qadd;
263 level = level * qmul + qadd;
330 int yc_size = y_size + 2 * c_size;
347 2 * 64 *
sizeof(
int),
fail)
353 for (i = 0; i < 12; i++) {
367 yc_size *
sizeof(int16_t) * 16,
fail);
400 #define COPY(a) bak->a = src->a 401 COPY(sc.edge_emu_buffer);
404 COPY(sc.rd_scratchpad);
405 COPY(sc.b_scratchpad);
406 COPY(sc.obmc_scratchpad);
413 COPY(me.map_generation);
434 for (i = 0; i < 12; i++) {
448 "scratch buffers.\n");
462 if (dst == src || !s1->context_initialized)
484 s->
width = s1->width;
499 if (s1->picture[i].f->buf[0] &&
504 #define UPDATE_PICTURE(pic)\ 506 ff_mpeg_unref_picture(s->avctx, &s->pic);\ 507 if (s1->pic.f->buf[0])\ 508 ret = ff_mpeg_ref_picture(s->avctx, &s->pic, &s1->pic);\ 510 ret = ff_update_picture_tables(&s->pic, &s1->pic);\ 519 #define REBASE_PICTURE(pic, new_ctx, old_ctx) \ 520 ((pic && pic >= old_ctx->picture && \ 521 pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \ 522 &new_ctx->picture[pic - old_ctx->picture] : NULL) 534 (
char *) &s1->pb_field_time +
sizeof(s1->pb_field_time) -
535 (
char *) &s1->last_time_base);
545 if (s1->bitstream_buffer) {
546 if (s1->bitstream_buffer_size +
550 s1->allocated_bitstream_buffer_size);
553 s1->bitstream_buffer_size);
562 &s->
sc, s1->linesize) < 0) {
564 "scratch buffers.\n");
569 "be allocated due to unknown size.\n");
575 (
char *) &s1->rtp_mode - (
char *) &s1->progressive_sequence);
577 if (!s1->first_field) {
579 if (s1->current_picture_ptr)
580 s->
last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f->quality;
625 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
649 yc_size = y_size + 2 * c_size;
663 mv_table_size * 2 *
sizeof(int16_t),
fail);
665 mv_table_size * 2 *
sizeof(int16_t),
fail);
667 mv_table_size * 2 *
sizeof(int16_t),
fail);
669 mv_table_size * 2 *
sizeof(int16_t),
fail);
671 mv_table_size * 2 *
sizeof(int16_t),
fail);
673 mv_table_size * 2 *
sizeof(int16_t),
fail);
685 sizeof(uint16_t),
fail);
691 mb_array_size *
sizeof(
float),
fail);
693 mb_array_size *
sizeof(
float),
fail);
700 for (i = 0; i < 2; i++) {
702 for (j = 0; j < 2; j++) {
703 for (k = 0; k < 2; k++) {
706 mv_table_size * 2 *
sizeof(int16_t),
714 mv_table_size * 2 *
sizeof(int16_t),
fail);
738 yc_size *
sizeof(int16_t),
fail);
742 for (i = 0; i < yc_size; i++)
780 "decoding to AV_PIX_FMT_NONE is not supported.\n");
791 " reducing to %d\n", nb_slices, max_slices);
792 nb_slices = max_slices;
845 for (i = 1; i < nb_slices; i++) {
850 for (i = 0; i < nb_slices; i++) {
854 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
856 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
895 for (i = 0; i < 2; i++) {
896 for (j = 0; j < 2; j++) {
897 for (k = 0; k < 2; k++) {
969 for (i = 1; i < nb_slices; i++) {
974 for (i = 0; i < nb_slices; i++) {
978 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
980 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1134 ff_dlog(s->
avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1144 int h_chroma_shift, v_chroma_shift;
1146 &h_chroma_shift, &v_chroma_shift);
1149 "warning: first frame is no keyframe\n");
1152 "allocate dummy last picture for field based first keyframe\n");
1173 (avctx->
height >> v_chroma_shift) *
1176 (avctx->
height >> v_chroma_shift) *
1221 "Non-reference picture received and no reference available\n");
1227 for (i = 0; i < 4; i++) {
1316 for (x = 0; x < s->
mb_width; x++) {
1344 else if (
IS_GMC(mb_type))
1386 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->
quarter_sample;
1387 int my, off, i, mvs;
1406 for (i = 0; i < mvs; i++) {
1407 my = s->
mv[dir][i][1]<<qpel_shift;
1408 my_max =
FFMAX(my_max, my);
1409 my_min =
FFMIN(my_min, my);
1412 off = (
FFMAX(-my_min, my_max) + 63) >> 6;
1421 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
1437 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
1459 memset(s->
ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
1460 memset(s->
ac_val[0][xy + wrap], 0, 32 *
sizeof(int16_t));
1473 memset(s->
ac_val[1][xy], 0, 16 *
sizeof(int16_t));
1474 memset(s->
ac_val[2][xy], 0, 16 *
sizeof(int16_t));
1509 for(j=0; j<64; j++){
1536 uint8_t *dest_y, *dest_cb, *dest_cr;
1537 int dct_linesize, dct_offset;
1543 const int block_size = 8;
1566 dest_cb= s->
dest[1];
1567 dest_cr= s->
dest[2];
1638 add_dct(s, block[0], 0, dest_y , dct_linesize);
1639 add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
1640 add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
1641 add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
1645 add_dct(s, block[4], 4, dest_cb, uvlinesize);
1646 add_dct(s, block[5], 5, dest_cr, uvlinesize);
1652 add_dct(s, block[4], 4, dest_cb, dct_linesize);
1653 add_dct(s, block[5], 5, dest_cr, dct_linesize);
1654 add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
1655 add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
1657 add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
1658 add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
1659 add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
1660 add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
1672 put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->
qscale);
1673 put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->
qscale);
1674 put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->
qscale);
1691 s->
idsp.
idct_put(dest_y + block_size, dct_linesize, block[1]);
1692 s->
idsp.
idct_put(dest_y + dct_offset, dct_linesize, block[2]);
1693 s->
idsp.
idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
1706 s->
idsp.
idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
1707 s->
idsp.
idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
1711 s->
idsp.
idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
1712 s->
idsp.
idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
1747 const int mb_size= 4;
1764 s->
dest[0] += s->
mb_y * linesize << mb_size;
1768 s->
dest[0] += (s->
mb_y>>1) * linesize << mb_size;
1810 else if (qscale > 31)
int bitstream_buffer_size
uint8_t * scratchpad
data area for the ME algo, so that the ME does not need to malloc/free.
#define AV_CODEC_FLAG_INTERLACED_ME
interlaced motion estimation
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
static int init_duplicate_context(MpegEncContext *s)
int16_t(* b_bidir_back_mv_table_base)[2]
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
av_cold void ff_mpv_common_init_arm(MpegEncContext *s)
discard all frames except keyframes
void ff_init_block_index(MpegEncContext *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define CONFIG_MPEG_XVMC_DECODER
void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
av_cold void ff_mpv_common_init_neon(MpegEncContext *s)
ScanTable intra_v_scantable
av_cold void ff_mpegvideodsp_init(MpegVideoDSPContext *c)
#define CONFIG_WMV2_ENCODER
This structure describes decoded (raw) audio or video data.
int16_t(* p_mv_table)[2]
MV table (1MV per MB) P-frame encoding.
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
int coded_width
Bitstream width / height, may be different from width/height e.g.
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * coded_block_base
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
int16_t(*[3] ac_val)[16]
used for for MPEG-4 AC prediction, all 3 arrays must be continuous
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
int needs_realloc
Picture needs to be reallocated (eg due to a frame size change)
#define HAVE_INTRINSICS_NEON
uint8_t * bitstream_buffer
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
int field_picture
whether or not the picture was encoded in separate fields
void ff_print_debug_info(MpegEncContext *s, Picture *p)
Print debugging info for the given picture.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int16_t(*[2][2] p_field_mv_table)[2]
MV table (2MV per MB) interlaced P-frame encoding.
int16_t(* p_mv_table_base)[2]
static int lowest_referenced_row(MpegEncContext *s, int dir)
find the lowest MB row referenced in the MVs
uint32_t * score_map
map to store the scores
void(* idct_add)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
static void free_duplicate_context(MpegEncContext *s)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
int mb_num
number of MBs of a picture
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
int h263_aic
Advanced INTRA Coding (AIC)
int16_t(* b_back_mv_table)[2]
MV table (1MV per MB) backward mode B-frame encoding.
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band...
enum AVPictureType last_picture
int encoding
true if we are encoding (vs decoding)
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Macro definitions for various function/variable attributes.
int16_t(* b_back_mv_table_base)[2]
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac, coded_block for the current non-intra MB.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define USES_LIST(a, list)
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
const uint8_t ff_mpeg1_dc_scale_table[128]
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
enum OutputFormat out_format
output format
int ff_mpv_common_frame_size_change(MpegEncContext *s)
void ff_mpv_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], qpel_mc_func(*qpix_op)[16])
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
Multithreading support functions.
qpel_mc_func(* qpel_put)[16]
void ff_free_picture_tables(Picture *pic)
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
void ff_mpv_decode_mb(MpegEncContext *s, int16_t block[12][64])
Picture current_picture
copy of the current picture structure.
int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
void ff_mpv_common_init_ppc(MpegEncContext *s)
#define PICT_BOTTOM_FIELD
int16_t(* b_bidir_forw_mv_table)[2]
MV table (1MV per MB) bidir mode B-frame encoding.
uint16_t pp_time
time distance between the last 2 p,s,i frames
static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
int interlaced_frame
The content of the picture is interlaced.
av_cold void ff_mpv_idct_init(MpegEncContext *s)
int mb_height
number of MBs horizontally & vertically
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
high precision timer, useful to profile code
int16_t(*[2][2] p_field_mv_table_base)[2]
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
int intra_only
if true, only intra pictures are generated
int16_t * dc_val[3]
used for MPEG-4 DC prediction, all 3 arrays must be continuous
int h263_plus
H.263+ headers.
int slice_context_count
number of used thread_contexts
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int last_dc[3]
last DC values for MPEG-1
static void add_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size)
int mb_skipped
MUST BE SET only during DECODING.
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
int partitioned_frame
is current frame partitioned
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
#define MAX_PICTURE_COUNT
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
int active_thread_type
Which multithreading methods are in use by the codec.
int last_lambda_for[5]
last lambda for a specific pict type
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, int16_t *block, int n, int qscale)
int flags
AV_CODEC_FLAG_*.
static enum AVDiscard skip_idct
static void put_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
simple assert() macros that are a bit more flexible than ISO C assert().
int overread_index
the index into ParseContext.buffer of the overread bytes
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
int quarter_sample
1->qpel, 0->half pel ME/MC
uint16_t * mb_type
Table for candidate MB types for encoding (defines in mpegutils.h)
int low_delay
no reordering needed / has no B-frames
uint8_t *[2][2] b_field_select_table
void ff_mpv_common_end(MpegEncContext *s)
av_cold void ff_mpv_common_init_x86(MpegEncContext *s)
void ff_mpeg_flush(AVCodecContext *avctx)
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
int coded_picture_number
used to set pic->coded_picture_number, should not be used for/by anything else
uint8_t * error_status_table
const uint8_t ff_alternate_horizontal_scan[64]
int ff_mpeg_er_init(MpegEncContext *s)
common internal API header
void(* idct_put)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
enum AVPictureType pict_type
Picture type of the frame.
#define UPDATE_PICTURE(pic)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define FF_THREAD_FRAME
Decode more than one frame at once.
int overread
the number of bytes which where irreversibly read from the next frame
int next_p_frame_damaged
set if the next p frame is damaged, to avoid showing trashed B-frames
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture new_picture
copy of the source picture structure for encoding.
void(* dct_unquantize_mpeg1_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int width
picture width / height.
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encodin...
Picture * current_picture_ptr
pointer to the current picture
unsigned int allocated_bitstream_buffer_size
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int16_t(* ac_val_base)[16]
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
int16_t(*[2][2][2] b_field_mv_table_base)[2]
void(* dct_unquantize_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int16_t(* b_forw_mv_table_base)[2]
void(* dct_unquantize_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int16_t(*[12] pblocks)[64]
int block_last_index[12]
last non zero coefficient in block
uint8_t idct_permutation[64]
IDCT input permutation.
int mb_decision
macroblock decision mode
uint8_t * mbintra_table
used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
void(* dct_unquantize_mpeg2_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
preferred ID for MPEG-1/2 video decoding
void ff_mpv_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int block_index[6]
index to current MB in block based arrays with edges
if(ac->has_optimized_func)
int * mb_index2xy
mb_index -> mb_x + mb_y*mb_stride
int first_field
is 1 for the first field of a field picture 0 otherwise
#define MV_TYPE_16X16
1 vector for the whole mb
int16_t(* b_bidir_forw_mv_table_base)[2]
int coded_picture_number
picture number in bitstream order
#define AV_LOG_INFO
Standard information.
uint16_t inter_matrix[64]
struct MpegEncContext * thread_context[MAX_THREADS]
Libavcodec external API header.
int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, int shared, int encoding, int chroma_x_shift, int chroma_y_shift, int out_format, int mb_stride, int mb_height, int b8_stride, ptrdiff_t *linesize, ptrdiff_t *uvlinesize)
Allocate a Picture.
ptrdiff_t linesize
line size, in bytes, may be different from width
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
ScanTable intra_scantable
uint8_t * coded_block
used for coded block pattern prediction (msmpeg4v3, wmv1)
int height
picture size. must be a multiple of 16
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
void(* dct_unquantize_mpeg2_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static av_always_inline void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], int is_mpeg12)
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
uint32_t state
contains the last few bytes in MSB order
Picture * picture
main picture buffer
#define AVERROR_BUG
Bug detected, please report the issue.
ScanTable intra_h_scantable
op_pixels_func put_no_rnd_pixels_tab[4][4]
Halfpel motion compensation with no rounding (a+b)>>1.
int16_t(*[2][2][2] b_field_mv_table)[2]
MV table (4MV per MB) interlaced B-frame encoding.
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize)
unsigned int avpriv_toupper4(unsigned int x)
#define FF_DEBUG_DCT_COEFF
#define FF_MB_DECISION_RD
rate distortion
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
const uint8_t ff_zigzag_direct[64]
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
int f_code
forward MV resolution
int max_b_frames
max number of B-frames for encoding
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int h263_pred
use MPEG-4/H.263 ac/dc predictions
int16_t(* b_bidir_back_mv_table)[2]
MV table (1MV per MB) bidir mode B-frame encoding.
static int init_context_frame(MpegEncContext *s)
Initialize and allocates MpegEncContext fields dependent on the resolution.
uint8_t *[2] p_field_select_table
int16_t(* b_direct_mv_table)[2]
MV table (1MV per MB) direct mode B-frame encoding.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
qpel_mc_func(* qpel_avg)[16]
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int16_t(* b_forw_mv_table)[2]
MV table (1MV per MB) forward mode B-frame encoding.
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
static void dct_unquantize_h263_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic)
Deallocate a picture.
discard all non reference
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
const uint8_t ff_default_chroma_qscale_table[32]
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
static av_cold int dct_init(MpegEncContext *s)
static void dct_unquantize_h263_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture last_picture
copy of the previous picture structure.
Picture * last_picture_ptr
pointer to the previous picture.
uint8_t * b_scratchpad
scratchpad used for writing into write only buffers
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (H.263)
const uint8_t ff_alternate_vertical_scan[64]
uint32_t * map
map to avoid duplicate evaluations
int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int16_t(* blocks)[12][64]
int slices
Number of slices.
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
#define FF_ENABLE_DEPRECATION_WARNINGS
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
int top_field_first
If the content is interlaced, is top field displayed first.
void ff_xvmc_decode_mb(MpegEncContext *s)
void ff_mpv_frame_end(MpegEncContext *s)
uint8_t * obmc_scratchpad
int16_t(* block)[64]
points to one of the following blocks
ParseContext parse_context
static void add_dequant_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
Picture next_picture
copy of the next picture structure.
int key_frame
1 -> keyframe, 0-> not
#define CONFIG_WMV2_DECODER
int chroma_qscale
chroma QP
void ff_mpv_common_defaults(MpegEncContext *s)
Set the given MpegEncContext to common defaults (same for encoding and decoding). ...
static void free_context_frame(MpegEncContext *s)
Frees and resets MpegEncContext fields depending on the resolution.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
uint32_t * mb_type
types and macros are defined in mpegutils.h
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
void ff_xvmc_field_end(MpegEncContext *s)
int16_t(* b_direct_mv_table_base)[2]
int b_code
backward MV resolution for B-frames (MPEG-4)
void(* dct_unquantize_mpeg1_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void ff_mpv_report_decode_progress(MpegEncContext *s)
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)