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,
209 if (
s->picture_number == 0)
217 s->chroma_qscale =
s->qscale =
get_bits(&
s->gb, 5);
245 memset(
s->current_picture_ptr->mb_type, 0,
246 sizeof(*
s->current_picture_ptr->mb_type) *
247 s->mb_height *
s->mb_stride);
254 if (
w->per_mb_rl_bit)
257 s->per_mb_rl_table = 0;
259 if (!
s->per_mb_rl_table) {
274 s->inter_intra_pred = 0;
278 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
279 s->qscale,
s->rl_chroma_table_index,
s->rl_table_index,
280 s->dc_table_index,
s->per_mb_rl_table,
w->j_type);
304 if (
w->per_mb_rl_bit)
307 s->per_mb_rl_table = 0;
309 if (!
s->per_mb_rl_table) {
311 s->rl_chroma_table_index =
s->rl_table_index;
320 s->inter_intra_pred = 0;
325 "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
326 "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
327 s->rl_table_index,
s->rl_chroma_table_index,
328 s->dc_table_index,
s->mv_table_index,
329 s->per_mb_rl_table,
s->qscale,
s->mspel,
330 w->per_mb_abt,
w->abt_type,
w->cbp_table_index,
331 s->inter_intra_pred);
334 s->esc3_level_length = 0;
335 s->esc3_run_length = 0;
340 &
s->gb, &
s->mb_x, &
s->mb_y,
341 2 *
s->qscale, (
s->qscale - 1) | 1,
342 s->loop_filter,
s->low_delay);
345 (
w->s.mb_x >> 1) - 1, (
w->s.mb_y >> 1) - 1,
359 if ((((*mx_ptr) | (*my_ptr)) & 1) &&
s->mspel)
362 w->common.hshift = 0;
369 int16_t *
A, *
B, *
C, *mot_val;
372 xy =
s->block_index[0];
374 mot_val =
s->current_picture.motion_val[0][xy];
376 A =
s->current_picture.motion_val[0][xy - 1];
377 B =
s->current_picture.motion_val[0][xy -
wrap];
378 C =
s->current_picture.motion_val[0][xy + 2 -
wrap];
380 if (
s->mb_x && !
s->first_slice_line && !
s->mspel &&
w->top_left_mv_flag)
393 }
else if (
type == 1) {
398 if (
s->first_slice_line) {
414 static const int sub_cbp_table[3] = { 2, 3, 1 };
418 s->block_last_index[n] = -1;
422 if (
w->per_block_abt)
424 w->abt_type_table[n] =
w->abt_type;
439 s->block_last_index[n] = 63;
444 s->inter_scantable.permutated);
460 if (
IS_SKIP(
s->current_picture.mb_type[
s->mb_y *
s->mb_stride +
s->mb_x])) {
463 for (
i = 0;
i < 6;
i++)
464 s->block_last_index[
i] = -1;
470 w->common.hshift = 0;
478 s->mb_intra = (~
code & 0x40) >> 6;
489 for (
i = 0;
i < 6;
i++) {
496 cbp |=
val << (5 -
i);
505 s->bdsp.clear_blocks(
s->block[0]);
506 if (
s->per_mb_rl_table) {
508 s->rl_chroma_table_index =
s->rl_table_index;
511 if (
w->abt_flag &&
w->per_mb_abt) {
513 if (!
w->per_block_abt)
516 w->per_block_abt = 0;
526 for (
i = 0;
i < 6;
i++) {
529 "\nerror while decoding inter block: %d x %d (%d)\n",
530 s->mb_x,
s->mb_y,
i);
536 ff_dlog(
s->avctx,
"%d%d ",
s->inter_intra_pred, cbp);
537 ff_dlog(
s->avctx,
"I at %d %d %d %06X\n",
s->mb_x,
s->mb_y,
538 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
541 if (
s->inter_intra_pred) {
545 s->ac_pred,
s->h263_aic_dir,
s->mb_x,
s->mb_y);
547 if (
s->per_mb_rl_table && cbp) {
549 s->rl_chroma_table_index =
s->rl_table_index;
552 s->bdsp.clear_blocks(
s->block[0]);
553 for (
i = 0;
i < 6;
i++) {
556 "\nerror while decoding intra block: %d x %d (%d)\n",
557 s->mb_x,
s->mb_y,
i);
572 s->private_ctx = &
w->common;
582 w->s.block,
w->s.block_last_index,
583 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)
#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)
static int16_t block1[64]
av_cold void ff_wmv2_common_init(MpegEncContext *s)
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)