28 #define UNCHECKED_BITSTREAM_READER 1 55 #define A53_MAX_CC_COUNT 2000 78 #define MB_TYPE_ZERO_MV 0x20000000 119 val = (val - 1) << shift;
131 #define MAX_INDEX (64 - 1) 132 #define check_scantable_index(ctx, x) \ 134 if ((x) > MAX_INDEX) { \ 135 av_log(ctx->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", \ 136 ctx->mb_x, ctx->mb_y); \ 137 return AVERROR_INVALIDDATA; \ 142 int16_t *
block,
int n)
148 const int qscale = s->
qscale;
156 level = (3 * qscale * quant_matrix[0]) >> 5;
157 level = (level - 1) | 1;
176 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
177 level = (level - 1) | 1;
191 }
else if (level == 0) {
201 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
202 level = (level - 1) | 1;
205 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
206 level = (level - 1) | 1;
231 int16_t *
block,
int n)
236 const int qscale = s->
qscale;
244 level = (3 * qscale) >> 1;
245 level = (level - 1) | 1;
265 level = ((level * 2 + 1) * qscale) >> 1;
266 level = (level - 1) | 1;
280 }
else if (level == 0) {
290 level = ((level * 2 + 1) * qscale) >> 1;
291 level = (level - 1) | 1;
294 level = ((level * 2 + 1) * qscale) >> 1;
295 level = (level - 1) | 1;
316 int16_t *
block,
int n)
321 const uint16_t *quant_matrix;
322 const int qscale = s->
qscale;
338 level = (3 * qscale * quant_matrix[0]) >> 5;
359 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
376 level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
379 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
393 block[63] ^= (mismatch & 1);
406 int16_t *
block,
int n)
411 const int qscale = s->
qscale;
418 level = (3 * qscale) >> 1;
437 level = ((level * 2 + 1) * qscale) >> 1;
454 level = ((-level * 2 + 1) * qscale) >> 1;
457 level = ((level * 2 + 1) * qscale) >> 1;
478 int16_t *
block,
int n)
484 const uint16_t *quant_matrix;
485 const int qscale = s->
qscale;
494 component = (n & 1) + 1;
502 mismatch = block[0] ^ 1;
519 }
else if (level != 0) {
524 level = (level * qscale * quant_matrix[j]) >> 4;
539 level = (-level * qscale * quant_matrix[j]) >> 4;
542 level = (level * qscale * quant_matrix[j]) >> 4;
551 block[63] ^= mismatch & 1;
564 int16_t *
block,
int n)
570 const uint16_t *quant_matrix;
571 const int qscale = s->
qscale;
579 component = (n & 1) + 1;
600 if (level >= 64 || i > 63) {
602 }
else if (level != 0) {
605 level = (level * qscale * quant_matrix[j]) >> 4;
618 level = (-level * qscale * quant_matrix[j]) >> 4;
621 level = (level * qscale * quant_matrix[j]) >> 4;
655 int i, j, k, cbp,
val, mb_type, motion_type;
683 if ((s->
mv[0][0][0] | s->
mv[0][0][1] | s->
mv[1][0][0] | s->
mv[1][0][1]) == 0)
696 "Invalid mb type in I-frame at %d %d\n",
709 "Invalid mb type in P-frame at %d %d\n", s->
mb_x, s->
mb_y);
718 "Invalid mb type in B-frame at %d %d\n", s->
mb_x, s->
mb_y);
762 if ((CONFIG_MPEG1_XVMC_HWACCEL || CONFIG_MPEG2_XVMC_HWACCEL) && s->
pack_pblocks)
767 for (i = 0; i < 6; i++)
770 for (i = 0; i < mb_block_count; i++)
775 for (i = 0; i < 6; i++) {
831 s->
mv_dir = (mb_type >> 13) & 3;
833 switch (motion_type) {
838 for (i = 0; i < 2; i++) {
861 for (i = 0; i < 2; i++) {
864 for (j = 0; j < 2; j++) {
866 for (k = 0; k < 2; k++) {
881 for (i = 0; i < 2; i++) {
883 for (j = 0; j < 2; j++) {
901 for (i = 0; i < 2; i++) {
904 for (k = 0; k < 2; k++) {
921 for (i = 0; i < 2; i++) {
923 int dmx, dmy, mx, my, m;
932 s->
last_mv[i][0][1] >> my_shift);
936 s->
last_mv[
i][0][1] = my * (1 << my_shift);
937 s->
last_mv[
i][1][1] = my * (1 << my_shift);
951 s->
mv[
i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
952 s->
mv[
i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1;
954 s->
mv[
i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
955 s->
mv[
i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
959 s->
mv[
i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
960 s->
mv[
i][2][1] = ((my + (my > 0)) >> 1) + dmy;
971 "00 motion_type at %d %d\n", s->
mb_x, s->
mb_y);
981 if (mb_block_count > 6) {
982 cbp *= 1 << mb_block_count - 6;
988 "invalid cbp %d at %d %d\n", cbp, s->
mb_x, s->
mb_y);
993 if ((CONFIG_MPEG1_XVMC_HWACCEL || CONFIG_MPEG2_XVMC_HWACCEL) && s->
pack_pblocks)
998 for (i = 0; i < 6; i++) {
1006 cbp <<= 12 - mb_block_count;
1008 for (i = 0; i < mb_block_count; i++) {
1009 if (cbp & (1 << 11)) {
1020 for (i = 0; i < 6; i++) {
1028 for (i = 0; i < 6; i++) {
1040 for (i = 0; i < 12; i++)
1078 static int mpeg_decode_update_thread_context(
AVCodecContext *avctx,
1085 if (avctx == avctx_from ||
1086 !ctx_from->mpeg_enc_ctx_allocated ||
1087 !
s1->context_initialized)
1107 uint16_t temp_matrix[64];
1110 memcpy(temp_matrix, matrix, 64 *
sizeof(uint16_t));
1112 for (i = 0; i < 64; i++)
1113 matrix[new_perm[i]] = temp_matrix[old_perm[i]];
1117 #if CONFIG_MPEG1_NVDEC_HWACCEL 1120 #if CONFIG_MPEG1_XVMC_HWACCEL 1123 #if CONFIG_MPEG1_VDPAU_HWACCEL 1131 #if CONFIG_MPEG2_NVDEC_HWACCEL 1134 #if CONFIG_MPEG2_XVMC_HWACCEL 1137 #if CONFIG_MPEG2_VDPAU_HWACCEL 1140 #if CONFIG_MPEG2_DXVA2_HWACCEL 1143 #if CONFIG_MPEG2_D3D11VA_HWACCEL 1147 #if CONFIG_MPEG2_VAAPI_HWACCEL 1150 #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 1222 s1->pan_scan.height }),
1238 (
AVRational) { s1->pan_scan.width, s1->pan_scan.height });
1243 ff_dlog(avctx,
"aspect A %d/%d\n",
1347 int ref, f_code, vbv_delay;
1382 "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->
pict_type);
1392 int horiz_size_ext, vert_size_ext;
1409 s->
width |= (horiz_size_ext << 12);
1410 s->
height |= (vert_size_ext << 12);
1412 s->
bit_rate += (bit_rate_ext << 18) * 400LL;
1434 "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%"PRId64
"\n",
1442 int color_description,
w,
h;
1446 if (color_description) {
1482 for (i = 0; i < nofco; i++) {
1491 "pde (%"PRId16
",%"PRId16
") (%"PRId16
",%"PRId16
") (%"PRId16
",%"PRId16
")\n",
1498 uint16_t matrix1[64],
int intra)
1502 for (i = 0; i < 64; i++) {
1509 if (intra && i == 0 && v != 8) {
1545 "Missing picture start code, guessing missing values\n");
1675 "hardware accelerator failed to decode first field\n");
1680 for (i = 0; i < 4; i++) {
1696 #define DECODE_SLICE_ERROR -1 1697 #define DECODE_SLICE_OK 0 1706 const uint8_t **buf,
int buf_size)
1765 const uint8_t *buf_end, *buf_start = *buf - 4;
1768 if (buf_end < *buf + buf_size)
1785 "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
1805 if ((CONFIG_MPEG1_XVMC_HWACCEL || CONFIG_MPEG2_XVMC_HWACCEL) && s->
pack_pblocks)
1816 int motion_x, motion_y, dir,
i;
1818 for (i = 0; i < 2; i++) {
1819 for (dir = 0; dir < 2; dir++) {
1822 motion_x = motion_y = 0;
1825 motion_x = s->
mv[dir][0][0];
1826 motion_y = s->
mv[dir][0][1];
1828 motion_x = s->
mv[dir][
i][0];
1829 motion_y = s->
mv[dir][
i][1];
1860 s->
mb_y += 1 << field_pic;
1872 if (left >= 32 && !is_d10) {
1924 }
else if (code == 35) {
1941 "skipped MB in I-frame at %d %d\n", s->
mb_x, s->
mb_y);
1947 for (i = 0; i < 12; i++)
1956 s->
mv[0][0][0] = s->
mv[0][0][1] = 0;
1997 ff_dlog(c,
"ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
2022 mb_y += (*buf&0xE0)<<2;
2047 "hardware accelerator failed to decode picture\n");
2087 const uint8_t *buf,
int buf_size)
2098 if (width == 0 || height == 0) {
2100 "Invalid horizontal or vertical size value.\n");
2128 for (i = 0; i < 64; i++) {
2138 for (i = 0; i < 64; i++) {
2200 for (i = 0; i < 64; i++) {
2230 const uint8_t *p,
int buf_size)
2234 if (buf_size >= 6 &&
2235 p[0] ==
'G' && p[1] ==
'A' && p[2] ==
'9' && p[3] ==
'4' &&
2236 p[4] == 3 && (p[5] & 0x40)) {
2238 int cc_count = p[5] & 0x1f;
2239 if (cc_count > 0 && buf_size >= 7 + cc_count * 3) {
2241 const uint64_t new_size = (old_size + cc_count
2250 memcpy(s1->
a53_buf_ref->
data + old_size, p + 7, cc_count * UINT64_C(3));
2255 }
else if (buf_size >= 2 &&
2256 p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
2266 const uint64_t new_size = (old_size + cc_count
2277 for (i = 0; i < cc_count && get_bits_left(&gb) >= 26; i++) {
2286 cap[0] = cap[1] = cap[2] = 0x00;
2288 field = (field == 2 ? 1 : 0);
2290 cap[0] = 0x04 |
field;
2300 }
else if (buf_size >= 11 &&
2301 p[0] ==
'C' && p[1] ==
'C' && p[2] == 0x01 && p[3] == 0xf8) {
2331 for (i = 5; i + 6 <= buf_size && ((p[
i] & 0xfe) == 0xfe); i += 6)
2336 const uint64_t new_size = (old_size + cc_count
2343 uint8_t field1 = !!(p[4] & 0x80);
2346 for (i = 0; i < cc_count; i++) {
2347 cap[0] = (p[0] == 0xff && field1) ? 0xfc : 0xfd;
2350 cap[3] = (p[3] == 0xff && !field1) ? 0xfc : 0xfd;
2365 const uint8_t *p,
int buf_size)
2368 const uint8_t *buf_end = p + buf_size;
2373 for(i=0; !(!p[i-2] && !p[i-1] && p[
i]==1) && i<buf_size; i++){
2382 if (!memcmp(p+i,
"\0TMPGEXS\0", 9)){
2387 if (buf_end - p >= 5 &&
2388 p[0] ==
'D' && p[1] ==
'T' && p[2] ==
'G' && p[3] ==
'1') {
2396 if (buf_end - p < 1)
2399 s1->
afd = p[0] & 0x0f;
2401 }
else if (buf_end - p >= 6 &&
2402 p[0] ==
'J' && p[1] ==
'P' && p[2] ==
'3' && p[3] ==
'D' &&
2405 const uint8_t S3D_video_format_type = p[5] & 0x7F;
2407 if (S3D_video_format_type == 0x03 ||
2408 S3D_video_format_type == 0x04 ||
2409 S3D_video_format_type == 0x08 ||
2410 S3D_video_format_type == 0x23) {
2414 switch (S3D_video_format_type) {
2435 const uint8_t *buf,
int buf_size)
2444 tc = s-> timecode_frame_start =
get_bits(&s->
gb, 25);
2446 #if FF_API_PRIVATE_OPT 2462 "GOP (%s) closed_gop=%d broken_link=%d\n",
2468 int *got_output,
const uint8_t *buf,
int buf_size)
2473 const uint8_t *buf_end = buf + buf_size;
2474 int ret, input_size;
2475 int last_code = 0, skip_frame = 0;
2476 int picture_start_code_seen = 0;
2482 if (start_code > 0x1ff) {
2514 input_size = buf_end - buf_ptr;
2518 start_code, buf_ptr - buf, input_size);
2521 switch (start_code) {
2523 if (last_code == 0) {
2529 "ignoring SEQ_START_CODE after %X\n", last_code);
2542 picture_start_code_seen = 1;
2569 "mpeg_decode_postinit() failure\n");
2580 "ignoring pic after %X\n", last_code);
2590 if (last_code == 0) {
2594 "ignoring seq ext after %X\n", last_code);
2613 "ignoring pic cod ext after %X\n", last_code);
2624 if (last_code == 0) {
2630 "ignoring GOP_START_CODE after %X\n", last_code);
2641 "interlaced frame in progressive sequence, ignoring\n");
2647 "picture_structure %d invalid, ignoring\n",
2670 mb_y += (*buf_ptr&0xE0)<<2;
2676 if (buf_end - buf_ptr < 2) {
2683 "slice below image (%d >= %d)\n", mb_y, s2->
mb_height);
2694 "Skipping B slice due to open GOP\n");
2707 "Skipping P slice due to !sync\n");
2724 if (mb_y < avctx->skip_top ||
2744 "current_picture not initialized\n");
2755 if (threshold <= mb_y) {
2798 int buf_size = avpkt->
size;
2822 (
const uint8_t **) &buf, &buf_size) < 0)
2849 ret =
decode_chunks(avctx, picture, got_output, buf, buf_size);
2850 if (ret<0 || *got_output) {
2891 .
name =
"mpeg1video",
2908 #if CONFIG_MPEG1_NVDEC_HWACCEL 2911 #if CONFIG_MPEG1_VDPAU_HWACCEL 2914 #if CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 2917 #if CONFIG_MPEG1_XVMC_HWACCEL 2925 .
name =
"mpeg2video",
2942 #if CONFIG_MPEG2_DXVA2_HWACCEL 2945 #if CONFIG_MPEG2_D3D11VA_HWACCEL 2948 #if CONFIG_MPEG2_D3D11VA2_HWACCEL 2951 #if CONFIG_MPEG2_NVDEC_HWACCEL 2954 #if CONFIG_MPEG2_VAAPI_HWACCEL 2957 #if CONFIG_MPEG2_VDPAU_HWACCEL 2960 #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 2963 #if CONFIG_MPEG2_XVMC_HWACCEL 2972 .
name =
"mpegvideo",
3017 if (s->
flags & 0x10) {
3028 for (
int y = 0; y < avctx->
height; y += 16) {
3031 for (
int x = 0; x < avctx->
width; x += 16) {
3052 for (
int n = 0; n < 6; n++) {
3053 if (s->
flags & 0x80) {
3108 for (
int i = 0;
i < 64;
i++) {
3115 for (
int i = 0;
i < 64;
i++) {
static const uint32_t btype2mb_type[11]
const uint16_t ff_mpeg1_default_non_intra_matrix[64]
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
#define AV_EF_AGGRESSIVE
consider things that a sane encoder should not do as an error
const struct AVCodec * codec
discard all frames except keyframes
void ff_init_block_index(MpegEncContext *s)
int64_t timecode_frame_start
GOP timecode frame start number, in non drop frame format.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define SLICE_MAX_START_CODE
static int shift(int a, int b)
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
This structure describes decoded (raw) audio or video data.
static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, const uint8_t *new_perm)
ptrdiff_t const GLvoid * data
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
#define MV_TYPE_FIELD
2 vectors, one per field
int last_mv[2][2][2]
last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
int coded_width
Bitstream width / height, may be different from width/height e.g.
static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
av_cold void ff_mpeg12_init_vlcs(void)
int64_t bit_rate
the average bitrate
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
hardware decoding through Videotoolbox
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
static av_cold int init(AVCodecContext *avctx)
uint16_t chroma_intra_matrix[64]
int max_bitrate
Maximum bitrate of the stream, in bits per second.
const uint8_t ff_reverse[256]
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
uint16_t chroma_inter_matrix[64]
void ff_er_frame_end(ERContext *s)
static int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, int16_t *block, int n)
Changing this would eat up any speed benefits it has.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
int repeat_pict
When decoding, this signals how much the picture must be delayed.
Views are next to each other, but when upscaling apply a checkerboard pattern.
#define HWACCEL_NVDEC(codec)
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
void ff_mpeg1_clean_buffers(MpegEncContext *s)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
AVCodec ff_mpeg1video_decoder
char * av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
Get the timecode string from the 25-bit timecode format (MPEG GOP format).
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_cold int mpeg_decode_init(AVCodecContext *avctx)
#define AV_EF_BITSTREAM
detect bitstream specification deviations
Views are next to each other.
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries...
static void mpeg_decode_gop(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
#define SLICE_MIN_START_CODE
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
static int get_dmv(MpegEncContext *s)
static int get_sbits(GetBitContext *s, int n)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
int encoding
true if we are encoding (vs decoding)
Macro definitions for various function/variable attributes.
enum AVDiscard skip_frame
Skip decoding for selected frames.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define USES_LIST(a, list)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
static const uint32_t ptype2mb_type[7]
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
The exact code depends on how similar the blocks are and how related they are to the block
#define HWACCEL_VDPAU(codec)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
enum OutputFormat out_format
output format
#define FF_DEBUG_PICT_INFO
static av_cold int end(AVCodecContext *avctx)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const float ff_mpeg1_aspect[16]
Multithreading support functions.
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], int intra)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
static int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *block, int n)
Changing this would eat up any speed benefits it has.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Picture current_picture
copy of the current picture structure.
The data is the AVPanScan struct defined in libavcodec.
void ff_xvmc_init_block(MpegEncContext *s)
Initialize the block field of the MpegEncContext pointer passed as parameter after making sure that t...
Structure to hold side data for an AVFrame.
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
Check if the given sample aspect ratio of an image is valid.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
#define PICT_BOTTOM_FIELD
static int get_bits_count(const GetBitContext *s)
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
Fill individual block pointers, so there are no gaps in the data_block array in case not all blocks i...
AVDictionary * metadata
metadata.
av_cold void ff_mpv_idct_init(MpegEncContext *s)
int mb_height
number of MBs horizontally & vertically
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
Video is not stereoscopic (and metadata has to be there).
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
#define HWACCEL_D3D11VA(codec)
static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
Libavcodec version macros.
static int get_bits_left(GetBitContext *gb)
int slice_context_count
number of used thread_contexts
#define UPDATE_CACHE(name, gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
int last_dc[3]
last DC values for MPEG-1
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
#define PTRDIFF_SPECIFIER
int mb_skipped
MUST BE SET only during DECODING.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
void(* clear_blocks)(int16_t *blocks)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, int n)
int active_thread_type
Which multithreading methods are in use by the codec.
AVCodec ff_mpegvideo_decoder
static av_cold int ipu_decode_init(AVCodecContext *avctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
ATSC A53 Part 4 Closed Captions.
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
int width
width and height in 1/16 pel
int low_delay
no reordering needed / has no B-frames
int av_buffer_realloc(AVBufferRef **pbuf, int size)
Reallocate a given buffer.
static void mpeg_decode_user_data(AVCodecContext *avctx, const uint8_t *p, int buf_size)
The GOP timecode in 25 bit timecode format.
#define CLOSE_READER(name, gb)
void ff_mpv_common_end(MpegEncContext *s)
static int decode_dc(GetBitContext *gb, int component)
attribute_deprecated int64_t timecode_frame_start
#define DECODE_SLICE_ERROR
#define GET_RL_VLC(level, run, name, gb, table, bits,max_depth, need_update)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void ff_mpeg_flush(AVCodecContext *avctx)
XVideo Motion Acceleration via common packet passing.
#define SKIP_BITS(name, gb, num)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int resync_mb_x
x position of last resync marker
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
common internal API header
static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
const AVProfile ff_mpeg2_video_profiles[]
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
static int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block, int n)
int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type)
enum AVPictureType pict_type
Picture type of the frame.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define FF_THREAD_FRAME
Decode more than one frame at once.
static int vcr2_init_sequence(AVCodecContext *avctx)
AVFrameSideData * av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
Add a new side data to a frame from an existing AVBufferRef.
int width
picture width / height.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call ff_thread_finish_setup() afterwards.If some code can't be moved
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encodin...
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
int16_t(*[2] motion_val)[2]
Picture * current_picture_ptr
pointer to the current picture
void ff_mpeg_er_frame_start(MpegEncContext *s)
static int mpeg_decode_a53_cc(AVCodecContext *avctx, const uint8_t *p, int buf_size)
#define HWACCEL_XVMC(codec)
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
#define MB_BTYPE_VLC_BITS
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
#define LAST_SKIP_BITS(name, gb, num)
static av_cold int mpeg_decode_end(AVCodecContext *avctx)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
int16_t(*[12] pblocks)[64]
int block_last_index[12]
last non zero coefficient in block
#define AV_EF_EXPLODE
abort decoding on minor error detection
uint8_t idct_permutation[64]
IDCT input permutation.
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
int mpeg_enc_ctx_allocated
#define check_scantable_index(ctx, x)
#define MB_TYPE_INTERLACED
void(* idct_put)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
HW acceleration through CUDA.
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
preferred ID for MPEG-1/2 video decoding
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
#define HWACCEL_DXVA2(codec)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
static int mpeg1_decode_sequence(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static const float pred[4]
int first_field
is 1 for the first field of a field picture 0 otherwise
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define MV_TYPE_16X16
1 vector for the whole mb
static av_cold int ipu_decode_end(AVCodecContext *avctx)
This structure describes the bitrate properties of an encoded bitstream.
static int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
enum AVStereo3DType type
How views are packed within the video.
uint16_t inter_matrix[64]
static enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[]
int concealment_motion_vectors
struct MpegEncContext * thread_context[MAX_THREADS]
Libavcodec external API header.
Views are on top of each other.
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
AVRational frame_rate_ext
static int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
Changing this would eat up any speed benefits it has.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define AV_CODEC_FLAG2_FAST
Allow non spec compliant speedup tricks.
#define MB_PTYPE_VLC_BITS
main external API structure.
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff)*mv_scale Intra DC Prediction block[y][x] dc[1]
ScanTable intra_scantable
uint8_t * data
The data buffer.
int height
picture size. must be a multiple of 16
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
#define OPEN_READER(name, gb)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread.Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities.There will be very little speed gain at this point but it should work.If there are inter-frame dependencies
static int mpeg_decode_slice(MpegEncContext *s, int mb_y, const uint8_t **buf, int buf_size)
Decode a slice.
void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static int ipu_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
static void skip_bits(GetBitContext *s, int n)
static const AVProfile profiles[]
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
int closed_gop
MPEG1/2 GOP is closed.
unsigned int avpriv_toupper4(unsigned int x)
enum AVColorSpace colorspace
YUV colorspace type.
Rational number (pair of numerator and denominator).
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
static enum AVPixelFormat mpeg12_pixfmt_list_422[]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define HWACCEL_D3D11VA2(codec)
#define GET_CACHE(name, gb)
const uint16_t ff_mpeg1_default_intra_matrix[256]
int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s)
Find the end of the current frame in the bitstream.
const uint8_t ff_zigzag_direct[64]
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
AVBufferRef * a53_buf_ref
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt)
static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, int *got_output, const uint8_t *buf, int buf_size)
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
static enum AVPixelFormat pix_fmts[]
av_cold void ff_mpeg12_common_init(MpegEncContext *s)
#define AV_CODEC_CAP_TRUNCATED
int size
Size of data in bytes.
static av_const int sign_extend(int val, unsigned bits)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int skip_bottom
Number of macroblock rows at the bottom which are skipped.
#define flags(name, subs,...)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
#define FF_QSCALE_TYPE_MPEG2
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
Hardware surfaces for Direct3D11.
Narrow or limited range content.
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
#define SHOW_SBITS(name, gb, num)
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
A reference to a data buffer.
int ff_mpeg1_decode_block_intra(GetBitContext *gb, const uint16_t *quant_matrix, uint8_t *const scantable, int last_dc[3], int16_t *block, int index, int qscale)
discard all non reference
const AVRational ff_mpeg2_aspect[16]
static enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#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 ...
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
Initialize the given MpegEncContext for decoding.
static int ref[MAX_W *MAX_W]
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
AVCodec ff_mpeg2video_decoder
static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
const uint8_t * buffer_end
static void flush(AVCodecContext *avctx)
Picture * last_picture_ptr
pointer to the previous picture.
static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
unsigned properties
Properties of the stream that gets decoded.
const uint8_t ff_alternate_vertical_scan[64]
int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
int16_t position[3][2]
position of the top left corner in 1/16 pel for up to 3 fields/frames
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
static int mpeg_decode_postinit(AVCodecContext *avctx)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
#define FF_DEBUG_STARTCODE
#define FF_ENABLE_DEPRECATION_WARNINGS
void ff_mpv_frame_end(MpegEncContext *s)
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
#define HWACCEL_VAAPI(codec)
void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
int resync_mb_y
y position of last resync marker
int16_t(* block)[64]
points to one of the following blocks
ParseContext parse_context
VLC_TYPE(* table)[2]
code, bits
int64_t bit_rate
wanted bit rate
int key_frame
1 -> keyframe, 0-> not
static const uint8_t * align_get_bits(GetBitContext *s)
int flags2
AV_CODEC_FLAG2_*.
MpegEncContext mpeg_enc_ctx
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
#define AV_CODEC_FLAG_TRUNCATED
Input bitstream might be truncated at a random location instead of only at frame boundaries.
#define AV_CODEC_FLAG2_SHOW_ALL
Show all frames before the first keyframe.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
uint32_t * mb_type
types and macros are defined in mpegutils.h
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
#define PICTURE_START_CODE
static int skip_1stop_8data_bits(GetBitContext *gb)
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
static int mpeg_get_qscale(MpegEncContext *s)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
static int slice_decode_thread(AVCodecContext *c, void *arg)
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
static enum AVPixelFormat mpeg12_pixfmt_list_444[]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
AVPixelFormat
Pixel format.
static double val(void *priv, double ch)
This structure stores compressed data.
void ff_mpv_report_decode_progress(MpegEncContext *s)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
#define AV_TIMECODE_STR_SIZE
FF_DISABLE_DEPRECATION_WARNINGS enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
int64_t rc_max_rate
maximum bitrate
const AVRational ff_mpeg12_frame_rate_tab[]