46 VP56mv vect[2] = {{0,0}, {0,0}};
50 for (pos=0; pos<12; pos++) {
52 mvp.
y = row + vp56_candidate_predictor_pos[pos][1];
86 for (ctx=0; ctx<3; ctx++) {
94 for (type=0; type<10; type++) {
111 for (ctx=0; ctx<3; ctx++) {
114 for (type=0; type<10; type++)
117 for (type=0; type<10; type++) {
118 int p02, p34, p0234, p17, p56, p89, p5689, p156789;
133 p156789 = p17 + p5689;
135 model->
mb_type[ctx][type][1] = 1 + 255 * p0234/(1+p0234+p156789);
136 model->
mb_type[ctx][type][2] = 1 + 255 * p02 / (1+p0234);
137 model->
mb_type[ctx][type][3] = 1 + 255 * p17 / (1+p156789);
138 model->
mb_type[ctx][type][4] = 1 + 255 * p[0] / (1+p02);
139 model->
mb_type[ctx][type][5] = 1 + 255 * p[3] / (1+p34);
140 model->
mb_type[ctx][type][6] = 1 + 255 * p[1] / (1+p17);
141 model->
mb_type[ctx][type][7] = 1 + 255 * p56 / (1+p5689);
142 model->
mb_type[ctx][type][8] = 1 + 255 * p[5] / (1+p56);
143 model->
mb_type[ctx][type][9] = 1 + 255 * p[8] / (1+p89);
152 VP56mb prev_type,
int ctx)
170 for (b=0; b<4; b++) {
177 for (b=0; b<4; b++) {
270 for (b=0; b<6; b++) {
287 if (count < 2 && ref_frame == ab[-1+2*i].ref_frame) {
307 int stride,
int dx,
int dy)
320 int overlap_offset = 0;
329 deblock_filtering = 0;
345 stride, 12, 12, x, y,
349 src_offset = 2 + 2*
stride;
350 }
else if (deblock_filtering) {
357 src_offset = 2 + 2*
stride;
363 if (deblock_filtering)
366 if (s->
mv[b].
x & mask)
367 overlap_offset += (s->
mv[
b].
x > 0) ? 1 : -1;
368 if (s->
mv[b].
y & mask)
369 overlap_offset += (s->
mv[
b].
y > 0) ? stride : -stride;
371 if (overlap_offset) {
373 s->
filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
377 src_block+src_offset+overlap_offset,
386 AVFrame *frame_current, *frame_ref;
389 int b, ab, b_max, plane,
off;
404 frame_ref = s->
framep[ref_frame];
409 b_max = 6 - 2*is_alpha;
413 for (b=0; b<b_max; b++) {
422 for (b=0; b<b_max; b++) {
440 for (b=0; b<b_max; b++) {
441 int x_off = b==1 || b==3 ? 8 : 0;
442 int y_off = b==2 || b==3 ? 8 : 0;
445 16*col+x_off, 16*row+y_off);
496 int remaining_buf_size = avpkt->
size;
500 if (remaining_buf_size < 3)
502 alpha_offset = bytestream_get_be24(&buf);
503 remaining_buf_size -= 3;
504 if (remaining_buf_size < alpha_offset)
508 for (is_alpha=0; is_alpha < 1+s->
has_alpha; is_alpha++) {
509 int mb_row, mb_col, mb_row_flip, mb_offset = 0;
510 int block, y, uv, stride_y, stride_uv;
511 int golden_frame = 0;
516 res = s->
parse_header(s, buf, remaining_buf_size, &golden_frame);
519 for (i = 0; i < 4; i++) {
528 for (i = 0; i < 4; i++) {
571 for (block=0; block < 4*s->
mb_width+6; block++) {
586 for (mb_row=0; mb_row<s->
mb_height; mb_row++) {
590 mb_row_flip = mb_row;
592 for (block=0; block<4; block++) {
611 s->
block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv;
614 for (mb_col=0; mb_col<s->
mb_width; mb_col++) {
617 for (y=0; y<4; y++) {
622 for (uv=4; uv<6; uv++) {
641 remaining_buf_size -= alpha_offset;
av_cold int ff_vp56_free(AVCodecContext *avctx)
const struct AVCodec * codec
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
discard all frames except keyframes
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
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.
This structure describes decoded (raw) audio or video data.
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.
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]
VP56ParseCoeffModels parse_coeff_models
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
VP56mv vector_candidate[2]
static VP56mb vp56_parse_mb_type(VP56Context *s, VP56mb prev_type, int ctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void ff_vp56dsp_init(VP56DSPContext *s, enum AVCodecID codec)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
void(* emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Copy a rectangular area of samples to a temporary buffer and replicate the border samples...
#define FFSWAP(type, a, b)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
static VP56mb vp56_decode_mv(VP56Context *s, int row, int col)
static const uint8_t vp56_mb_type_model_model[]
uint8_t * edge_emu_buffer_alloc
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)
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.
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 ff_videodsp_init(VideoDSPContext *ctx, int bpc)
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
const uint8_t ff_vp56_b6to4[]
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[]
Inter MB, 4 vectors, from previous frame.
static const uint8_t vp56_ac_dequant[64]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
uint8_t coeff_ctx_last[4]
Inter MB, no vector, from previous frame.
int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint8_t vp56_dc_dequant[64]
VP56DefaultModelsInit default_models_init
#define vp56_rac_get_prob
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
const uint8_t ff_vp56_b2p[]
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]
Inter MB, second vector, from previous frame.
#define FF_QSCALE_TYPE_VP56
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)
void ff_init_scantable_permutation(uint8_t *idct_permutation, int idct_permutation_type)
void(* idct_add)(uint8_t *dest, int line_size, DCTELEM *block)
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.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
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
static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv, int stride, int dx, int dy)
av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
static const int8_t vp56_candidate_predictor_pos[12][2]
This structure stores compressed data.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)