45 VP56mv vect[2] = {{0,0}, {0,0}};
49 for (pos=0; pos<12; pos++) {
51 mvp.
y = row + vp56_candidate_predictor_pos[pos][1];
85 for (ctx=0; ctx<3; ctx++) {
93 for (type=0; type<10; type++) {
110 for (ctx=0; ctx<3; ctx++) {
113 for (type=0; type<10; type++)
116 for (type=0; type<10; type++) {
117 int p02, p34, p0234, p17, p56, p89, p5689, p156789;
132 p156789 = p17 + p5689;
134 model->
mb_type[ctx][type][1] = 1 + 255 * p0234/(1+p0234+p156789);
135 model->
mb_type[ctx][type][2] = 1 + 255 * p02 / (1+p0234);
136 model->
mb_type[ctx][type][3] = 1 + 255 * p17 / (1+p156789);
137 model->
mb_type[ctx][type][4] = 1 + 255 * p[0] / (1+p02);
138 model->
mb_type[ctx][type][5] = 1 + 255 * p[3] / (1+p34);
139 model->
mb_type[ctx][type][6] = 1 + 255 * p[1] / (1+p17);
140 model->
mb_type[ctx][type][7] = 1 + 255 * p56 / (1+p5689);
141 model->
mb_type[ctx][type][8] = 1 + 255 * p[5] / (1+p56);
142 model->
mb_type[ctx][type][9] = 1 + 255 * p[8] / (1+p89);
151 VP56mb prev_type,
int ctx)
169 for (b=0; b<4; b++) {
176 for (b=0; b<4; b++) {
269 for (b=0; b<6; b++) {
286 if (count < 2 && ref_frame == ab[-1+2*i].ref_frame) {
306 int stride,
int dx,
int dy)
319 int overlap_offset = 0;
328 deblock_filtering = 0;
344 stride, 12, 12, x, y,
348 src_offset = 2 + 2*
stride;
349 }
else if (deblock_filtering) {
356 src_offset = 2 + 2*
stride;
362 if (deblock_filtering)
365 if (s->
mv[b].
x & mask)
366 overlap_offset += (s->
mv[
b].
x > 0) ? 1 : -1;
367 if (s->
mv[b].
y & mask)
368 overlap_offset += (s->
mv[
b].
y > 0) ? stride : -stride;
370 if (overlap_offset) {
372 s->
filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
376 src_block+src_offset+overlap_offset,
385 AVFrame *frame_current, *frame_ref;
388 int b, ab, b_max, plane,
off;
403 frame_ref = s->
framep[ref_frame];
408 b_max = 6 - 2*is_alpha;
412 for (b=0; b<b_max; b++) {
421 for (b=0; b<b_max; b++) {
439 for (b=0; b<b_max; b++) {
440 int x_off = b==1 || b==3 ? 8 : 0;
441 int y_off = b==2 || b==3 ? 8 : 0;
444 16*col+x_off, 16*row+y_off);
492 const uint8_t *buf = avpkt->
data;
495 int remaining_buf_size = avpkt->
size;
499 if (remaining_buf_size < 3)
501 alpha_offset = bytestream_get_be24(&buf);
502 remaining_buf_size -= 3;
503 if (remaining_buf_size < alpha_offset)
507 for (is_alpha=0; is_alpha < 1+s->
has_alpha; is_alpha++) {
508 int mb_row, mb_col, mb_row_flip, mb_offset = 0;
509 int block, y, uv, stride_y, stride_uv;
510 int golden_frame = 0;
515 res = s->
parse_header(s, buf, remaining_buf_size, &golden_frame);
518 for (i = 0; i < 4; i++) {
527 for (i = 0; i < 4; i++) {
570 for (block=0; block < 4*s->
mb_width+6; block++) {
585 for (mb_row=0; mb_row<s->
mb_height; mb_row++) {
589 mb_row_flip = mb_row;
591 for (block=0; block<4; block++) {
610 s->
block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv;
613 for (mb_col=0; mb_col<s->
mb_width; mb_col++) {
616 for (y=0; y<4; y++) {
621 for (uv=4; uv<6; uv++) {
640 remaining_buf_size -= alpha_offset;
av_cold int ff_vp56_free(AVCodecContext *avctx)
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
void(* emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Motion estimation with emulated edge values.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
void(* edge_filter_ver)(uint8_t *yuv, int stride, int t)
const uint8_t ff_zigzag_direct[64]
Inter MB, first vector, from previous frame.
int qstride
QP store stride.
VP5 and VP6 compatible video decoder (common features)
static int vp56_get_vectors_predictors(VP56Context *s, int row, int col, VP56Frame ref_frame)
int coded_width
Bitstream width / height, may be different from width/height if lowres enabled.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
uint8_t mb_types_stats[3][10][2]
void(* idct_add)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
VP56ParseCoeffModels parse_coeff_models
VP56mv vector_candidate[2]
static VP56mb vp56_parse_mb_type(VP56Context *s, VP56mb prev_type, int ctx)
#define FF_QSCALE_TYPE_VP56
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static VP56mb vp56_decode_mv(VP56Context *s, int row, int col)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const uint8_t vp56_mb_type_model_model[]
int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
uint8_t * edge_emu_buffer_alloc
void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec)
VP56ParseCoeff parse_coeff
uint8_t idct_permutation[64]
idct input permutation.
Inter MB, second vector, from golden frame.
static av_always_inline int vp56_rac_get_tree(VP56RangeCoder *c, const VP56Tree *tree, const uint8_t *probs)
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
VP56ParseVectorAdjustment parse_vector_adjustment
Inter MB, first vector, from golden frame.
static const VP56Tree vp56_pmbt_tree[]
static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2]
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static const uint16_t mask[17]
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> clip to unsigned 8 bit -> dest.
static av_always_inline int vp56_rac_get(VP56RangeCoder *c)
static void vp56_parse_mb_type_models(VP56Context *s)
static const VP56Frame vp56_reference_frame[]
void av_log(void *avcl, int level, const char *fmt,...)
void ff_vp56_init_dequant(VP56Context *s, int quantizer)
DCTELEM block_coeff[6][64]
VP56Macroblock * macroblocks
static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, int stride, int x, int y)
VP56ParseVectorModels parse_vector_models
static const uint8_t vp56_filter_threshold[]
const uint8_t * vp56_coord_div
VP5 and VP6 compatible video decoder (common data)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
static const VP56Tree vp56_pmbtm_tree[]
struct AVFrame AVFrame
Audio Video Frame.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
Inter MB, 4 vectors, from previous frame.
static const uint8_t vp56_ac_dequant[64]
uint8_t coeff_ctx_last[4]
Inter MB, no vector, from previous frame.
static const uint8_t vp56_dc_dequant[64]
VP56DefaultModelsInit default_models_init
#define vp56_rac_get_prob
static const int8_t mv[256][2]
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
static int vp56_size_changed(AVCodecContext *avctx)
main external API structure.
uint8_t mb_type[3][10][10]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Inter MB, second vector, from previous frame.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Inter MB, above/left vector + delta, from golden frame.
static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
static void vp56_decode_4mv(VP56Context *s, int row, int col)
VP56ParseHeader parse_header
av_cold void ff_vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int8_t * qscale_table
QP table.
void(* edge_filter_hor)(uint8_t *yuv, int stride, int t)
void(* put_no_rnd_pixels_l2[2])(uint8_t *block, const uint8_t *a, const uint8_t *b, int line_size, int h)
void(* clear_blocks)(DCTELEM *blocks)
Inter MB, no vector, from golden frame.
uint8_t * edge_emu_buffer
static void flip(AVCodecContext *avctx, AVPicture *picture)
enum AVDiscard skip_loop_filter
static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
static av_unused int vp56_rac_gets(VP56RangeCoder *c, int bits)
Inter MB, above/left vector + delta, from previous frame.
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
int key_frame
1 -> keyframe, 0-> not
#define FFSWAP(type, a, b)
discard all frames except keyframes
static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv, int stride, int dx, int dy)
static const int8_t vp56_candidate_predictor_pos[12][2]
const uint8_t vp56_b6to4[]
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)