66 if (prefer_delayed_free) {
74 }
else if (can_direct_free) {
86 int prefer_delayed_free,
int can_direct_free,
int free_mem)
92 for (i = 0; i < 5; i++)
149 for (i = 0; i < 4; i++)
152 for (i = 0; i < 4; i++)
156 for (i = 0; i < 3; i++)
165 for (i = 0; i < 4; i++)
174 const uint8_t *
sizes = buf;
186 if (buf_size - size < 0)
210 for (i = 0; i < 4; i++) {
273 int header_size, hscale, vscale, i, j, k, l, m, ret;
280 header_size =
AV_RL24(buf) >> 5;
292 if (header_size > buf_size - 7*s->
keyframe) {
298 if (
AV_RL24(buf) != 0x2a019d) {
302 width =
AV_RL16(buf+3) & 0x3fff;
303 height =
AV_RL16(buf+5) & 0x3fff;
304 hscale = buf[4] >> 6;
305 vscale = buf[6] >> 6;
309 if (hscale || vscale)
313 for (i = 0; i < 4; i++)
314 for (j = 0; j < 16; j++)
332 buf_size -= header_size;
373 for (i = 0; i < 4; i++)
374 for (j = 0; j < 8; j++)
375 for (k = 0; k < 3; k++)
392 for (i = 0; i < 4; i++)
395 for (i = 0; i < 3; i++)
399 for (i = 0; i < 2; i++)
400 for (j = 0; j < 19; j++)
424 for (i = 0; i < 3; i++)
426 for (i = 9; i > 3; i--)
432 const uint8_t *ps = p+2;
468 *mbsplits_cur, *firstidx;
488 for (n = 0; n < num; n++) {
490 uint32_t left, above;
491 const uint8_t *submv_prob;
494 left =
AV_RN32A(&left_mv[mbsplits_left[k + 3]]);
496 left =
AV_RN32A(&cur_mv[mbsplits_cur[k - 1]]);
498 above =
AV_RN32A(&top_mv[mbsplits_top[k + 12]]);
500 above =
AV_RN32A(&cur_mv[mbsplits_cur[k - 4]]);
529 enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
530 enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
535 uint8_t cnt[4] = { 0 };
543 #define MV_EDGE_CHECK(n)\
545 VP8Macroblock *edge = mb_edge[n];\
546 int edge_ref = edge->ref_frame;\
547 if (edge_ref != VP56_FRAME_CURRENT) {\
548 uint32_t mv = AV_RN32A(&edge->mv);\
550 if (cur_sign_bias != sign_bias[edge_ref]) {\
553 mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\
555 if (!n || mv != AV_RN32A(&near_mv[idx]))\
556 AV_WN32A(&near_mv[++idx], mv);\
557 cnt[idx] += 1 + (n != 2);\
559 cnt[CNT_ZERO] += 1 + (n != 2);\
572 if (cnt[CNT_SPLITMV] &&
AV_RN32A(&near_mv[1 + VP8_EDGE_TOP]) ==
AV_RN32A(&near_mv[1 + VP8_EDGE_TOPLEFT]))
573 cnt[CNT_NEAREST] += 1;
576 if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) {
577 FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]);
578 FFSWAP(
VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]);
585 clamp_mv(s, &mb->
mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]);
615 int mb_x,
int keyframe)
622 for (y = 0; y < 4; y++) {
623 for (x = 0; x < 4; x++) {
627 left[y] = top[x] = *intra4x4;
633 for (i = 0; i < 16; i++)
646 *segment = ref ? *ref : *segment;
689 #ifndef decode_block_coeffs_internal
701 int i, uint8_t *token_prob, int16_t qmul[2])
713 token_prob = probs[i][0];
719 token_prob = probs[i+1][1];
739 int cat = (a<<1) + b;
740 coeff = 3 + (8<<cat);
744 token_prob = probs[i+1][2];
767 int i,
int zero_nhood, int16_t qmul[2])
769 uint8_t *token_prob = probs[i][zero_nhood];
777 uint8_t t_nnz[9], uint8_t l_nnz[9])
779 int i, x, y, luma_start = 0, luma_ctx = 3;
780 int nnz_pred, nnz, nnz_total = 0;
785 nnz_pred = t_nnz[8] + l_nnz[8];
790 l_nnz[8] = t_nnz[8] = !!nnz;
804 for (y = 0; y < 4; y++)
805 for (x = 0; x < 4; x++) {
806 nnz_pred = l_nnz[y] + t_nnz[x];
811 t_nnz[x] = l_nnz[y] = !!nnz;
818 for (i = 4; i < 6; i++)
819 for (y = 0; y < 2; y++)
820 for (x = 0; x < 2; x++) {
821 nnz_pred = l_nnz[i+2*y] + t_nnz[i+2*x];
825 t_nnz[i+2*x] = l_nnz[i+2*y] = !!nnz;
837 void backup_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr,
838 int linesize,
int uvlinesize,
int simple)
842 AV_COPY64(top_border+16, src_cb + 7*uvlinesize);
843 AV_COPY64(top_border+24, src_cr + 7*uvlinesize);
848 void xchg_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr,
849 int linesize,
int uvlinesize,
int mb_x,
int mb_y,
int mb_width,
850 int simple,
int xchg)
852 uint8_t *top_border_m1 = top_border-32;
854 src_cb -= uvlinesize;
855 src_cr -= uvlinesize;
857 #define XCHG(a,b,xchg) do { \
858 if (xchg) AV_SWAP64(b,a); \
859 else AV_COPY64(b,a); \
862 XCHG(top_border_m1+8, src_y-8, xchg);
863 XCHG(top_border, src_y, xchg);
864 XCHG(top_border+8, src_y+8, 1);
865 if (mb_x < mb_width-1)
866 XCHG(top_border+32, src_y+16, 1);
870 if (!simple || !mb_y) {
871 XCHG(top_border_m1+16, src_cb-8, xchg);
872 XCHG(top_border_m1+24, src_cr-8, xchg);
873 XCHG(top_border+16, src_cb, 1);
874 XCHG(top_border+24, src_cr, 1);
991 uint8_t *ptr = dst[0];
993 uint8_t tr_top[4] = { 127, 127, 127, 127 };
997 uint8_t *tr_right = ptr - s->
linesize + 16;
1003 tr = tr_right[-1]*0x01010101u;
1004 tr_right = (uint8_t *)&tr;
1010 for (y = 0; y < 4; y++) {
1011 uint8_t *topright = ptr + 4 - s->
linesize;
1012 for (x = 0; x < 4; x++) {
1014 uint8_t *dst = ptr+4*x;
1020 topright = tr_right;
1025 dst = copy_dst + 12;
1029 AV_WN32A(copy_dst+4, 127
U * 0x01010101U);
1035 copy_dst[3] = ptr[4*x-s->
linesize-1];
1042 copy_dst[35] = 129
U;
1044 copy_dst[11] = ptr[4*x -1];
1045 copy_dst[19] = ptr[4*x+s->
linesize -1];
1046 copy_dst[27] = ptr[4*x+s->
linesize*2-1];
1047 copy_dst[35] = ptr[4*x+s->
linesize*3-1];
1053 s->
hpc.
pred4x4[mode](dst, topright, linesize);
1091 { 0, 1, 2, 1, 2, 1, 2, 1 },
1093 { 0, 3, 5, 3, 5, 3, 5, 3 },
1094 { 0, 2, 3, 2, 3, 2, 3, 2 },
1115 int x_off,
int y_off,
int block_w,
int block_h,
1119 uint8_t *src = ref->
data[0];
1123 int mx = (mv->
x << 1)&7, mx_idx =
subpel_idx[0][mx];
1124 int my = (mv->
y << 1)&7, my_idx =
subpel_idx[0][my];
1126 x_off += mv->
x >> 2;
1127 y_off += mv->
y >> 2;
1131 src += y_off * linesize + x_off;
1132 if (x_off < mx_idx || x_off >= width - block_w -
subpel_idx[2][mx] ||
1133 y_off < my_idx || y_off >= height - block_h -
subpel_idx[2][my]) {
1136 x_off - mx_idx, y_off - my_idx, width, height);
1139 mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);
1142 mc_func[0][0](dst, linesize, src + y_off * linesize + x_off, linesize, block_h, 0, 0);
1165 const VP56mv *
mv,
int x_off,
int y_off,
1166 int block_w,
int block_h,
int width,
int height,
int linesize,
1169 uint8_t *src1 = ref->
data[1], *src2 = ref->
data[2];
1175 x_off += mv->
x >> 3;
1176 y_off += mv->
y >> 3;
1179 src1 += y_off * linesize + x_off;
1180 src2 += y_off * linesize + x_off;
1182 if (x_off < mx_idx || x_off >= width - block_w -
subpel_idx[2][mx] ||
1183 y_off < my_idx || y_off >= height - block_h -
subpel_idx[2][my]) {
1186 x_off - mx_idx, y_off - my_idx, width, height);
1188 mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
1192 x_off - mx_idx, y_off - my_idx, width, height);
1194 mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
1196 mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
1197 mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
1201 mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);
1202 mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);
1208 AVFrame *ref_frame,
int x_off,
int y_off,
1209 int bx_off,
int by_off,
1210 int block_w,
int block_h,
1217 ref_frame, mv, x_off + bx_off, y_off + by_off,
1218 block_w, block_h, width, height, s->
linesize,
1226 x_off >>= 1; y_off >>= 1;
1227 bx_off >>= 1; by_off >>= 1;
1228 width >>= 1; height >>= 1;
1229 block_w >>= 1; block_h >>= 1;
1231 dst[2] + by_off * s->
uvlinesize + bx_off, ref_frame,
1232 &uvmv, x_off + bx_off, y_off + by_off,
1233 block_w, block_h, width, height, s->
uvlinesize,
1242 if (s->
ref_count[ref-1] > (mb_xy >> 5)) {
1243 int x_off = mb_x << 4, y_off = mb_y << 4;
1244 int mx = (mb->
mv.
x>>2) + x_off + 8;
1245 int my = (mb->
mv.
y>>2) + y_off;
1252 off= (mx>>1) + ((my>>1) + (mb_x&7))*s->
uvlinesize + 64;
1264 int x_off = mb_x << 4, y_off = mb_y << 4;
1272 0, 0, 16, 16, width,
height, &mb->
mv);
1279 for (y = 0; y < 4; y++) {
1280 for (x = 0; x < 4; x++) {
1283 4*x + x_off, 4*y + y_off, 4, 4,
1290 x_off >>= 1; y_off >>= 1; width >>= 1;
height >>= 1;
1291 for (y = 0; y < 2; y++) {
1292 for (x = 0; x < 2; x++) {
1293 uvmv.
x = mb->
bmv[ 2*y * 4 + 2*x ].
x +
1294 mb->
bmv[ 2*y * 4 + 2*x+1].
x +
1295 mb->
bmv[(2*y+1) * 4 + 2*x ].x +
1296 mb->
bmv[(2*y+1) * 4 + 2*x+1].
x;
1297 uvmv.
y = mb->
bmv[ 2*y * 4 + 2*x ].
y +
1298 mb->
bmv[ 2*y * 4 + 2*x+1].
y +
1299 mb->
bmv[(2*y+1) * 4 + 2*x ].y +
1300 mb->
bmv[(2*y+1) * 4 + 2*x+1].
y;
1301 uvmv.
x = (uvmv.
x + 2 + (uvmv.
x >> (
INT_BIT-1))) >> 2;
1302 uvmv.
y = (uvmv.
y + 2 + (uvmv.
y >> (
INT_BIT-1))) >> 2;
1308 dst[2] + 4*y*s->
uvlinesize + x*4, ref, &uvmv,
1309 4*x + x_off, 4*y + y_off, 4, 4,
1318 0, 0, 16, 8, width,
height, &bmv[0]);
1320 0, 8, 16, 8, width,
height, &bmv[1]);
1324 0, 0, 8, 16, width,
height, &bmv[0]);
1326 8, 0, 8, 16, width,
height, &bmv[1]);
1330 0, 0, 8, 8, width,
height, &bmv[0]);
1332 8, 0, 8, 8, width,
height, &bmv[1]);
1334 0, 8, 8, 8, width,
height, &bmv[2]);
1336 8, 8, 8, 8, width,
height, &bmv[3]);
1346 uint8_t *y_dst = dst[0];
1347 for (y = 0; y < 4; y++) {
1350 if (nnz4&~0x01010101) {
1351 for (x = 0; x < 4; x++) {
1352 if ((uint8_t)nnz4 == 1)
1354 else if((uint8_t)nnz4 > 1)
1368 for (ch = 0; ch < 2; ch++) {
1371 uint8_t *ch_dst = dst[1+ch];
1372 if (nnz4&~0x01010101) {
1373 for (y = 0; y < 2; y++) {
1374 for (x = 0; x < 2; x++) {
1375 if ((uint8_t)nnz4 == 1)
1377 else if((uint8_t)nnz4 > 1)
1381 goto chroma_idct_end;
1395 int interior_limit, filter_level;
1409 filter_level = av_clip_uintp2(filter_level, 6);
1411 interior_limit = filter_level;
1416 interior_limit =
FFMAX(interior_limit, 1);
1425 int mbedge_lim, bedge_lim, hev_thresh;
1431 static const uint8_t hev_thresh_lut[2][64] = {
1432 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1434 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1436 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1445 bedge_lim = 2*filter_level + inner_limit;
1446 mbedge_lim = bedge_lim + 4;
1448 hev_thresh = hev_thresh_lut[s->
keyframe][filter_level];
1452 mbedge_lim, inner_limit, hev_thresh);
1454 mbedge_lim, inner_limit, hev_thresh);
1459 inner_limit, hev_thresh);
1461 inner_limit, hev_thresh);
1463 inner_limit, hev_thresh);
1465 uvlinesize, bedge_lim,
1466 inner_limit, hev_thresh);
1471 mbedge_lim, inner_limit, hev_thresh);
1473 mbedge_lim, inner_limit, hev_thresh);
1478 linesize, bedge_lim,
1479 inner_limit, hev_thresh);
1481 linesize, bedge_lim,
1482 inner_limit, hev_thresh);
1484 linesize, bedge_lim,
1485 inner_limit, hev_thresh);
1487 dst[2] + 4 * uvlinesize,
1488 uvlinesize, bedge_lim,
1489 inner_limit, hev_thresh);
1495 int mbedge_lim, bedge_lim;
1504 bedge_lim = 2*filter_level + inner_limit;
1505 mbedge_lim = bedge_lim + 4;
1534 for (mb_x = 0; mb_x < s->
mb_width; mb_x++) {
1546 uint8_t *dst = curframe->
data[0] + 16*mb_y*s->
linesize;
1549 for (mb_x = 0; mb_x < s->
mb_width; mb_x++) {
1568 int ret, mb_x, mb_y, i, y, referenced;
1592 for (i = 0; i < 5; i++)
1594 &s->
frames[i] != prev_frame &&
1601 for (i = 0; i < 5; i++)
1602 if (&s->
frames[i] != prev_frame &&
1613 if (curframe->data[0])
1618 curframe->reference = referenced ? 3 : 0;
1654 s->
linesize = curframe->linesize[0];
1674 #define MARGIN (16 << 2)
1678 for (mb_y = 0; mb_y < s->
mb_height; mb_y++) {
1683 curframe->data[0] + 16*mb_y*s->
linesize,
1688 memset(mb - 1, 0,
sizeof(*mb));
1694 for (i = 0; i < 3; i++)
1695 for (y = 0; y < 16>>!!i; y++)
1696 dst[i][y*curframe->linesize[i]-1] = 129;
1706 for (mb_x = 0; mb_x < s->
mb_width; mb_x++, mb_xy++, mb++) {
1711 decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy,
1809 #define REBASE(pic) \
1810 pic ? pic - &s_src->frames[0] + &s->frames[0] : NULL
1822 s->
prob[0] = s_src->
prob[!s_src->update_probabilities];
void(* vp8_mc_func)(uint8_t *dst, int dstStride, uint8_t *src, int srcStride, int h, int x, int y)
static void get_quants(VP8Context *s)
static void vp8_decode_flush_impl(AVCodecContext *avctx, int prefer_delayed_free, int can_direct_free, int free_mem)
VP8Macroblock * macroblocks
static const uint8_t vp8_dc_qlookup[VP8_MAX_QUANT+1]
static const uint8_t vp8_submv_prob[5][3]
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.
static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
static void vp8_release_frame(VP8Context *s, AVFrame *f, int prefer_delayed_free, int can_direct_free)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
(only used in prediction) no split MVs
static av_always_inline void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y)
Apply motion vectors to prediction buffer, chapter 18.
void(* vp8_idct_add)(uint8_t *dst, DCTELEM block[16], int stride)
static void update_lf_deltas(VP8Context *s)
int8_t sign_bias[4]
one state [0, 1] per ref frame type
int coded_width
Bitstream width / height, may be different from width/height if lowres enabled.
void(* prefetch)(void *mem, int stride, int h)
static av_always_inline int vp8_rac_get_tree(VP56RangeCoder *c, const int8_t(*tree)[2], const uint8_t *probs)
static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
void(* pred16x16[4+3+2])(uint8_t *src, int stride)
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * intra4x4_pred_mode_top
static VP56Frame ref_to_update(VP8Context *s, int update, VP56Frame ref)
Determine which buffers golden and altref should be updated with after this frame.
static void release_queued_segmaps(VP8Context *s, int is_close)
uint8_t token[4][16][3][NUM_DCT_TOKENS-1]
static av_always_inline void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref)
static av_always_inline int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf)
static void vp8_decode_flush(AVCodecContext *avctx)
vp8_mc_func put_vp8_bilinear_pixels_tab[3][3][3]
#define DECLARE_ALIGNED(n, t, v)
static av_always_inline void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, int mb_x, int keyframe)
#define FF_ARRAY_ELEMS(a)
static const int8_t vp8_pred8x8c_tree[3][2]
static av_always_inline int check_intra_pred8x8_mode(int mode, int mb_x, int mb_y)
static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16], uint8_t probs[16][3][NUM_DCT_TOKENS-1], int i, uint8_t *token_prob, int16_t qmul[2])
void(* vp8_v_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, int stride, int flim_E, int flim_I, int hev_thresh)
int update_probabilities
If this flag is not set, all the probability updates are discarded after this frame is decoded...
static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, VP8FilterStrength *f)
static const uint8_t zigzag_scan[16]
vp8_mc_func put_vp8_epel_pixels_tab[3][3][3]
first dimension: width>>3, height is assumed equal to width second dimension: 0 if no vertical interp...
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 const uint8_t vp8_pred8x8c_prob_inter[3]
uint8_t(* top_nnz)[9]
For coeff decode, we need to know whether the above block had non-zero coefficients.
uint8_t chroma_pred_mode
8x8c pred mode of the current macroblock
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static const uint8_t vp8_mbsplits[5][16]
enum AVDiscard skip_frame
static const int8_t vp8_pred16x16_tree_intra[4][2]
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
int update_golden
VP56_FRAME_NONE if not updated, or which frame to copy if so.
static av_always_inline void xchg_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int mb_x, int mb_y, int mb_width, int simple, int xchg)
struct VP8DecoderContext VP8Context
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define TM_VP8_PRED
"True Motion", used instead of plane
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
#define DIAG_DOWN_LEFT_PRED
uint8_t * edge_emu_buffer
static const uint8_t vp8_mv_update_prob[2][19]
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
int update_last
update VP56_FRAME_PREVIOUS with the current one
static int update_dimensions(VP8Context *s, int width, int height)
static av_always_inline int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16], uint8_t probs[16][3][NUM_DCT_TOKENS-1], int i, int zero_nhood, int16_t qmul[2])
uint8_t intra4x4_pred_mode_mb[16]
void(* vp8_idct_dc_add)(uint8_t *dst, DCTELEM block[16], int stride)
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
static void parse_segment_info(VP8Context *s)
int num_coeff_partitions
All coefficients are contained in separate arith coding contexts.
static const uint8_t vp8_token_default_probs[4][8][3][NUM_DCT_TOKENS-1]
vp8_mc_func put_pixels_tab[3][3][3]
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
VP8FilterStrength * filter_strength
uint8_t intra4x4_pred_mode_left[4]
#define VERT_VP8_PRED
for VP8, VERT_PRED is the average of
void(* vp8_idct_dc_add4uv)(uint8_t *dst, DCTELEM block[4][16], int stride)
void(* vp8_v_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, int stride, int flim_E, int flim_I, int hev_thresh)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
void(* vp8_h_loop_filter16y)(uint8_t *dst, int stride, int flim_E, int flim_I, int hev_thresh)
static const uint8_t vp8_mbsplit_count[4]
void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
Set the intra prediction function pointers.
static const int8_t vp8_coeff_band_indexes[8][10]
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static const uint8_t vp8_pred4x4_mode[]
static av_always_inline void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int mb_xy, int ref)
void(* vp8_luma_dc_wht)(DCTELEM block[4][4][16], DCTELEM dc[16])
static const uint8_t vp8_dct_cat2_prob[]
Multithreading support functions.
static const uint8_t vp8_mv_default_prob[2][19]
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void(* vp8_v_loop_filter_simple)(uint8_t *dst, int stride, int flim)
VP8 compatible video decoder.
static const uint8_t vp8_mbfirstidx[4][16]
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
VP8Macroblock * macroblocks_base
static const uint8_t vp8_pred4x4_prob_inter[9]
void(* vp8_h_loop_filter_simple)(uint8_t *dst, int stride, int flim)
void(* pred8x8[4+3+4])(uint8_t *src, int stride)
void(* vp8_v_loop_filter16y)(uint8_t *dst, int stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_v_loop_filter16y_inner)(uint8_t *dst, int stride, int flim_E, int flim_I, int hev_thresh)
#define CODEC_FLAG_EMU_EDGE
Don't draw edges.
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
static const uint8_t vp8_pred16x16_prob_inter[4]
useful rectangle filling function
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
static int read_mv_component(VP56RangeCoder *c, const uint8_t *p)
Motion vector coding, 17.1.
static int vp8_alloc_frame(VP8Context *s, AVFrame *f)
struct VP8Context::@53 qmat[4]
Macroblocks can have one of 4 different quants in a frame when segmentation is enabled.
static av_always_inline void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y)
static av_unused int vp8_rac_get_sint(VP56RangeCoder *c, int bits)
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
int8_t ref[4]
filter strength adjustment for macroblocks that reference: [0] - intra / VP56_FRAME_CURRENT [1] - VP5...
struct VP8Context::@52 filter
static void free_buffers(VP8Context *s)
VP8 compatible video decoder.
void(* vp8_h_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, int stride, int flim_E, int flim_I, int hev_thresh)
static av_unused int vp8_rac_get_uint(VP56RangeCoder *c, int bits)
int16_t luma_dc_qmul[2]
luma dc-only block quant
static av_always_inline void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
static const uint8_t vp8_pred4x4_prob_intra[10][10][9]
void(* vp8_h_loop_filter16y_inner)(uint8_t *dst, int stride, int flim_E, int flim_I, int hev_thresh)
uint8_t(* top_border)[16+8+8]
Cache of the top row needed for intra prediction 16 for luma, 8 for each chroma plane.
uint8_t non_zero_count_cache[6][4]
This is the index plus one of the last non-zero coeff for each of the blocks in the current macrobloc...
static av_always_inline void decode_mb_coeffs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, uint8_t t_nnz[9], uint8_t l_nnz[9])
#define vp56_rac_get_prob
static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y)
#define VERT_PRED
Prediction types.
#define DIAG_DOWN_RIGHT_PRED
static const int8_t mv[256][2]
static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob)
static const uint8_t vp8_pred8x8c_prob_intra[3]
void ff_thread_await_progress(AVFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
discard all non reference
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint8_t vp8_mbsplit_prob[3]
VP56RangeCoder c
header context, includes mb modes and motion vectors
VP56RangeCoder coeff_partition[8]
static const int8_t vp8_pred16x16_tree_inter[4][2]
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)
static av_always_inline void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, AVFrame *ref, const VP56mv *mv, int x_off, int y_off, int block_w, int block_h, int width, int height, int linesize, vp8_mc_func mc_func[3][3])
chroma MC function
uint8_t segment
segment of the current macroblock
static av_always_inline int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb)
Split motion vector prediction, 16.4.
static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)
static av_always_inline int check_dc_pred8x8_mode(int mode, int mb_x, int mb_y)
void(* vp8_idct_dc_add4y)(uint8_t *dst, DCTELEM block[4][16], int stride)
static const int8_t vp8_pred4x4_tree[9][2]
static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb)
uint8_t enabled
whether each mb can have a different strength based on mode/ref
void(* vp8_luma_dc_wht_dc)(DCTELEM block[4][4][16], DCTELEM dc[16])
int8_t * ref_index[2]
motion reference frame index the order in which these are stored can depend on the codec...
static const uint8_t subpel_idx[3][8]
static void update_refs(VP8Context *s)
static av_always_inline int vp8_rac_get_coeff(VP56RangeCoder *c, const uint8_t *prob)
static const uint8_t vp8_coeff_band[16]
static av_always_inline void vp8_mc_part(VP8Context *s, uint8_t *dst[3], AVFrame *ref_frame, int x_off, int y_off, int bx_off, int by_off, int block_w, int block_h, int width, int height, VP56mv *mv)
uint8_t * segmentation_maps[5]
A list of segmentation_map buffers that are to be free()'ed in the next decoding iteration.
struct VP8Context::@51 segmentation
Base parameters for segmentation, i.e.
struct VP8Context::@55 prob[2]
These are all of the updatable probabilities for binary decisions.
static const uint16_t vp8_ac_qlookup[VP8_MAX_QUANT+1]
static av_cold int vp8_decode_init(AVCodecContext *avctx)
static const uint8_t vp8_pred16x16_prob_intra[4]
static const int8_t vp8_segmentid_tree[][2]
void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
void(* pred4x4[9+3+3])(uint8_t *src, const uint8_t *topright, int stride)
static void filter_mb_row_simple(VP8Context *s, AVFrame *curframe, int mb_y)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int8_t mode[VP8_MVMODE_SPLIT+1]
filter strength adjustment for the following macroblock modes: [0-3] - i16x16 (always zero) [4] - i4x...
2 8x16 blocks (horizontal)
static av_always_inline void backup_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple)
static void filter_mb_row(VP8Context *s, AVFrame *curframe, int mb_y)
struct VP8Context::@54 lf_delta
common internal api header.
void(* vp8_h_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, int stride, int flim_E, int flim_I, int hev_thresh)
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx)
static av_always_inline int check_tm_pred4x4_mode(int mode, int mb_x, int mb_y)
enum AVDiscard skip_loop_filter
static av_always_inline int vp8_rac_get(VP56RangeCoder *c)
static const SiprModeParam modes[MODE_COUNT]
static av_always_inline int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y)
struct AVCodecInternal * internal
Private context used for internal data.
#define HOR_VP8_PRED
unaveraged version of HOR_PRED, see
static av_always_inline int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y)
static av_always_inline void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref, const VP56mv *mv, int x_off, int y_off, int block_w, int block_h, int width, int height, int linesize, vp8_mc_func mc_func[3][3])
luma MC function
static av_unused int vp8_rac_get_nn(VP56RangeCoder *c)
static const uint8_t vp8_token_update_probs[4][8][3][NUM_DCT_TOKENS-1]
int8_t filter_level[4]
base loop filter level
static const int vp8_mode_contexts[6][4]
static const uint8_t vp8_dct_cat1_prob[]
void ff_thread_report_progress(AVFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
#define FFSWAP(type, a, b)
discard all frames except keyframes
static const int sizes[][2]
static av_always_inline const uint8_t * get_submv_prob(uint32_t left, uint32_t top)
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
Log a generic warning message about a missing feature.
const uint8_t *const ff_vp8_dct_cat_prob[]
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f, int mb_x, int mb_y)
static av_cold int vp8_decode_free(AVCodecContext *avctx)