39 #define VP9_SYNCCODE 0x498342
67 for (
i = 0;
i < n;
i++)
76 static void vp9_report_tile_progress(
VP9Context *
s,
int field,
int n) {
83 static void vp9_await_tile_progress(
VP9Context *
s,
int field,
int n) {
109 f->segmentation_map =
NULL;
110 f->hwaccel_picture_private =
NULL;
122 sz = 64 *
s->sb_cols *
s->sb_rows;
123 if (sz !=
s->frame_extradata_pool_size) {
126 if (!
s->frame_extradata_pool) {
127 s->frame_extradata_pool_size = 0;
130 s->frame_extradata_pool_size = sz;
136 memset(
f->extradata->data, 0,
f->extradata->size);
138 f->segmentation_map =
f->extradata->data;
146 if (!
f->hwaccel_priv_buf)
148 f->hwaccel_picture_private =
f->hwaccel_priv_buf->data;
175 if (
src->hwaccel_picture_private) {
191 #define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + \
192 CONFIG_VP9_D3D11VA_HWACCEL * 2 + \
193 CONFIG_VP9_NVDEC_HWACCEL + \
194 CONFIG_VP9_VAAPI_HWACCEL + \
195 CONFIG_VP9_VDPAU_HWACCEL)
199 int bytesperpixel =
s->bytesperpixel, ret, cols, rows;
204 if (!(
s->pix_fmt ==
s->gf_fmt &&
w ==
s->w &&
h ==
s->h)) {
208 switch (
s->pix_fmt) {
211 #if CONFIG_VP9_DXVA2_HWACCEL
214 #if CONFIG_VP9_D3D11VA_HWACCEL
218 #if CONFIG_VP9_NVDEC_HWACCEL
221 #if CONFIG_VP9_VAAPI_HWACCEL
224 #if CONFIG_VP9_VDPAU_HWACCEL
229 #if CONFIG_VP9_NVDEC_HWACCEL
232 #if CONFIG_VP9_VAAPI_HWACCEL
235 #if CONFIG_VP9_VDPAU_HWACCEL
241 *fmtp++ =
s->pix_fmt;
249 s->gf_fmt =
s->pix_fmt;
257 if (
s->intra_pred_data[0] && cols ==
s->cols && rows ==
s->rows &&
s->pix_fmt ==
s->last_fmt)
260 s->last_fmt =
s->pix_fmt;
261 s->sb_cols = (
w + 63) >> 6;
262 s->sb_rows = (
h + 63) >> 6;
263 s->cols = (
w + 7) >> 3;
264 s->rows = (
h + 7) >> 3;
267 #define assign(var, type, n) var = (type) p; p += s->sb_cols * (n) * sizeof(*var)
271 p =
av_malloc(
s->sb_cols * (128 + 192 * bytesperpixel +
272 lflvl_len *
sizeof(*
s->lflvl) + 16 *
sizeof(*
s->above_mv_ctx)));
295 for (
i = 0;
i <
s->active_tile_cols;
i++)
299 if (
s->s.h.bpp !=
s->last_bpp) {
302 s->last_bpp =
s->s.h.bpp;
312 int chroma_blocks, chroma_eobs, bytesperpixel =
s->bytesperpixel;
315 if (
td->b_base &&
td->block_base &&
s->block_alloc_using_2pass ==
s->s.frames[
CUR_FRAME].uses_2pass)
319 chroma_blocks = 64 * 64 >> (
s->ss_h +
s->ss_v);
320 chroma_eobs = 16 * 16 >> (
s->ss_h +
s->ss_v);
322 int sbs =
s->sb_cols *
s->sb_rows;
325 td->block_base =
av_mallocz(((64 * 64 + 2 * chroma_blocks) * bytesperpixel *
sizeof(int16_t) +
326 16 * 16 + 2 * chroma_eobs) * sbs);
327 if (!
td->b_base || !
td->block_base)
329 td->uvblock_base[0] =
td->block_base + sbs * 64 * 64 * bytesperpixel;
330 td->uvblock_base[1] =
td->uvblock_base[0] + sbs * chroma_blocks * bytesperpixel;
331 td->eob_base = (
uint8_t *) (
td->uvblock_base[1] + sbs * chroma_blocks * bytesperpixel);
332 td->uveob_base[0] =
td->eob_base + 16 * 16 * sbs;
333 td->uveob_base[1] =
td->uveob_base[0] + chroma_eobs * sbs;
337 if (!
td->block_structure)
341 for (
i = 1;
i <
s->active_tile_cols;
i++)
344 for (
i = 0;
i <
s->active_tile_cols;
i++) {
346 s->td[
i].block_base =
av_mallocz((64 * 64 + 2 * chroma_blocks) * bytesperpixel *
sizeof(int16_t) +
347 16 * 16 + 2 * chroma_eobs);
348 if (!
s->td[
i].b_base || !
s->td[
i].block_base)
350 s->td[
i].uvblock_base[0] =
s->td[
i].block_base + 64 * 64 * bytesperpixel;
351 s->td[
i].uvblock_base[1] =
s->td[
i].uvblock_base[0] + chroma_blocks * bytesperpixel;
352 s->td[
i].eob_base = (
uint8_t *) (
s->td[
i].uvblock_base[1] + chroma_blocks * bytesperpixel);
353 s->td[
i].uveob_base[0] =
s->td[
i].eob_base + 16 * 16;
354 s->td[
i].uveob_base[1] =
s->td[
i].uveob_base[0] + chroma_eobs;
358 if (!
s->td[
i].block_structure)
363 s->block_alloc_using_2pass =
s->s.frames[
CUR_FRAME].uses_2pass;
380 return m - ((v + 1) >> 1);
387 static const uint8_t inv_map_table[255] = {
388 7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176,
389 189, 202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9,
390 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24,
391 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39,
392 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54,
393 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
394 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
395 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100,
396 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115,
397 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 130,
398 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145,
399 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
400 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
401 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 190, 191,
402 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206,
403 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221,
404 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236,
405 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
453 s->s.h.bpp = 8 +
bits * 2;
454 s->bytesperpixel = (7 +
s->s.h.bpp) >> 3;
460 s->ss_h =
s->ss_v = 0;
474 static const enum AVPixelFormat pix_fmt_for_ss[3][2 ][2 ] = {
486 s->pix_fmt = pix_fmt_for_ss[
bits][
s->ss_v][
s->ss_h];
497 s->ss_h =
s->ss_v = 1;
498 s->pix_fmt = pix_fmt_for_ss[
bits][1][1];
509 int c,
i, j, k, l, m, n,
w,
h,
max, size2, ret, sharp;
535 s->last_keyframe =
s->s.h.keyframe;
538 last_invisible =
s->s.h.invisible;
541 s->s.h.use_last_frame_mvs = !
s->s.h.errorres && !last_invisible;
543 if (
s->s.h.keyframe) {
551 s->s.h.refreshrefmask = 0xff;
557 s->s.h.intraonly =
s->s.h.invisible ?
get_bits1(&
s->gb) : 0;
558 s->s.h.resetctx =
s->s.h.errorres ? 0 :
get_bits(&
s->gb, 2);
559 if (
s->s.h.intraonly) {
568 s->ss_h =
s->ss_v = 1;
571 s->bytesperpixel = 1;
584 s->s.h.signbias[0] =
get_bits1(&
s->gb) && !
s->s.h.errorres;
586 s->s.h.signbias[1] =
get_bits1(&
s->gb) && !
s->s.h.errorres;
588 s->s.h.signbias[2] =
get_bits1(&
s->gb) && !
s->s.h.errorres;
589 if (!
s->s.refs[
s->s.h.refidx[0]].f->buf[0] ||
590 !
s->s.refs[
s->s.h.refidx[1]].f->buf[0] ||
591 !
s->s.refs[
s->s.h.refidx[2]].f->buf[0]) {
596 w =
s->s.refs[
s->s.h.refidx[0]].f->width;
597 h =
s->s.refs[
s->s.h.refidx[0]].f->height;
599 w =
s->s.refs[
s->s.h.refidx[1]].f->width;
600 h =
s->s.refs[
s->s.h.refidx[1]].f->height;
602 w =
s->s.refs[
s->s.h.refidx[2]].f->width;
603 h =
s->s.refs[
s->s.h.refidx[2]].f->height;
611 s->s.h.use_last_frame_mvs &=
s->s.frames[
CUR_FRAME].tf.f->width ==
w &&
618 s->s.h.allowcompinter =
s->s.h.signbias[0] !=
s->s.h.signbias[1] ||
619 s->s.h.signbias[0] !=
s->s.h.signbias[2];
620 if (
s->s.h.allowcompinter) {
621 if (
s->s.h.signbias[0] ==
s->s.h.signbias[1]) {
622 s->s.h.fixcompref = 2;
623 s->s.h.varcompref[0] = 0;
624 s->s.h.varcompref[1] = 1;
625 }
else if (
s->s.h.signbias[0] ==
s->s.h.signbias[2]) {
626 s->s.h.fixcompref = 1;
627 s->s.h.varcompref[0] = 0;
628 s->s.h.varcompref[1] = 2;
630 s->s.h.fixcompref = 0;
631 s->s.h.varcompref[0] = 1;
632 s->s.h.varcompref[1] = 2;
637 s->s.h.refreshctx =
s->s.h.errorres ? 0 :
get_bits1(&
s->gb);
638 s->s.h.parallelmode =
s->s.h.errorres ? 1 :
get_bits1(&
s->gb);
640 if (
s->s.h.keyframe ||
s->s.h.intraonly)
641 s->s.h.framectxid = 0;
644 if (
s->s.h.keyframe ||
s->s.h.errorres ||
s->s.h.intraonly) {
646 s->s.h.lf_delta.ref[0] = 1;
647 s->s.h.lf_delta.ref[1] = 0;
648 s->s.h.lf_delta.ref[2] = -1;
649 s->s.h.lf_delta.ref[3] = -1;
650 s->s.h.lf_delta.mode[0] = 0;
651 s->s.h.lf_delta.mode[1] = 0;
652 memset(
s->s.h.segmentation.feat, 0,
sizeof(
s->s.h.segmentation.feat));
658 if (
s->s.h.filter.sharpness != sharp) {
659 for (
i = 1;
i <= 63;
i++) {
663 limit >>= (sharp + 3) >> 2;
664 limit =
FFMIN(limit, 9 - sharp);
666 limit =
FFMAX(limit, 1);
668 s->filter_lut.lim_lut[
i] = limit;
669 s->filter_lut.mblim_lut[
i] = 2 * (
i + 2) + limit;
672 s->s.h.filter.sharpness = sharp;
673 if ((
s->s.h.lf_delta.enabled =
get_bits1(&
s->gb))) {
674 if ((
s->s.h.lf_delta.updated =
get_bits1(&
s->gb))) {
675 for (
i = 0;
i < 4;
i++)
678 for (
i = 0;
i < 2;
i++)
689 s->s.h.lossless =
s->s.h.yac_qi == 0 &&
s->s.h.ydc_qdelta == 0 &&
690 s->s.h.uvdc_qdelta == 0 &&
s->s.h.uvac_qdelta == 0;
695 if ((
s->s.h.segmentation.enabled =
get_bits1(&
s->gb))) {
696 if ((
s->s.h.segmentation.update_map =
get_bits1(&
s->gb))) {
697 for (
i = 0;
i < 7;
i++)
700 if ((
s->s.h.segmentation.temporal =
get_bits1(&
s->gb)))
701 for (
i = 0;
i < 3;
i++)
707 s->s.h.segmentation.absolute_vals =
get_bits1(&
s->gb);
708 for (
i = 0;
i < 8;
i++) {
709 if ((
s->s.h.segmentation.feat[
i].q_enabled =
get_bits1(&
s->gb)))
711 if ((
s->s.h.segmentation.feat[
i].lf_enabled =
get_bits1(&
s->gb)))
713 if ((
s->s.h.segmentation.feat[
i].ref_enabled =
get_bits1(&
s->gb)))
714 s->s.h.segmentation.feat[
i].ref_val =
get_bits(&
s->gb, 2);
715 s->s.h.segmentation.feat[
i].skip_enabled =
get_bits1(&
s->gb);
722 s->s.h.segmentation.temporal = 0;
723 s->s.h.segmentation.update_map = 0;
727 for (
i = 0;
i < (
s->s.h.segmentation.enabled ? 8 : 1);
i++) {
728 int qyac, qydc, quvac, quvdc, lflvl, sh;
730 if (
s->s.h.segmentation.enabled &&
s->s.h.segmentation.feat[
i].q_enabled) {
731 if (
s->s.h.segmentation.absolute_vals)
736 qyac =
s->s.h.yac_qi;
748 sh =
s->s.h.filter.level >= 32;
749 if (
s->s.h.segmentation.enabled &&
s->s.h.segmentation.feat[
i].lf_enabled) {
750 if (
s->s.h.segmentation.absolute_vals)
753 lflvl =
av_clip_uintp2(
s->s.h.filter.level +
s->s.h.segmentation.feat[
i].lf_val, 6);
755 lflvl =
s->s.h.filter.level;
757 if (
s->s.h.lf_delta.enabled) {
758 s->s.h.segmentation.feat[
i].lflvl[0][0] =
759 s->s.h.segmentation.feat[
i].lflvl[0][1] =
761 for (j = 1; j < 4; j++) {
762 s->s.h.segmentation.feat[
i].lflvl[j][0] =
764 s->s.h.lf_delta.mode[0]) * (1 << sh)), 6);
765 s->s.h.segmentation.feat[
i].lflvl[j][1] =
767 s->s.h.lf_delta.mode[1]) * (1 << sh)), 6);
770 memset(
s->s.h.segmentation.feat[
i].lflvl, lflvl,
771 sizeof(
s->s.h.segmentation.feat[
i].lflvl));
781 for (
s->s.h.tiling.log2_tile_cols = 0;
782 s->sb_cols > (64 <<
s->s.h.tiling.log2_tile_cols);
783 s->s.h.tiling.log2_tile_cols++) ;
784 for (
max = 0; (
s->sb_cols >>
max) >= 4;
max++) ;
786 while (
max >
s->s.h.tiling.log2_tile_cols) {
788 s->s.h.tiling.log2_tile_cols++;
793 s->s.h.tiling.tile_rows = 1 <<
s->s.h.tiling.log2_tile_rows;
794 if (
s->s.h.tiling.tile_cols != (1 <<
s->s.h.tiling.log2_tile_cols)) {
799 for (
i = 0;
i <
s->active_tile_cols;
i++)
804 s->s.h.tiling.tile_cols = 1 <<
s->s.h.tiling.log2_tile_cols;
807 s->s.h.tiling.tile_cols : 1;
812 n_range_coders =
s->s.h.tiling.tile_cols;
819 for (
i = 0;
i <
s->active_tile_cols;
i++) {
822 rc += n_range_coders;
827 if (!
s->s.h.keyframe && !
s->s.h.intraonly) {
828 int valid_ref_frame = 0;
829 for (
i = 0;
i < 3;
i++) {
831 int refw =
ref->width, refh =
ref->height;
835 "Ref pixfmt (%s) did not match current frame (%s)",
839 }
else if (refw ==
w && refh ==
h) {
840 s->mvscale[
i][0] =
s->mvscale[
i][1] = 0;
844 if (
w * 2 < refw ||
h * 2 < refh ||
w > 16 * refw ||
h > 16 * refh) {
846 "Invalid ref frame dimensions %dx%d for frame size %dx%d\n",
851 s->mvscale[
i][0] = (refw << 14) /
w;
852 s->mvscale[
i][1] = (refh << 14) /
h;
853 s->mvstep[
i][0] = 16 *
s->mvscale[
i][0] >> 14;
854 s->mvstep[
i][1] = 16 *
s->mvscale[
i][1] >> 14;
858 if (!valid_ref_frame) {
859 av_log(avctx,
AV_LOG_ERROR,
"No valid reference frame is found, bitstream not supported\n");
864 if (
s->s.h.keyframe ||
s->s.h.errorres || (
s->s.h.intraonly &&
s->s.h.resetctx == 3)) {
865 s->prob_ctx[0].p =
s->prob_ctx[1].p =
s->prob_ctx[2].p =
875 }
else if (
s->s.h.intraonly &&
s->s.h.resetctx == 2) {
882 s->s.h.compressed_header_size = size2 =
get_bits(&
s->gb, 16);
886 if (size2 >
size - (data2 -
data)) {
899 for (
i = 0;
i <
s->active_tile_cols;
i++) {
900 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
901 memset(
s->td[
i].counts.coef, 0,
sizeof(
s->td[0].counts.coef));
902 memset(
s->td[
i].counts.eob, 0,
sizeof(
s->td[0].counts.eob));
904 memset(&
s->td[
i].counts, 0,
sizeof(
s->td[0].counts));
906 s->td[
i].nb_block_structure = 0;
912 s->prob.p =
s->prob_ctx[
c].p;
915 if (
s->s.h.lossless) {
919 if (
s->s.h.txfmmode == 3)
923 for (
i = 0;
i < 2;
i++)
926 for (
i = 0;
i < 2;
i++)
927 for (j = 0; j < 2; j++)
929 s->prob.p.tx16p[
i][j] =
931 for (
i = 0;
i < 2;
i++)
932 for (j = 0; j < 3; j++)
934 s->prob.p.tx32p[
i][j] =
940 for (
i = 0;
i < 4;
i++) {
943 for (j = 0; j < 2; j++)
944 for (k = 0; k < 2; k++)
945 for (l = 0; l < 6; l++)
946 for (m = 0; m < 6; m++) {
947 uint8_t *p =
s->prob.coef[
i][j][k][l][m];
949 if (m >= 3 && l == 0)
951 for (n = 0; n < 3; n++) {
960 for (j = 0; j < 2; j++)
961 for (k = 0; k < 2; k++)
962 for (l = 0; l < 6; l++)
963 for (m = 0; m < 6; m++) {
964 uint8_t *p =
s->prob.coef[
i][j][k][l][m];
972 if (
s->s.h.txfmmode ==
i)
977 for (
i = 0;
i < 3;
i++)
980 if (!
s->s.h.keyframe && !
s->s.h.intraonly) {
981 for (
i = 0;
i < 7;
i++)
982 for (j = 0; j < 3; j++)
984 s->prob.p.mv_mode[
i][j] =
988 for (
i = 0;
i < 4;
i++)
989 for (j = 0; j < 2; j++)
991 s->prob.p.filter[
i][j] =
994 for (
i = 0;
i < 4;
i++)
998 if (
s->s.h.allowcompinter) {
1000 if (
s->s.h.comppredmode)
1003 for (
i = 0;
i < 5;
i++)
1012 for (
i = 0;
i < 5;
i++) {
1014 s->prob.p.single_ref[
i][0] =
1017 s->prob.p.single_ref[
i][1] =
1023 for (
i = 0;
i < 5;
i++)
1025 s->prob.p.comp_ref[
i] =
1029 for (
i = 0;
i < 4;
i++)
1030 for (j = 0; j < 9; j++)
1032 s->prob.p.y_mode[
i][j] =
1035 for (
i = 0;
i < 4;
i++)
1036 for (j = 0; j < 4; j++)
1037 for (k = 0; k < 3; k++)
1039 s->prob.p.partition[3 -
i][j][k] =
1041 s->prob.p.partition[3 -
i][j][k]);
1044 for (
i = 0;
i < 3;
i++)
1048 for (
i = 0;
i < 2;
i++) {
1050 s->prob.p.mv_comp[
i].sign =
1053 for (j = 0; j < 10; j++)
1055 s->prob.p.mv_comp[
i].classes[j] =
1059 s->prob.p.mv_comp[
i].class0 =
1062 for (j = 0; j < 10; j++)
1064 s->prob.p.mv_comp[
i].bits[j] =
1068 for (
i = 0;
i < 2;
i++) {
1069 for (j = 0; j < 2; j++)
1070 for (k = 0; k < 3; k++)
1072 s->prob.p.mv_comp[
i].class0_fp[j][k] =
1075 for (j = 0; j < 3; j++)
1077 s->prob.p.mv_comp[
i].fp[j] =
1081 if (
s->s.h.highprecisionmvs) {
1082 for (
i = 0;
i < 2;
i++) {
1084 s->prob.p.mv_comp[
i].class0_hp =
1088 s->prob.p.mv_comp[
i].hp =
1094 return (data2 -
data) + size2;
1098 ptrdiff_t yoff, ptrdiff_t uvoff,
enum BlockLevel bl)
1101 int c = ((
s->above_partition_ctx[col] >> (3 - bl)) & 1) |
1102 (((
td->left_partition_ctx[row & 0x7] >> (3 - bl)) & 1) << 1);
1104 s->prob.p.partition[bl][
c];
1106 ptrdiff_t hbs = 4 >> bl;
1108 ptrdiff_t y_stride =
f->linesize[0], uv_stride =
f->linesize[1];
1109 int bytesperpixel =
s->bytesperpixel;
1114 }
else if (col + hbs < s->cols) {
1115 if (row + hbs < s->rows) {
1123 yoff += hbs * 8 * y_stride;
1124 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1129 yoff += hbs * 8 * bytesperpixel;
1130 uvoff += hbs * 8 * bytesperpixel >>
s->ss_h;
1134 decode_sb(
td, row, col, lflvl, yoff, uvoff, bl + 1);
1136 yoff + 8 * hbs * bytesperpixel,
1137 uvoff + (8 * hbs * bytesperpixel >>
s->ss_h), bl + 1);
1138 yoff += hbs * 8 * y_stride;
1139 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1140 decode_sb(
td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
1142 yoff + 8 * hbs * bytesperpixel,
1143 uvoff + (8 * hbs * bytesperpixel >>
s->ss_h), bl + 1);
1150 decode_sb(
td, row, col, lflvl, yoff, uvoff, bl + 1);
1152 yoff + 8 * hbs * bytesperpixel,
1153 uvoff + (8 * hbs * bytesperpixel >>
s->ss_h), bl + 1);
1158 }
else if (row + hbs < s->rows) {
1161 decode_sb(
td, row, col, lflvl, yoff, uvoff, bl + 1);
1162 yoff += hbs * 8 * y_stride;
1163 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1164 decode_sb(
td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
1171 decode_sb(
td, row, col, lflvl, yoff, uvoff, bl + 1);
1173 td->counts.partition[bl][
c][bp]++;
1177 ptrdiff_t yoff, ptrdiff_t uvoff,
enum BlockLevel bl)
1181 ptrdiff_t hbs = 4 >> bl;
1183 ptrdiff_t y_stride =
f->linesize[0], uv_stride =
f->linesize[1];
1184 int bytesperpixel =
s->bytesperpixel;
1189 }
else if (
td->b->bl == bl) {
1192 yoff += hbs * 8 * y_stride;
1193 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1195 }
else if (
b->bp ==
PARTITION_V && col + hbs < s->cols) {
1196 yoff += hbs * 8 * bytesperpixel;
1197 uvoff += hbs * 8 * bytesperpixel >>
s->ss_h;
1202 if (col + hbs < s->cols) {
1203 if (row + hbs < s->rows) {
1204 decode_sb_mem(
td, row, col + hbs, lflvl, yoff + 8 * hbs * bytesperpixel,
1205 uvoff + (8 * hbs * bytesperpixel >>
s->ss_h), bl + 1);
1206 yoff += hbs * 8 * y_stride;
1207 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1210 yoff + 8 * hbs * bytesperpixel,
1211 uvoff + (8 * hbs * bytesperpixel >>
s->ss_h), bl + 1);
1213 yoff += hbs * 8 * bytesperpixel;
1214 uvoff += hbs * 8 * bytesperpixel >>
s->ss_h;
1217 }
else if (row + hbs < s->rows) {
1218 yoff += hbs * 8 * y_stride;
1219 uvoff += hbs * 8 * uv_stride >>
s->ss_v;
1227 int sb_start = ( idx * n) >> log2_n;
1228 int sb_end = ((idx + 1) * n) >> log2_n;
1229 *start =
FFMIN(sb_start, n) << 3;
1230 *end =
FFMIN(sb_end, n) << 3;
1238 for (
i = 0;
i <
s->active_tile_cols;
i++)
1247 for (
i = 0;
i < 3;
i++) {
1252 for (
i = 0;
i < 8;
i++) {
1270 int row, col, tile_row, tile_col, ret;
1272 int tile_row_start, tile_row_end, tile_col_start, tile_col_end;
1274 ptrdiff_t yoff, uvoff, ls_y, ls_uv;
1277 ls_y =
f->linesize[0];
1278 ls_uv =
f->linesize[1];
1279 bytesperpixel =
s->bytesperpixel;
1282 for (tile_row = 0; tile_row <
s->s.h.tiling.tile_rows; tile_row++) {
1284 tile_row,
s->s.h.tiling.log2_tile_rows,
s->sb_rows);
1286 for (tile_col = 0; tile_col <
s->s.h.tiling.tile_cols; tile_col++) {
1289 if (tile_col ==
s->s.h.tiling.tile_cols - 1 &&
1290 tile_row ==
s->s.h.tiling.tile_rows - 1) {
1297 if (tile_size >
size) {
1312 for (row = tile_row_start; row < tile_row_end;
1313 row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >>
s->ss_v) {
1315 ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
1317 for (tile_col = 0; tile_col <
s->s.h.tiling.tile_cols; tile_col++) {
1319 tile_col,
s->s.h.tiling.log2_tile_cols,
s->sb_cols);
1320 td->tile_col_start = tile_col_start;
1322 memset(
td->left_partition_ctx, 0, 8);
1323 memset(
td->left_skip_ctx, 0, 8);
1324 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
1329 memset(
td->left_y_nnz_ctx, 0, 16);
1330 memset(
td->left_uv_nnz_ctx, 0, 32);
1331 memset(
td->left_segpred_ctx, 0, 8);
1333 td->c = &
td->c_b[tile_col];
1336 for (col = tile_col_start;
1338 col += 8, yoff2 += 64 * bytesperpixel,
1339 uvoff2 += 64 * bytesperpixel >>
s->ss_h, lflvl_ptr++) {
1343 memset(lflvl_ptr->
mask, 0,
sizeof(lflvl_ptr->
mask));
1364 if (row + 8 <
s->rows) {
1365 memcpy(
s->intra_pred_data[0],
1366 f->data[0] + yoff + 63 * ls_y,
1367 8 *
s->cols * bytesperpixel);
1368 memcpy(
s->intra_pred_data[1],
1369 f->data[1] + uvoff + ((64 >>
s->ss_v) - 1) * ls_uv,
1370 8 *
s->cols * bytesperpixel >>
s->ss_h);
1371 memcpy(
s->intra_pred_data[2],
1372 f->data[2] + uvoff + ((64 >>
s->ss_v) - 1) * ls_uv,
1373 8 *
s->cols * bytesperpixel >>
s->ss_h);
1377 if (
s->s.h.filter.level) {
1380 lflvl_ptr =
s->lflvl;
1381 for (col = 0; col <
s->cols;
1382 col += 8, yoff2 += 64 * bytesperpixel,
1383 uvoff2 += 64 * bytesperpixel >>
s->ss_h, lflvl_ptr++) {
1400 int decode_tiles_mt(
AVCodecContext *avctx,
void *tdata,
int jobnr,
1405 ptrdiff_t uvoff, yoff, ls_y, ls_uv;
1406 int bytesperpixel =
s->bytesperpixel, row, col, tile_row;
1407 unsigned tile_cols_len;
1408 int tile_row_start, tile_row_end, tile_col_start, tile_col_end;
1413 ls_y =
f->linesize[0];
1414 ls_uv =
f->linesize[1];
1417 jobnr,
s->s.h.tiling.log2_tile_cols,
s->sb_cols);
1418 td->tile_col_start = tile_col_start;
1419 uvoff = (64 * bytesperpixel >>
s->ss_h)*(tile_col_start >> 3);
1420 yoff = (64 * bytesperpixel)*(tile_col_start >> 3);
1421 lflvl_ptr_base =
s->lflvl+(tile_col_start >> 3);
1423 for (tile_row = 0; tile_row <
s->s.h.tiling.tile_rows; tile_row++) {
1425 tile_row,
s->s.h.tiling.log2_tile_rows,
s->sb_rows);
1427 td->c = &
td->c_b[tile_row];
1428 for (row = tile_row_start; row < tile_row_end;
1429 row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >>
s->ss_v) {
1430 ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
1431 VP9Filter *lflvl_ptr = lflvl_ptr_base+
s->sb_cols*(row >> 3);
1433 memset(
td->left_partition_ctx, 0, 8);
1434 memset(
td->left_skip_ctx, 0, 8);
1435 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
1440 memset(
td->left_y_nnz_ctx, 0, 16);
1441 memset(
td->left_uv_nnz_ctx, 0, 32);
1442 memset(
td->left_segpred_ctx, 0, 8);
1444 for (col = tile_col_start;
1446 col += 8, yoff2 += 64 * bytesperpixel,
1447 uvoff2 += 64 * bytesperpixel >>
s->ss_h, lflvl_ptr++) {
1450 memset(lflvl_ptr->
mask, 0,
sizeof(lflvl_ptr->
mask));
1457 tile_cols_len = tile_col_end - tile_col_start;
1458 if (row + 8 <
s->rows) {
1459 memcpy(
s->intra_pred_data[0] + (tile_col_start * 8 * bytesperpixel),
1460 f->data[0] + yoff + 63 * ls_y,
1461 8 * tile_cols_len * bytesperpixel);
1462 memcpy(
s->intra_pred_data[1] + (tile_col_start * 8 * bytesperpixel >>
s->ss_h),
1463 f->data[1] + uvoff + ((64 >>
s->ss_v) - 1) * ls_uv,
1464 8 * tile_cols_len * bytesperpixel >>
s->ss_h);
1465 memcpy(
s->intra_pred_data[2] + (tile_col_start * 8 * bytesperpixel >>
s->ss_h),
1466 f->data[2] + uvoff + ((64 >>
s->ss_v) - 1) * ls_uv,
1467 8 * tile_cols_len * bytesperpixel >>
s->ss_h);
1470 vp9_report_tile_progress(
s, row >> 3, 1);
1480 ptrdiff_t uvoff, yoff, ls_y, ls_uv;
1482 int bytesperpixel =
s->bytesperpixel, col,
i;
1486 ls_y =
f->linesize[0];
1487 ls_uv =
f->linesize[1];
1489 for (
i = 0;
i <
s->sb_rows;
i++) {
1490 vp9_await_tile_progress(
s,
i,
s->s.h.tiling.tile_cols);
1492 if (
s->s.h.filter.level) {
1493 yoff = (ls_y * 64)*
i;
1494 uvoff = (ls_uv * 64 >>
s->ss_v)*
i;
1495 lflvl_ptr =
s->lflvl+
s->sb_cols*
i;
1496 for (col = 0; col <
s->cols;
1497 col += 8, yoff += 64 * bytesperpixel,
1498 uvoff += 64 * bytesperpixel >>
s->ss_h, lflvl_ptr++) {
1511 unsigned int tile, nb_blocks = 0;
1513 if (
s->s.h.segmentation.enabled) {
1514 for (tile = 0; tile <
s->active_tile_cols; tile++)
1515 nb_blocks +=
s->td[tile].nb_block_structure;
1523 par->
qp =
s->s.h.yac_qi;
1524 par->
delta_qp[0][0] =
s->s.h.ydc_qdelta;
1525 par->
delta_qp[1][0] =
s->s.h.uvdc_qdelta;
1526 par->
delta_qp[2][0] =
s->s.h.uvdc_qdelta;
1527 par->
delta_qp[1][1] =
s->s.h.uvac_qdelta;
1528 par->
delta_qp[2][1] =
s->s.h.uvac_qdelta;
1531 unsigned int block = 0;
1532 unsigned int tile, block_tile;
1534 for (tile = 0; tile <
s->active_tile_cols; tile++) {
1537 for (block_tile = 0; block_tile <
td->nb_block_structure; block_tile++) {
1539 unsigned int row =
td->block_structure[block_tile].row;
1540 unsigned int col =
td->block_structure[block_tile].col;
1541 uint8_t seg_id =
frame->segmentation_map[row * 8 *
s->sb_cols + col];
1545 b->w = 1 << (3 +
td->block_structure[block_tile].block_size_idx_x);
1546 b->h = 1 << (3 +
td->block_structure[block_tile].block_size_idx_y);
1548 if (
s->s.h.segmentation.feat[seg_id].q_enabled) {
1549 b->delta_qp =
s->s.h.segmentation.feat[seg_id].q_val;
1550 if (
s->s.h.segmentation.absolute_vals)
1551 b->delta_qp -= par->
qp;
1568 (!
s->s.h.segmentation.enabled || !
s->s.h.segmentation.update_map);
1573 }
else if (ret == 0) {
1574 if (!
s->s.refs[
ref].f->buf[0]) {
1587 for (
i = 0;
i < 8;
i++) {
1588 if (
s->next_refs[
i].f->buf[0])
1590 if (
s->s.refs[
i].f->buf[0] &&
1600 if (!retain_segmap_ref ||
s->s.h.keyframe ||
s->s.h.intraonly) {
1603 if (!
s->s.h.keyframe && !
s->s.h.intraonly && !
s->s.h.errorres &&
s->s.frames[
CUR_FRAME].tf.f->buf[0] &&
1609 if (!
s->s.h.intraonly && !
s->s.h.keyframe && !
s->s.h.errorres &&
s->s.frames[
CUR_FRAME].tf.f->buf[0] &&
1617 f->key_frame =
s->s.h.keyframe;
1627 for (
i = 0;
i < 8;
i++) {
1628 if (
s->next_refs[
i].f->buf[0])
1630 if (
s->s.h.refreshrefmask & (1 <<
i)) {
1632 }
else if (
s->s.refs[
i].f->buf[0]) {
1653 memset(
s->above_partition_ctx, 0,
s->cols);
1654 memset(
s->above_skip_ctx, 0,
s->cols);
1655 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
1656 memset(
s->above_mode_ctx,
DC_PRED,
s->cols * 2);
1660 memset(
s->above_y_nnz_ctx, 0,
s->sb_cols * 16);
1661 memset(
s->above_uv_nnz_ctx[0], 0,
s->sb_cols * 16 >>
s->ss_h);
1662 memset(
s->above_uv_nnz_ctx[1], 0,
s->sb_cols * 16 >>
s->ss_h);
1663 memset(
s->above_segpred_ctx, 0,
s->cols);
1668 "Failed to allocate block buffers\n");
1671 if (
s->s.h.refreshctx &&
s->s.h.parallelmode) {
1674 for (
i = 0;
i < 4;
i++) {
1675 for (j = 0; j < 2; j++)
1676 for (k = 0; k < 2; k++)
1677 for (l = 0; l < 6; l++)
1678 for (m = 0; m < 6; m++)
1679 memcpy(
s->prob_ctx[
s->s.h.framectxid].coef[
i][j][k][l][m],
1680 s->prob.coef[
i][j][k][l][m], 3);
1681 if (
s->s.h.txfmmode ==
i)
1684 s->prob_ctx[
s->s.h.framectxid].p =
s->prob.p;
1686 }
else if (!
s->s.h.refreshctx) {
1692 for (
i = 0;
i <
s->sb_rows;
i++)
1698 for (
i = 0;
i <
s->active_tile_cols;
i++) {
1699 s->td[
i].b =
s->td[
i].b_base;
1700 s->td[
i].block =
s->td[
i].block_base;
1701 s->td[
i].uvblock[0] =
s->td[
i].uvblock_base[0];
1702 s->td[
i].uvblock[1] =
s->td[
i].uvblock_base[1];
1703 s->td[
i].eob =
s->td[
i].eob_base;
1704 s->td[
i].uveob[0] =
s->td[
i].uveob_base[0];
1705 s->td[
i].uveob[1] =
s->td[
i].uveob_base[1];
1706 s->td[
i].error_info = 0;
1711 int tile_row, tile_col;
1715 for (tile_row = 0; tile_row <
s->s.h.tiling.tile_rows; tile_row++) {
1716 for (tile_col = 0; tile_col <
s->s.h.tiling.tile_cols; tile_col++) {
1719 if (tile_col ==
s->s.h.tiling.tile_cols - 1 &&
1720 tile_row ==
s->s.h.tiling.tile_rows - 1) {
1727 if (tile_size >
size)
1752 for (
i = 1;
i <
s->s.h.tiling.tile_cols;
i++)
1753 for (j = 0; j <
sizeof(
s->td[
i].counts) /
sizeof(
unsigned); j++)
1754 ((
unsigned *)&
s->td[0].counts)[j] += ((
unsigned *)&
s->td[
i].counts)[j];
1756 if (
s->pass < 2 &&
s->s.h.refreshctx && !
s->s.h.parallelmode) {
1760 }
while (
s->pass++ == 1);
1763 if (
s->td->error_info < 0) {
1765 s->td->error_info = 0;
1776 for (
i = 0;
i < 8;
i++) {
1777 if (
s->s.refs[
i].f->buf[0])
1779 if (
s->next_refs[
i].f->buf[0] &&
1784 if (!
s->s.h.invisible) {
1798 for (
i = 0;
i < 3;
i++)
1800 for (
i = 0;
i < 8;
i++)
1809 for (
i = 0;
i < 3;
i++) {
1811 if (!
s->s.frames[
i].tf.f) {
1817 for (
i = 0;
i < 8;
i++) {
1820 if (!
s->s.refs[
i].f || !
s->next_refs[
i].f) {
1835 s->s.h.filter.sharpness = -1;
1846 for (
i = 0;
i < 3;
i++) {
1847 if (
s->s.frames[
i].tf.f->buf[0])
1849 if (ssrc->s.frames[
i].tf.f->buf[0]) {
1854 for (
i = 0;
i < 8;
i++) {
1855 if (
s->s.refs[
i].f->buf[0])
1857 if (ssrc->next_refs[
i].f->buf[0]) {
1863 s->s.h.invisible = ssrc->s.h.invisible;
1864 s->s.h.keyframe = ssrc->s.h.keyframe;
1865 s->s.h.intraonly = ssrc->s.h.intraonly;
1866 s->ss_v = ssrc->ss_v;
1867 s->ss_h = ssrc->ss_h;
1868 s->s.h.segmentation.enabled = ssrc->s.h.segmentation.enabled;
1869 s->s.h.segmentation.update_map = ssrc->s.h.segmentation.update_map;
1870 s->s.h.segmentation.absolute_vals = ssrc->s.h.segmentation.absolute_vals;
1871 s->bytesperpixel = ssrc->bytesperpixel;
1872 s->gf_fmt = ssrc->gf_fmt;
1875 s->s.h.bpp = ssrc->s.h.bpp;
1876 s->bpp_index = ssrc->bpp_index;
1877 s->pix_fmt = ssrc->pix_fmt;
1878 memcpy(&
s->prob_ctx, &ssrc->prob_ctx,
sizeof(
s->prob_ctx));
1879 memcpy(&
s->s.h.lf_delta, &ssrc->s.h.lf_delta,
sizeof(
s->s.h.lf_delta));
1880 memcpy(&
s->s.h.segmentation.feat, &ssrc->s.h.segmentation.feat,
1881 sizeof(
s->s.h.segmentation.feat));
1902 .bsfs =
"vp9_superframe_split",
1904 #if CONFIG_VP9_DXVA2_HWACCEL
1907 #if CONFIG_VP9_D3D11VA_HWACCEL
1910 #if CONFIG_VP9_D3D11VA2_HWACCEL
1913 #if CONFIG_VP9_NVDEC_HWACCEL
1916 #if CONFIG_VP9_VAAPI_HWACCEL
1919 #if CONFIG_VP9_VDPAU_HWACCEL
static void flush(AVCodecContext *avctx)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define FF_THREAD_FRAME
Decode more than one frame at once.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
#define FF_CODEC_PROPERTY_LOSSLESS
static av_cold int init(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define atomic_store(object, desired)
#define atomic_fetch_add_explicit(object, operand, order)
#define atomic_load_explicit(object, order)
#define atomic_init(obj, value)
#define pthread_mutex_lock(a)
#define pthread_mutex_unlock(a)
bitstream reader API header.
static int decode012(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint8_t * align_get_bits(GetBitContext *s)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS
Decoding only.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_allocz(buffer_size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVBufferPool * av_buffer_pool_init(buffer_size_t size, AVBufferRef *(*alloc)(buffer_size_t size))
Allocate and initialize a buffer pool.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
#define HWACCEL_DXVA2(codec)
#define HWACCEL_VDPAU(codec)
#define HWACCEL_NVDEC(codec)
#define HWACCEL_VAAPI(codec)
#define HWACCEL_D3D11VA(codec)
#define HWACCEL_D3D11VA2(codec)
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF
Codec initializes slice-based threading with a main function.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define FF_DISABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
static enum AVPixelFormat pix_fmt_rgb[3]
static enum AVPixelFormat pix_fmts[]
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GBRP12
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV444P10
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AVCOL_SPC_SMPTE240M
functionally identical to above
const AVProfile ff_vp9_profiles[]
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
FF_ENABLE_DEPRECATION_WARNINGS int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
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 ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
FF_DISABLE_DEPRECATION_WARNINGS enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2 *func2, main_func *mainfunc, void *arg, int *ret, int job_count)
#define FF_ARRAY_ELEMS(a)
uint8_t * data
The data buffer.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
int active_thread_type
Which multithreading methods are in use by the codec.
unsigned properties
Properties of the stream that gets decoded.
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
enum AVColorSpace colorspace
YUV colorspace type.
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
int frame_priv_data_size
Size of per-frame hardware accelerator private data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Data structure for storing block-level encoding information.
Video encoding parameters for a given frame.
int32_t delta_qp[4][2]
Quantisation parameter offset from the base (per-frame) qp for a given plane (first index) and AC/DC ...
int32_t qp
Base quantisation parameter for the frame.
AVBufferRef * hwaccel_priv_buf
void * hwaccel_picture_private
uint8_t * segmentation_map
#define av_malloc_array(a, b)
static int ref[MAX_W *MAX_W]
AVVideoEncParams * av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType type, unsigned int nb_blocks)
Allocates memory for AVEncodeInfoFrame plus an array of.
static av_always_inline AVVideoBlockParams * av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
@ AV_VIDEO_ENC_PARAMS_VP9
VP9 stores:
Core video DSP helper functions.
VP5 and VP6 compatible video decoder (common features)
int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob)
static av_always_inline int vp8_rac_get_tree(VP56RangeCoder *c, const int8_t(*tree)[2], const uint8_t *probs)
static av_always_inline int vp8_rac_get(VP56RangeCoder *c)
static av_always_inline int vpX_rac_is_end(VP56RangeCoder *c)
vp5689 returns 1 if the end of the stream has been reached, 0 otherwise.
static int vp8_rac_get_uint(VP56RangeCoder *c, int bits)
static void vp9_tile_data_free(VP9TileData *td)
static int read_colorspace_details(AVCodecContext *avctx)
static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f)
static void vp9_frame_unref(AVCodecContext *avctx, VP9Frame *f)
static int update_size(AVCodecContext *avctx, int w, int h)
static void decode_sb_mem(VP9TileData *td, int row, int col, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
static int update_prob(VP56RangeCoder *c, int p)
static int init_frames(AVCodecContext *avctx)
static int decode_frame_header(AVCodecContext *avctx, const uint8_t *data, int size, int *ref)
static int vp9_frame_ref(AVCodecContext *avctx, VP9Frame *dst, VP9Frame *src)
static void vp9_free_entries(AVCodecContext *avctx)
static av_cold int vp9_decode_init(AVCodecContext *avctx)
static void free_buffers(VP9Context *s)
static int vp9_alloc_entries(AVCodecContext *avctx, int n)
static av_always_inline int inv_recenter_nonneg(int v, int m)
static av_always_inline int get_sbits_inv(GetBitContext *gb, int n)
static void vp9_decode_flush(AVCodecContext *avctx)
static void set_tile_offset(int *start, int *end, int idx, int log2_n, int n)
static int decode_tiles(AVCodecContext *avctx, const uint8_t *data, int size)
static int vp9_export_enc_params(VP9Context *s, VP9Frame *frame)
static void decode_sb(VP9TileData *td, int row, int col, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
static av_cold int vp9_decode_free(AVCodecContext *avctx)
static int update_block_buffers(AVCodecContext *avctx)
static int vp9_decode_frame(AVCodecContext *avctx, void *frame, int *got_frame, AVPacket *pkt)
#define assign(var, type, n)
void ff_vp9_decode_block(VP9TileData *td, int row, int col, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp)
const ProbContext ff_vp9_default_probs
const int16_t ff_vp9_ac_qlookup[3][256]
const uint8_t ff_vp9_default_kf_partition_probs[4][4][3]
const int16_t ff_vp9_dc_qlookup[3][256]
const uint8_t ff_vp9_default_coef_probs[4][2][2][6][6][3]
const uint8_t ff_vp9_model_pareto8[256][8]
const int8_t ff_vp9_partition_tree[3][2]
#define REF_INVALID_SCALE
void ff_vp9_loopfilter_sb(AVCodecContext *avctx, VP9Filter *lflvl, int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
void ff_vp9_adapt_probs(VP9Context *s)