Go to the documentation of this file.
59 uint8_t *dst,
int stride,
int n)
63 if (
s->block_last_index[n] >= 0) {
64 switch (
w->abt_type_table[n]) {
71 s->bdsp.clear_block(
w->abt_block2[n]);
76 s->bdsp.clear_block(
w->abt_block2[n]);
85 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
104 int coded_mb_count = 0;
106 uint32_t *
const mb_type =
s->current_picture_ptr->mb_type;
109 switch (
w->skip_type) {
111 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
112 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
113 mb_type[mb_y *
s->mb_stride + mb_x] =
119 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
120 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
121 mb_type[mb_y *
s->mb_stride + mb_x] =
125 for (mb_y = 0; mb_y <
s->mb_height; mb_y++) {
129 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
130 mb_type[mb_y *
s->mb_stride + mb_x] =
133 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
134 mb_type[mb_y *
s->mb_stride + mb_x] =
140 for (mb_x = 0; mb_x <
s->mb_width; mb_x++) {
144 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
145 mb_type[mb_y *
s->mb_stride + mb_x] =
148 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
149 mb_type[mb_y *
s->mb_stride + mb_x] =
156 for (mb_y = 0; mb_y <
s->mb_height; mb_y++)
157 for (mb_x = 0; mb_x <
s->mb_width; mb_x++)
158 coded_mb_count += !
IS_SKIP(mb_type[mb_y *
s->mb_stride + mb_x]);
173 if (
s->avctx->extradata_size < 4)
191 s->slice_height =
s->mb_height /
code;
195 "fps:%d, br:%"PRId64
", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
196 "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
198 fps,
s->bit_rate,
w->mspel_bit,
w->abt_flag,
w->j_type_bit,
199 w->top_left_mv_flag,
w->per_mb_rl_bit,
code,
s->loop_filter,
213 s->chroma_qscale =
s->qscale =
get_bits(&
s->gb, 5);
241 memset(
s->current_picture_ptr->mb_type, 0,
242 sizeof(*
s->current_picture_ptr->mb_type) *
243 s->mb_height *
s->mb_stride);
250 if (
w->per_mb_rl_bit)
253 s->per_mb_rl_table = 0;
255 if (!
s->per_mb_rl_table) {
270 s->inter_intra_pred = 0;
274 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
275 s->qscale,
s->rl_chroma_table_index,
s->rl_table_index,
276 s->dc_table_index,
s->per_mb_rl_table,
w->j_type);
300 if (
w->per_mb_rl_bit)
303 s->per_mb_rl_table = 0;
305 if (!
s->per_mb_rl_table) {
307 s->rl_chroma_table_index =
s->rl_table_index;
316 s->inter_intra_pred = 0;
321 "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
322 "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
323 s->rl_table_index,
s->rl_chroma_table_index,
324 s->dc_table_index,
s->mv_table_index,
325 s->per_mb_rl_table,
s->qscale,
s->mspel,
326 w->per_mb_abt,
w->abt_type,
w->cbp_table_index,
327 s->inter_intra_pred);
330 s->esc3_level_length = 0;
331 s->esc3_run_length = 0;
335 &
s->gb, &
s->mb_x, &
s->mb_y,
336 2 *
s->qscale, (
s->qscale - 1) | 1,
337 s->loop_filter,
s->low_delay);
340 (
w->s.mb_x >> 1) - 1, (
w->s.mb_y >> 1) - 1,
354 if ((((*mx_ptr) | (*my_ptr)) & 1) &&
s->mspel)
357 w->common.hshift = 0;
364 int16_t *
A, *
B, *
C, *mot_val;
367 xy =
s->block_index[0];
369 mot_val =
s->current_picture.motion_val[0][xy];
371 A =
s->current_picture.motion_val[0][xy - 1];
372 B =
s->current_picture.motion_val[0][xy -
wrap];
373 C =
s->current_picture.motion_val[0][xy + 2 -
wrap];
375 if (
s->mb_x && !
s->first_slice_line && !
s->mspel &&
w->top_left_mv_flag)
388 }
else if (
type == 1) {
393 if (
s->first_slice_line) {
409 static const int sub_cbp_table[3] = { 2, 3, 1 };
413 s->block_last_index[n] = -1;
417 if (
w->per_block_abt)
419 w->abt_type_table[n] =
w->abt_type;
434 s->block_last_index[n] = 63;
439 s->inter_scantable.permutated);
455 if (
IS_SKIP(
s->current_picture.mb_type[
s->mb_y *
s->mb_stride +
s->mb_x])) {
458 for (
i = 0;
i < 6;
i++)
459 s->block_last_index[
i] = -1;
465 w->common.hshift = 0;
473 s->mb_intra = (~
code & 0x40) >> 6;
484 for (
i = 0;
i < 6;
i++) {
491 cbp |=
val << (5 -
i);
500 s->bdsp.clear_blocks(
s->block[0]);
501 if (
s->per_mb_rl_table) {
503 s->rl_chroma_table_index =
s->rl_table_index;
506 if (
w->abt_flag &&
w->per_mb_abt) {
508 if (!
w->per_block_abt)
511 w->per_block_abt = 0;
521 for (
i = 0;
i < 6;
i++) {
524 "\nerror while decoding inter block: %d x %d (%d)\n",
525 s->mb_x,
s->mb_y,
i);
531 ff_dlog(
s->avctx,
"%d%d ",
s->inter_intra_pred, cbp);
532 ff_dlog(
s->avctx,
"I at %d %d %d %06X\n",
s->mb_x,
s->mb_y,
533 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
536 if (
s->inter_intra_pred) {
540 s->ac_pred,
s->h263_aic_dir,
s->mb_x,
s->mb_y);
542 if (
s->per_mb_rl_table && cbp) {
544 s->rl_chroma_table_index =
s->rl_table_index;
547 s->bdsp.clear_blocks(
s->block[0]);
548 for (
i = 0;
i < 6;
i++) {
551 "\nerror while decoding intra block: %d x %d (%d)\n",
552 s->mb_x,
s->mb_y,
i);
567 s->private_ctx = &
w->common;
579 w->s.block,
w->s.block_last_index,
580 w->s.mb_width,
w->s.mb_height);
#define MV_TYPE_16X16
1 vector for the whole mb
AVPixelFormat
Pixel format.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
static int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, int n, int cbp)
int16_t abt_block2[6][64]
const FFCodec ff_wmv2_decoder
void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
#define MSMP4_MB_INTRA_VLC_BITS
static int16_t * wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
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.
AVCodec p
The public AVCodec.
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.
VLC ff_mb_non_intra_vlc[4]
void ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
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
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.
int ff_wmv2_decode_picture_header(MpegEncContext *s)
static av_always_inline int wmv2_get_cbp_table_index(MpegEncContext *s, int cbp_index)
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
void ff_simple_idct48_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, int16_t(*block)[64], int block_last_index[12], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
#define CODEC_LONG_NAME(str)
#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.
static int wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
static int parse_mb_skip(WMV2DecContext *w)
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
static int decode_ext_header(WMV2DecContext *w)
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
#define INTER_INTRA_VLC_BITS
int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, int *got_frame, AVPacket *avpkt)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
av_cold int ff_h263_decode_end(AVCodecContext *avctx)
static void wmv2_add_block(WMV2DecContext *w, int16_t *block1, uint8_t *dst, int stride, int n)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define MB_NON_INTRA_VLC_BITS
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define DECLARE_ALIGNED(n, t, v)
const uint8_t ff_wmv2_scantableB[64]
const uint8_t ff_wmv2_scantableA[64]
static void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
static int16_t block1[64]
#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_msmpeg4_decode_block(MpegEncContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table)
static int BS_FUNC() decode012(BSCTX *bc)
Return decoded truncated unary code for the values 0, 1, 2.
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 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.
av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
av_cold void ff_wmv2_common_init(MpegEncContext *s)
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)