Go to the documentation of this file.
64 if (
h->c.block_last_index[n] >= 0) {
65 int16_t *
block1 = blocks1[n];
66 switch (
w->abt_type_table[n]) {
73 h->c.bdsp.clear_block(
w->abt_block2[n]);
78 h->c.bdsp.clear_block(
w->abt_block2[n]);
87 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
106 int coded_mb_count = 0;
107 uint32_t *
const mb_type =
h->c.cur_pic.mb_type;
110 switch (
w->skip_type) {
112 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
113 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
114 mb_type[mb_y *
h->c.mb_stride + mb_x] =
120 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
121 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
122 mb_type[mb_y *
h->c.mb_stride + mb_x] =
126 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++) {
130 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
131 mb_type[mb_y *
h->c.mb_stride + mb_x] =
134 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
135 mb_type[mb_y *
h->c.mb_stride + mb_x] =
141 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++) {
145 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
146 mb_type[mb_y *
h->c.mb_stride + mb_x] =
149 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
150 mb_type[mb_y *
h->c.mb_stride + mb_x] =
157 for (
int mb_y = 0; mb_y <
h->c.mb_height; mb_y++)
158 for (
int mb_x = 0; mb_x <
h->c.mb_width; mb_x++)
159 coded_mb_count += !
IS_SKIP(mb_type[mb_y *
h->c.mb_stride + mb_x]);
174 if (
h->c.avctx->extradata_size < 4)
180 w->ms.bit_rate =
get_bits(&gb, 11) * 1024;
192 h->slice_height =
h->c.mb_height /
code;
196 "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, "
197 "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
199 fps,
w->ms.bit_rate,
w->mspel_bit,
w->abt_flag,
w->j_type_bit,
200 w->top_left_mv_flag,
w->per_mb_rl_bit,
code,
h->loop_filter,
214 h->c.chroma_qscale =
h->c.qscale =
get_bits(&
h->gb, 5);
215 if (
h->c.qscale <= 0)
242 memset(
h->c.cur_pic.mb_type, 0,
243 sizeof(*
h->c.cur_pic.mb_type) *
h->c.mb_height *
h->c.mb_stride);
250 if (
w->per_mb_rl_bit)
253 w->ms.per_mb_rl_table = 0;
255 if (!
w->ms.per_mb_rl_table) {
267 if (
get_bits_left(&
h->gb) * 8LL < (
h->c.width+15)/16 * ((
h->c.height+15)/16))
270 h->c.inter_intra_pred = 0;
271 h->c.no_rounding = 1;
274 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
275 h->c.qscale,
w->ms.rl_chroma_table_index,
w->ms.rl_table_index,
276 w->ms.dc_table_index,
w->ms.per_mb_rl_table,
w->j_type);
300 if (
w->per_mb_rl_bit)
303 w->ms.per_mb_rl_table = 0;
305 if (!
w->ms.per_mb_rl_table) {
307 w->ms.rl_chroma_table_index =
w->ms.rl_table_index;
316 h->c.inter_intra_pred = 0;
317 h->c.no_rounding ^= 1;
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 w->ms.rl_table_index,
w->ms.rl_chroma_table_index,
324 w->ms.dc_table_index,
w->ms.mv_table_index,
325 w->ms.per_mb_rl_table,
h->c.qscale,
h->c.mspel,
326 w->per_mb_abt,
w->abt_type,
w->cbp_table_index,
327 h->c.inter_intra_pred);
330 w->ms.esc3_level_length = 0;
331 w->ms.esc3_run_length = 0;
335 &
h->gb, &
h->c.mb_x, &
h->c.mb_y,
336 2 *
h->c.qscale, (
h->c.qscale - 1) | 1,
337 h->loop_filter,
h->c.low_delay);
340 (
h->c.mb_x >> 1) - 1, (
h->c.mb_y >> 1) - 1,
354 if ((((*mx_ptr) | (*my_ptr)) & 1) &&
h->c.mspel)
357 w->common.hshift = 0;
365 int wrap =
h->c.b8_stride;
366 int xy =
h->c.block_index[0];
368 int16_t *mot_val =
h->c.cur_pic.motion_val[0][xy];
370 const int16_t *
A =
h->c.cur_pic.motion_val[0][xy - 1];
371 const int16_t *
B =
h->c.cur_pic.motion_val[0][xy -
wrap];
372 const int16_t *
C =
h->c.cur_pic.motion_val[0][xy + 2 -
wrap];
374 if (
h->c.mb_x && !
h->c.first_slice_line && !
h->c.mspel &&
w->top_left_mv_flag)
387 }
else if (
type == 1) {
392 if (
h->c.first_slice_line) {
408 static const int sub_cbp_table[3] = { 2, 3, 1 };
412 h->c.block_last_index[n] = -1;
416 if (
w->per_block_abt)
418 w->abt_type_table[n] =
w->abt_type;
437 h->c.block_last_index[n] = 63;
442 h->c.inter_scantable.permutated);
459 if (
IS_SKIP(
h->c.cur_pic.mb_type[
h->c.mb_y *
h->c.mb_stride +
h->c.mb_x])) {
462 for (
i = 0;
i < 6;
i++)
463 h->c.block_last_index[
i] = -1;
466 h->c.mv[0][0][0] = 0;
467 h->c.mv[0][0][1] = 0;
469 w->common.hshift = 0;
477 h->c.mb_intra = (~
code & 0x40) >> 6;
488 for (
i = 0;
i < 6;
i++) {
495 cbp |=
val << (5 -
i);
499 if (!
h->c.mb_intra) {
504 h->c.bdsp.clear_blocks(
h->block[0]);
510 if (
w->abt_flag &&
w->per_mb_abt) {
512 if (!
w->per_block_abt)
515 w->per_block_abt = 0;
522 h->c.mv[0][0][0] =
mx;
523 h->c.mv[0][0][1] =
my;
525 for (
i = 0;
i < 6;
i++) {
528 "\nerror while decoding inter block: %d x %d (%d)\n",
529 h->c.mb_x,
h->c.mb_y,
i);
535 ff_dlog(
h->c.avctx,
"%d%d ",
h->c.inter_intra_pred, cbp);
536 ff_dlog(
h->c.avctx,
"I at %d %d %d %06X\n",
h->c.mb_x,
h->c.mb_y,
537 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
540 if (
h->c.inter_intra_pred) {
544 h->c.ac_pred,
h->c.h263_aic_dir,
h->c.mb_x,
h->c.mb_y);
551 h->c.bdsp.clear_blocks(
h->block[0]);
552 for (
i = 0;
i < 6;
i++) {
556 "\nerror while decoding intra block: %d x %d (%d)\n",
557 h->c.mb_x,
h->c.mb_y,
i);
573 s->private_ctx = &
w->common;
586 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)
static void wmv2_add_block(WMV2DecContext *w, int16_t blocks1[][64], uint8_t *dst, int stride, int n)
#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]
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)