Go to the documentation of this file.
36 int coded_mb_count = 0;
38 uint32_t *
const mb_type =
s->current_picture_ptr->mb_type;
41 switch (
w->skip_type) {
43 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
44 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
45 mb_type[mb_y *
s->mb_stride + mb_x] =
51 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
52 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
53 mb_type[mb_y *
s->mb_stride + mb_x] =
57 for (mb_y = 0; mb_y <
s->mb_height; mb_y++) {
61 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
62 mb_type[mb_y *
s->mb_stride + mb_x] =
65 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
66 mb_type[mb_y *
s->mb_stride + mb_x] =
72 for (mb_x = 0; mb_x <
s->mb_width; mb_x++) {
76 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
77 mb_type[mb_y *
s->mb_stride + mb_x] =
80 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
81 mb_type[mb_y *
s->mb_stride + mb_x] =
88 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
89 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
90 coded_mb_count += !
IS_SKIP(mb_type[mb_y *
s->mb_stride + mb_x]);
105 if (
s->avctx->extradata_size < 4)
123 s->slice_height =
s->mb_height /
code;
127 "fps:%d, br:%"PRId64
", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
128 "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
130 fps,
s->bit_rate,
w->mspel_bit,
w->abt_flag,
w->j_type_bit,
131 w->top_left_mv_flag,
w->per_mb_rl_bit,
code,
s->loop_filter,
141 if (
s->picture_number == 0)
149 s->chroma_qscale =
s->qscale =
get_bits(&
s->gb, 5);
182 if (
w->per_mb_rl_bit)
185 s->per_mb_rl_table = 0;
187 if (!
s->per_mb_rl_table) {
202 s->inter_intra_pred = 0;
206 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
207 s->qscale,
s->rl_chroma_table_index,
s->rl_table_index,
208 s->dc_table_index,
s->per_mb_rl_table,
w->j_type);
232 if (
w->per_mb_rl_bit)
235 s->per_mb_rl_table = 0;
237 if (!
s->per_mb_rl_table) {
239 s->rl_chroma_table_index =
s->rl_table_index;
248 s->inter_intra_pred = 0;
253 "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
254 "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
255 s->rl_table_index,
s->rl_chroma_table_index,
256 s->dc_table_index,
s->mv_table_index,
257 s->per_mb_rl_table,
s->qscale,
s->mspel,
258 w->per_mb_abt,
w->abt_type,
w->cbp_table_index,
259 s->inter_intra_pred);
262 s->esc3_level_length = 0;
263 s->esc3_run_length = 0;
268 &
s->gb, &
s->mb_x, &
s->mb_y,
269 2 *
s->qscale, (
s->qscale - 1) | 1,
270 s->loop_filter,
s->low_delay);
273 (
w->s.mb_x >> 1) - 1, (
w->s.mb_y >> 1) - 1,
291 if ((((*mx_ptr) | (*my_ptr)) & 1) &&
s->mspel)
303 int16_t *
A, *
B, *
C, *mot_val;
306 xy =
s->block_index[0];
308 mot_val =
s->current_picture.motion_val[0][xy];
310 A =
s->current_picture.motion_val[0][xy - 1];
311 B =
s->current_picture.motion_val[0][xy -
wrap];
312 C =
s->current_picture.motion_val[0][xy + 2 -
wrap];
314 if (
s->mb_x && !
s->first_slice_line && !
s->mspel &&
w->top_left_mv_flag)
327 }
else if (
type == 1) {
332 if (
s->first_slice_line) {
348 static const int sub_cbp_table[3] = { 2, 3, 1 };
352 s->block_last_index[n] = -1;
356 if (
w->per_block_abt)
358 w->abt_type_table[n] =
w->abt_type;
362 const uint8_t *scantable =
w->abt_scantable[
w->abt_type - 1].scantable;
375 s->block_last_index[n] = 63;
380 s->inter_scantable.permutated);
394 if (
IS_SKIP(
s->current_picture.mb_type[
s->mb_y *
s->mb_stride +
s->mb_x])) {
397 for (
i = 0;
i < 6;
i++)
398 s->block_last_index[
i] = -1;
414 s->mb_intra = (~
code & 0x40) >> 6;
424 "II-cbp illegal at %d %d\n",
s->mb_x,
s->mb_y);
429 for (
i = 0;
i < 6;
i++) {
436 cbp |=
val << (5 -
i);
445 s->bdsp.clear_blocks(
s->block[0]);
446 if (
s->per_mb_rl_table) {
448 s->rl_chroma_table_index =
s->rl_table_index;
451 if (
w->abt_flag &&
w->per_mb_abt) {
453 if (!
w->per_block_abt)
456 w->per_block_abt = 0;
467 for (
i = 0;
i < 6;
i++) {
470 "\nerror while decoding inter block: %d x %d (%d)\n",
471 s->mb_x,
s->mb_y,
i);
477 ff_dlog(
s->avctx,
"%d%d ",
s->inter_intra_pred, cbp);
478 ff_dlog(
s->avctx,
"I at %d %d %d %06X\n",
s->mb_x,
s->mb_y,
479 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
482 if (
s->inter_intra_pred) {
486 s->ac_pred,
s->h263_aic_dir,
s->mb_x,
s->mb_y);
488 if (
s->per_mb_rl_table && cbp) {
490 s->rl_chroma_table_index =
s->rl_table_index;
493 s->bdsp.clear_blocks(
s->block[0]);
494 for (
i = 0;
i < 6;
i++) {
497 "\nerror while decoding intra block: %d x %d (%d)\n",
498 s->mb_x,
s->mb_y,
i);
518 w->s.block,
w->s.block_last_index,
519 w->s.mb_width,
w->s.mb_height);
static int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block, int n, int cbp)
#define MV_TYPE_16X16
1 vector for the whole mb
AVPixelFormat
Pixel format.
int ff_msmpeg4_decode_init(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
int ff_msmpeg4_decode_block(MpegEncContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table)
av_cold void ff_wmv2_common_init(Wmv2Context *w)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
#define FF_DEBUG_PICT_INFO
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int dquant, int quant_offset, int loopfilter, int lowdelay)
Decode single IntraX8 frame.
static int decode_ext_header(Wmv2Context *w)
static double val(void *priv, double ch)
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 just let it vf type
static int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define MB_NON_INTRA_VLC_BITS
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, IDCTDSPContext *idsp, int16_t(*block)[64], int block_last_index[12], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
int ff_wmv2_decode_picture_header(MpegEncContext *s)
static av_always_inline int wmv2_get_cbp_table_index(MpegEncContext *s, int cbp_index)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static enum AVPixelFormat pix_fmts[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int parse_mb_skip(Wmv2Context *w)
static int decode012(GetBitContext *gb)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
int ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int16_t * wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
#define i(width, name, range_min, range_max)
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
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
int ff_h263_decode_end(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
static const float pred[4]
main external API structure.
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
@ AV_PICTURE_TYPE_P
Predicted.
#define MB_INTRA_VLC_BITS
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
VLC ff_mb_non_intra_vlc[4]
VLC_TYPE(* table)[2]
code, bits
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)
#define INTER_INTRA_VLC_BITS