Go to the documentation of this file.
64 if (
h->c.block_last_index[n] >= 0) {
65 switch (
w->abt_type_table[n]) {
72 h->c.bdsp.clear_block(
w->abt_block2[n]);
77 h->c.bdsp.clear_block(
w->abt_block2[n]);
86 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
105 int coded_mb_count = 0;
106 uint32_t *
const mb_type =
h->c.cur_pic.mb_type;
109 switch (
w->skip_type) {
111 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
112 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
113 mb_type[mb_y *
h->c.mb_stride + mb_x] =
119 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
120 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
121 mb_type[mb_y *
h->c.mb_stride + mb_x] =
125 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++) {
129 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
130 mb_type[mb_y *
h->c.mb_stride + mb_x] =
133 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
134 mb_type[mb_y *
h->c.mb_stride + mb_x] =
140 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++) {
144 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
145 mb_type[mb_y *
h->c.mb_stride + mb_x] =
148 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
149 mb_type[mb_y *
h->c.mb_stride + mb_x] =
156 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
157 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
158 coded_mb_count += !
IS_SKIP(mb_type[mb_y *
h->c.mb_stride + mb_x]);
173 if (
h->c.avctx->extradata_size < 4)
179 w->ms.bit_rate =
get_bits(&gb, 11) * 1024;
191 h->slice_height =
h->c.mb_height /
code;
195 "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, "
196 "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
198 fps,
w->ms.bit_rate,
w->mspel_bit,
w->abt_flag,
w->j_type_bit,
199 w->top_left_mv_flag,
w->per_mb_rl_bit,
code,
h->loop_filter,
213 h->c.chroma_qscale =
h->c.qscale =
get_bits(&
h->gb, 5);
214 if (
h->c.qscale <= 0)
241 memset(
h->c.cur_pic.mb_type, 0,
242 sizeof(*
h->c.cur_pic.mb_type) *
h->c.mb_height *
h->c.mb_stride);
249 if (
w->per_mb_rl_bit)
252 w->ms.per_mb_rl_table = 0;
254 if (!
w->ms.per_mb_rl_table) {
266 if (
get_bits_left(&
h->gb) * 8LL < (
h->c.width+15)/16 * ((
h->c.height+15)/16))
269 h->c.inter_intra_pred = 0;
270 h->c.no_rounding = 1;
273 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
274 h->c.qscale,
w->ms.rl_chroma_table_index,
w->ms.rl_table_index,
275 w->ms.dc_table_index,
w->ms.per_mb_rl_table,
w->j_type);
299 if (
w->per_mb_rl_bit)
302 w->ms.per_mb_rl_table = 0;
304 if (!
w->ms.per_mb_rl_table) {
306 w->ms.rl_chroma_table_index =
w->ms.rl_table_index;
315 h->c.inter_intra_pred = 0;
316 h->c.no_rounding ^= 1;
320 "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
321 "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
322 w->ms.rl_table_index,
w->ms.rl_chroma_table_index,
323 w->ms.dc_table_index,
w->ms.mv_table_index,
324 w->ms.per_mb_rl_table,
h->c.qscale,
h->c.mspel,
325 w->per_mb_abt,
w->abt_type,
w->cbp_table_index,
326 h->c.inter_intra_pred);
329 w->ms.esc3_level_length = 0;
330 w->ms.esc3_run_length = 0;
334 &
h->gb, &
h->c.mb_x, &
h->c.mb_y,
335 2 *
h->c.qscale, (
h->c.qscale - 1) | 1,
336 h->loop_filter,
h->c.low_delay);
339 (
h->c.mb_x >> 1) - 1, (
h->c.mb_y >> 1) - 1,
353 if ((((*mx_ptr) | (*my_ptr)) & 1) &&
h->c.mspel)
356 w->common.hshift = 0;
364 int wrap =
h->c.b8_stride;
365 int xy =
h->c.block_index[0];
367 int16_t *mot_val =
h->c.cur_pic.motion_val[0][xy];
369 const int16_t *
A =
h->c.cur_pic.motion_val[0][xy - 1];
370 const int16_t *
B =
h->c.cur_pic.motion_val[0][xy -
wrap];
371 const int16_t *
C =
h->c.cur_pic.motion_val[0][xy + 2 -
wrap];
373 if (
h->c.mb_x && !
h->c.first_slice_line && !
h->c.mspel &&
w->top_left_mv_flag)
386 }
else if (
type == 1) {
391 if (
h->c.first_slice_line) {
407 static const int sub_cbp_table[3] = { 2, 3, 1 };
411 h->c.block_last_index[n] = -1;
415 if (
w->per_block_abt)
417 w->abt_type_table[n] =
w->abt_type;
436 h->c.block_last_index[n] = 63;
441 h->c.inter_scantable.permutated);
458 if (
IS_SKIP(
h->c.cur_pic.mb_type[
h->c.mb_y *
h->c.mb_stride +
h->c.mb_x])) {
461 for (
i = 0;
i < 6;
i++)
462 h->c.block_last_index[
i] = -1;
465 h->c.mv[0][0][0] = 0;
466 h->c.mv[0][0][1] = 0;
468 w->common.hshift = 0;
476 h->c.mb_intra = (~
code & 0x40) >> 6;
487 for (
i = 0;
i < 6;
i++) {
494 cbp |=
val << (5 -
i);
498 if (!
h->c.mb_intra) {
503 h->c.bdsp.clear_blocks(
h->block[0]);
509 if (
w->abt_flag &&
w->per_mb_abt) {
511 if (!
w->per_block_abt)
514 w->per_block_abt = 0;
521 h->c.mv[0][0][0] =
mx;
522 h->c.mv[0][0][1] =
my;
524 for (
i = 0;
i < 6;
i++) {
527 "\nerror while decoding inter block: %d x %d (%d)\n",
528 h->c.mb_x,
h->c.mb_y,
i);
534 ff_dlog(
h->c.avctx,
"%d%d ",
h->c.inter_intra_pred, cbp);
535 ff_dlog(
h->c.avctx,
"I at %d %d %d %06X\n",
h->c.mb_x,
h->c.mb_y,
536 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
539 if (
h->c.inter_intra_pred) {
543 h->c.ac_pred,
h->c.h263_aic_dir,
h->c.mb_x,
h->c.mb_y);
550 h->c.bdsp.clear_blocks(
h->block[0]);
551 for (
i = 0;
i < 6;
i++) {
555 "\nerror while decoding intra block: %d x %d (%d)\n",
556 h->c.mb_x,
h->c.mb_y,
i);
572 s->private_ctx = &
w->common;
585 s->mb_width,
s->mb_height);
static int wmv2_decode_mb(H263DecContext *const h)
#define MV_TYPE_16X16
1 vector for the whole mb
#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 av_always_inline int wmv2_get_cbp_table_index(int qscale, int cbp_index)
static int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, int n, int cbp)
int ff_intrax8_decode_picture(IntraX8Context *w, MPVPicture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int dquant, int quant_offset, int loopfilter, int lowdelay)
Decode single IntraX8 frame.
int16_t abt_block2[6][64]
int ff_wmv2_decode_secondary_picture_header(H263DecContext *const h)
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
static av_cold void close(AVCodecParserContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
AVCodec p
The public AVCodec.
static int wmv2_decode_picture_header(H263DecContext *const h)
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
void ff_msmpeg4_decode_motion(MSMP4DecContext *const ms, 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 FF_CODEC_DECODE_CB(func)
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, int16_t block[64], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
const VLCElem * ff_mb_non_intra_vlc[4]
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.
#define CODEC_LONG_NAME(str)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static int parse_mb_skip(WMV2DecContext *w)
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
av_cold int ff_mpv_decode_close(AVCodecContext *avctx)
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 rl_chroma_table_index
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.
VLCElem ff_inter_intra_vlc[8]
VLCElem ff_msmp4_mb_i_vlc[536]
static void wmv2_add_block(WMV2DecContext *w, int16_t *block1, uint8_t *dst, int stride, int n)
int(* init)(AVBSFContext *ctx)
#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)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const uint8_t ff_wmv2_scantableB[64]
#define FRAME_SKIPPED
Frame is not coded.
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]
int ff_msmpeg4_decode_block(MSMP4DecContext *const ms, int16_t *block, int n, int coded, const uint8_t *scan_table)
#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.
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)
#define MB_TYPE_FORWARD_MV
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)