53 uint32_t v32 = v * 0x01010101;
62 uint64_t v64 = v * 0x0101010101010101ULL;
68 uint32_t v32 = v * 0x01010101;
83 0x0, 0x8, 0x0, 0x8, 0xc, 0x8, 0xc, 0xe, 0xc, 0xe, 0xf, 0xe, 0xf
86 0x0, 0x0, 0x8, 0x8, 0x8, 0xc, 0xc, 0xc, 0xe, 0xe, 0xe, 0xf, 0xf
88 static const uint8_t max_tx_for_bl_bp[
N_BS_SIZES] = {
94 int row = td->
row, col = td->
col, row7 = td->
row7;
95 enum TxfmMode max_tx = max_tx_for_bl_bp[
b->bs];
101 if (!
s->s.h.segmentation.enabled) {
103 }
else if (
s->s.h.keyframe ||
s->s.h.intraonly) {
104 b->seg_id = !
s->s.h.segmentation.update_map ? 0 :
106 s->s.h.segmentation.prob);
107 }
else if (!
s->s.h.segmentation.update_map ||
108 (
s->s.h.segmentation.temporal &&
110 s->s.h.segmentation.pred_prob[
s->above_segpred_ctx[col] +
118 for (y = 0; y < h4; y++) {
119 int idx_base = (y + row) * 8 *
s->sb_cols + col;
120 for (x = 0; x < w4; x++)
129 memset(&
s->above_segpred_ctx[col], 1, w4);
133 s->s.h.segmentation.prob);
135 memset(&
s->above_segpred_ctx[col], 0, w4);
138 if (
s->s.h.segmentation.enabled &&
139 (
s->s.h.segmentation.update_map ||
s->s.h.keyframe ||
s->s.h.intraonly)) {
141 bw4, bh4, 8 *
s->sb_cols,
b->seg_id);
144 b->skip =
s->s.h.segmentation.enabled &&
145 s->s.h.segmentation.feat[
b->seg_id].skip_enabled;
152 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
154 }
else if (
s->s.h.segmentation.enabled &&
s->s.h.segmentation.feat[
b->seg_id].ref_enabled) {
155 b->intra = !
s->s.h.segmentation.feat[
b->seg_id].ref_val;
159 if (have_a && have_l) {
163 c = have_a ? 2 *
s->above_intra_ctx[col] :
175 c = (
s->above_skip_ctx[col] ? max_tx :
176 s->above_txfm_ctx[col]) +
180 c =
s->above_skip_ctx[col] ? 1 :
181 (
s->above_txfm_ctx[col] * 2 > max_tx);
214 b->tx =
FFMIN(max_tx,
s->s.h.txfmmode);
217 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
218 uint8_t *
a = &
s->above_mode_ctx[col * 2];
237 b->mode[1] =
b->mode[0];
251 b->mode[3] =
b->mode[2];
254 b->mode[2] =
b->mode[0];
257 b->mode[3] =
b->mode[1];
264 b->mode[1] =
b->mode[0];
271 }
else if (
b->intra) {
275 s->prob.p.y_mode[0]);
279 s->prob.p.y_mode[0]);
282 b->mode[1] =
b->mode[0];
286 s->prob.p.y_mode[0]);
290 s->prob.p.y_mode[0]);
293 b->mode[3] =
b->mode[2];
296 b->mode[2] =
b->mode[0];
297 b->mode[3] =
b->mode[1];
300 static const uint8_t size_group[10] = {
301 3, 3, 3, 3, 2, 2, 2, 1, 1, 1
303 int sz = size_group[
b->bs];
306 s->prob.p.y_mode[sz]);
309 b->mode[3] =
b->mode[0];
313 s->prob.p.uv_mode[
b->mode[3]]);
316 static const uint8_t inter_mode_ctx_lut[14][14] = {
317 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
318 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
319 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
320 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
321 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
322 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
323 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
324 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
325 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
326 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
327 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
328 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
329 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 0, 3 },
330 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 4 },
333 if (
s->s.h.segmentation.enabled &&
s->s.h.segmentation.feat[
b->seg_id].ref_enabled) {
334 av_assert2(
s->s.h.segmentation.feat[
b->seg_id].ref_val != 0);
336 b->ref[0] =
s->s.h.segmentation.feat[
b->seg_id].ref_val - 1;
349 }
else if (
s->above_comp_ctx[col]) {
353 c = 2 + (
s->above_intra_ctx[col] ||
354 s->above_ref_ctx[col] ==
s->s.h.fixcompref);
356 c = (!
s->above_intra_ctx[col] &&
357 s->above_ref_ctx[col] ==
s->s.h.fixcompref) ^
362 c =
s->above_comp_ctx[col] ? 3 :
363 (!
s->above_intra_ctx[col] &&
s->above_ref_ctx[col] ==
s->s.h.fixcompref);
379 int fix_idx =
s->s.h.signbias[
s->s.h.fixcompref], var_idx = !fix_idx,
c,
bit;
381 b->ref[fix_idx] =
s->s.h.fixcompref;
385 if (
s->above_intra_ctx[col]) {
392 c = 1 + 2 * (
s->above_ref_ctx[col] !=
s->s.h.varcompref[1]);
394 int refl = td->
left_ref_ctx[row7], refa =
s->above_ref_ctx[col];
396 if (refl == refa && refa ==
s->s.h.varcompref[1]) {
399 if ((refa ==
s->s.h.fixcompref && refl ==
s->s.h.varcompref[0]) ||
400 (refl ==
s->s.h.fixcompref && refa ==
s->s.h.varcompref[0])) {
403 c = (refa == refl) ? 3 : 1;
406 if (refa ==
s->s.h.varcompref[1] && refl !=
s->s.h.varcompref[1]) {
409 c = (refl ==
s->s.h.varcompref[1] &&
410 refa !=
s->s.h.varcompref[1]) ? 2 : 4;
412 }
else if (!
s->above_comp_ctx[col]) {
413 if (refl ==
s->s.h.varcompref[1] && refa !=
s->s.h.varcompref[1]) {
416 c = (refa ==
s->s.h.varcompref[1] &&
417 refl !=
s->s.h.varcompref[1]) ? 2 : 4;
420 c = (refl == refa) ? 4 : 2;
424 if (
s->above_intra_ctx[col]) {
426 }
else if (
s->above_comp_ctx[col]) {
427 c = 4 * (
s->above_ref_ctx[col] !=
s->s.h.varcompref[1]);
429 c = 3 * (
s->above_ref_ctx[col] !=
s->s.h.varcompref[1]);
444 b->ref[var_idx] =
s->s.h.varcompref[
bit];
449 if (have_a && !
s->above_intra_ctx[col]) {
452 if (
s->above_comp_ctx[col]) {
454 !
s->above_ref_ctx[col]);
456 c = (3 * !
s->above_ref_ctx[col]) +
459 }
else if (
s->above_comp_ctx[col]) {
461 (!
s->s.h.fixcompref || !
s->above_ref_ctx[col]);
465 }
else if (
s->above_intra_ctx[col]) {
467 }
else if (
s->above_comp_ctx[col]) {
468 c = 1 + (!
s->s.h.fixcompref || !
s->above_ref_ctx[col]);
470 c = 4 * (!
s->above_ref_ctx[col]);
492 if (
s->above_intra_ctx[col]) {
494 }
else if (
s->above_comp_ctx[col]) {
495 c = 1 + 2 * (
s->s.h.fixcompref == 1 ||
496 s->above_ref_ctx[col] == 1);
497 }
else if (!
s->above_ref_ctx[col]) {
500 c = 4 * (
s->above_ref_ctx[col] == 1);
502 }
else if (
s->above_intra_ctx[col]) {
506 c = 1 + 2 * (
s->s.h.fixcompref == 1 ||
513 }
else if (
s->above_comp_ctx[col]) {
516 c = 3 * (
s->s.h.fixcompref == 1 ||
522 c = 1 + 2 * (
s->s.h.fixcompref == 1 ||
523 s->above_ref_ctx[col] == 1);
526 (
s->s.h.fixcompref == 1 ||
s->above_ref_ctx[col] == 1);
529 if (!
s->above_ref_ctx[col]) {
530 c = 1 + 2 * (
s->s.h.fixcompref == 1 ||
533 c = 3 * (
s->above_ref_ctx[col] == 1) +
536 }
else if (!
s->above_ref_ctx[col]) {
543 c = 4 * (
s->above_ref_ctx[col] == 1);
546 2 * (
s->above_ref_ctx[col] == 1);
549 if (
s->above_intra_ctx[col] ||
550 (!
s->above_comp_ctx[col] && !
s->above_ref_ctx[col])) {
552 }
else if (
s->above_comp_ctx[col]) {
553 c = 3 * (
s->s.h.fixcompref == 1 ||
s->above_ref_ctx[col] == 1);
555 c = 4 * (
s->above_ref_ctx[col] == 1);
578 if (
s->s.h.segmentation.enabled &&
s->s.h.segmentation.feat[
b->seg_id].skip_enabled) {
584 static const uint8_t off[10] = {
585 3, 0, 0, 1, 0, 0, 0, 0, 0, 0
590 int c = inter_mode_ctx_lut[
s->above_mode_ctx[col + off[
b->bs]]]
594 s->prob.p.mv_mode[
c]);
597 b->mode[3] =
b->mode[0];
605 if (have_a &&
s->above_mode_ctx[col] >=
NEARESTMV) {
610 c =
s->above_filter_ctx[col];
619 s->prob.p.filter[
c]);
623 b->filter =
s->s.h.filtermode;
627 int c = inter_mode_ctx_lut[
s->above_mode_ctx[col]][td->
left_mode_ctx[row7]];
630 s->prob.p.mv_mode[
c]);
636 s->prob.p.mv_mode[
c]);
640 b->mode[1] =
b->mode[0];
647 s->prob.p.mv_mode[
c]);
653 s->prob.p.mv_mode[
c]);
657 b->mode[3] =
b->mode[2];
662 b->mode[2] =
b->mode[0];
665 b->mode[3] =
b->mode[1];
679 vref =
b->ref[
b->comp ?
s->s.h.signbias[
s->s.h.varcompref[0]] : 0];
683 #define SPLAT_CTX(var, val, n) \
685 case 1: var = val; break; \
686 case 2: AV_WN16A(&var, val * 0x0101); break; \
687 case 4: AV_WN32A(&var, val * 0x01010101); break; \
688 case 8: AV_WN64A(&var, val * 0x0101010101010101ULL); break; \
690 uint64_t v64 = val * 0x0101010101010101ULL; \
691 AV_WN64A( &var, v64); \
692 AV_WN64A(&((uint8_t *) &var)[8], v64); \
697 #define SPLAT_CTX(var, val, n) \
699 case 1: var = val; break; \
700 case 2: AV_WN16A(&var, val * 0x0101); break; \
701 case 4: AV_WN32A(&var, val * 0x01010101); break; \
703 uint32_t v32 = val * 0x01010101; \
704 AV_WN32A( &var, v32); \
705 AV_WN32A(&((uint8_t *) &var)[4], v32); \
709 uint32_t v32 = val * 0x01010101; \
710 AV_WN32A( &var, v32); \
711 AV_WN32A(&((uint8_t *) &var)[4], v32); \
712 AV_WN32A(&((uint8_t *) &var)[8], v32); \
713 AV_WN32A(&((uint8_t *) &var)[12], v32); \
720 #define SET_CTXS(perf, dir, off, n) \
722 SPLAT_CTX(perf->dir##_skip_ctx[off], b->skip, n); \
723 SPLAT_CTX(perf->dir##_txfm_ctx[off], b->tx, n); \
724 SPLAT_CTX(perf->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
725 if (!s->s.h.keyframe && !s->s.h.intraonly) { \
726 SPLAT_CTX(perf->dir##_intra_ctx[off], b->intra, n); \
727 SPLAT_CTX(perf->dir##_comp_ctx[off], b->comp, n); \
728 SPLAT_CTX(perf->dir##_mode_ctx[off], b->mode[3], n); \
730 SPLAT_CTX(perf->dir##_ref_ctx[off], vref, n); \
731 if (s->s.h.filtermode == FILTER_SWITCHABLE) { \
732 SPLAT_CTX(perf->dir##_filter_ctx[off], filter_id, n); \
737 case 1:
SET_CTXS(
s, above, col, 1);
break;
738 case 2:
SET_CTXS(
s, above, col, 2);
break;
739 case 4:
SET_CTXS(
s, above, col, 4);
break;
740 case 8:
SET_CTXS(
s, above, col, 8);
break;
751 if (!
s->s.h.keyframe && !
s->s.h.intraonly) {
759 AV_COPY32(&
s->above_mv_ctx[col * 2 + 0][0], &
b->mv[2][0]);
760 AV_COPY32(&
s->above_mv_ctx[col * 2 + 0][1], &
b->mv[2][1]);
761 AV_WN32A(&
s->above_mv_ctx[col * 2 + 1][0], mv0);
762 AV_WN32A(&
s->above_mv_ctx[col * 2 + 1][1], mv1);
766 for (n = 0; n < w4 * 2; n++) {
767 AV_WN32A(&
s->above_mv_ctx[col * 2 + n][0], mv0);
768 AV_WN32A(&
s->above_mv_ctx[col * 2 + n][1], mv1);
770 for (n = 0; n < h4 * 2; n++) {
778 for (y = 0; y < h4; y++) {
779 int x, o = (row + y) *
s->sb_cols * 8 + col;
783 for (x = 0; x < w4; x++) {
787 }
else if (
b->comp) {
788 for (x = 0; x < w4; x++) {
789 mv[x].ref[0] =
b->ref[0];
790 mv[x].ref[1] =
b->ref[1];
795 for (x = 0; x < w4; x++) {
796 mv[x].ref[0] =
b->ref[0];
807 int is_tx32x32,
int is8bitsperpixel,
int bpp,
unsigned (*cnt)[6][3],
808 unsigned (*eob)[6][2],
const uint8_t (*p)[6][11],
809 int nnz,
const int16_t *scan,
const int16_t (*nb)[2],
810 const int16_t *band_counts,
const int16_t *qmul)
812 int i = 0, band = 0, band_left = band_counts[band];
813 const uint8_t *tp = p[0][nnz];
820 eob[band][nnz][
val]++;
828 band_left = band_counts[++band];
830 nnz = (1 + cache[nb[
i][0]] + cache[nb[
i][1]]) >> 1;
880 if (!is8bitsperpixel) {
905 #define STORE_COEF(c, i, v) do { \
906 if (is8bitsperpixel) { \
909 AV_WN32A(&c[i * 2], v); \
913 band_left = band_counts[++band];
918 nnz = (1 + cache[nb[
i][0]] + cache[nb[
i][1]]) >> 1;
920 }
while (++
i < n_coeffs);
926 unsigned (*cnt)[6][3],
unsigned (*eob)[6][2],
927 const uint8_t (*p)[6][11],
int nnz,
const int16_t *scan,
928 const int16_t (*nb)[2],
const int16_t *band_counts,
932 nnz, scan, nb, band_counts, qmul);
936 unsigned (*cnt)[6][3],
unsigned (*eob)[6][2],
937 const uint8_t (*p)[6][11],
int nnz,
const int16_t *scan,
938 const int16_t (*nb)[2],
const int16_t *band_counts,
942 nnz, scan, nb, band_counts, qmul);
946 unsigned (*cnt)[6][3],
unsigned (*eob)[6][2],
947 const uint8_t (*p)[6][11],
int nnz,
const int16_t *scan,
948 const int16_t (*nb)[2],
const int16_t *band_counts,
952 nnz, scan, nb, band_counts, qmul);
956 unsigned (*cnt)[6][3],
unsigned (*eob)[6][2],
957 const uint8_t (*p)[6][11],
int nnz,
const int16_t *scan,
958 const int16_t (*nb)[2],
const int16_t *band_counts,
962 nnz, scan, nb, band_counts, qmul);
969 int row = td->
row, col = td->
col;
970 const uint8_t (*p)[6][11] =
s->prob.coef[
b->tx][0 ][!
b->intra];
972 unsigned (*e)[6][2] = td->
counts.
eob[
b->tx][0 ][!
b->intra];
974 int end_x =
FFMIN(2 * (
s->cols - col), w4);
975 int end_y =
FFMIN(2 * (
s->rows - row), h4);
976 int n, pl, x, y,
ret;
977 const int16_t (*qmul)[2] =
s->s.h.segmentation.feat[
b->seg_id].qmul;
978 int tx = 4 *
s->s.h.lossless +
b->tx;
983 uint8_t *
a = &
s->above_y_nnz_ctx[col * 2];
985 static const int16_t band_counts[4][8] = {
986 { 1, 2, 3, 4, 3, 16 - 13 },
987 { 1, 2, 3, 4, 11, 64 - 21 },
988 { 1, 2, 3, 4, 11, 256 - 21 },
989 { 1, 2, 3, 4, 11, 1024 - 21 },
991 const int16_t *y_band_counts = band_counts[
b->tx];
992 const int16_t *uv_band_counts = band_counts[
b->uvtx];
993 int bytesperpixel = is8bitsperpixel ? 1 : 2;
996 #define MERGE(la, end, step, rd) \
997 for (n = 0; n < end; n += step) \
999 #define MERGE_CTX(step, rd) \
1001 MERGE(l, end_y, step, rd); \
1002 MERGE(a, end_x, step, rd); \
1005 #define DECODE_Y_COEF_LOOP(step, mode_index, v) \
1006 for (n = 0, y = 0; y < end_y; y += step) { \
1007 for (x = 0; x < end_x; x += step, n += step * step) { \
1008 enum TxfmType txtp = ff_vp9_intra_txfm_type[b->mode[mode_index]]; \
1009 ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
1010 (td, td->block + 16 * n * bytesperpixel, 16 * step * step, \
1011 c, e, p, a[x] + l[y], yscans[txtp], \
1012 ynbs[txtp], y_band_counts, qmul[0]); \
1013 a[x] = l[y] = !!ret; \
1014 total_coeff |= !!ret; \
1016 AV_WN16A(&td->eob[n], ret); \
1023 #define SPLAT(la, end, step, cond) \
1025 for (n = 1; n < end; n += step) \
1026 la[n] = la[n - 1]; \
1027 } else if (step == 4) { \
1029 for (n = 0; n < end; n += step) \
1030 AV_WN32A(&la[n], la[n] * 0x01010101); \
1032 for (n = 0; n < end; n += step) \
1033 memset(&la[n + 1], la[n], FFMIN(end - n - 1, 3)); \
1037 if (HAVE_FAST_64BIT) { \
1038 for (n = 0; n < end; n += step) \
1039 AV_WN64A(&la[n], la[n] * 0x0101010101010101ULL); \
1041 for (n = 0; n < end; n += step) { \
1042 uint32_t v32 = la[n] * 0x01010101; \
1043 AV_WN32A(&la[n], v32); \
1044 AV_WN32A(&la[n + 4], v32); \
1048 for (n = 0; n < end; n += step) \
1049 memset(&la[n + 1], la[n], FFMIN(end - n - 1, 7)); \
1052 #define SPLAT_CTX(step) \
1054 SPLAT(a, end_x, step, end_x == w4); \
1055 SPLAT(l, end_y, step, end_y == h4); \
1080 #define DECODE_UV_COEF_LOOP(step, v) \
1081 for (n = 0, y = 0; y < end_y; y += step) { \
1082 for (x = 0; x < end_x; x += step, n += step * step) { \
1083 ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
1084 (td, td->uvblock[pl] + 16 * n * bytesperpixel, \
1085 16 * step * step, c, e, p, a[x] + l[y], \
1086 uvscan, uvnb, uv_band_counts, qmul[1]); \
1087 a[x] = l[y] = !!ret; \
1088 total_coeff |= !!ret; \
1090 AV_WN16A(&td->uveob[pl][n], ret); \
1092 td->uveob[pl][n] = ret; \
1097 p =
s->prob.coef[
b->uvtx][1 ][!
b->intra];
1104 for (pl = 0; pl < 2; pl++) {
1105 a = &
s->above_uv_nnz_ctx[pl][col << !
s->ss_h];
1143 int row_and_7,
int col_and_7,
1144 int w,
int h,
int col_end,
int row_end,
1147 static const unsigned wide_filter_col_mask[2] = { 0x11, 0x01 };
1148 static const unsigned wide_filter_row_mask[2] = { 0x03, 0x07 };
1160 if (tx ==
TX_4X4 && (ss_v | ss_h)) {
1175 if (tx ==
TX_4X4 && !skip_inter) {
1176 int t = 1 << col_and_7, m_col = (t <<
w) - t, y;
1178 int m_row_8 = m_col & wide_filter_col_mask[ss_h], m_row_4 = m_col - m_row_8;
1180 for (y = row_and_7; y <
h + row_and_7; y++) {
1181 int col_mask_id = 2 - !(y & wide_filter_row_mask[ss_v]);
1183 mask[0][y][1] |= m_row_8;
1184 mask[0][y][2] |= m_row_4;
1195 if ((ss_h & ss_v) && (col_end & 1) && (y & 1)) {
1196 mask[1][y][col_mask_id] |= (t << (
w - 1)) - t;
1198 mask[1][y][col_mask_id] |= m_col;
1201 mask[0][y][3] |= m_col;
1203 if (ss_h && (col_end & 1))
1204 mask[1][y][3] |= (t << (
w - 1)) - t;
1206 mask[1][y][3] |= m_col;
1210 int y, t = 1 << col_and_7, m_col = (t <<
w) - t;
1213 int mask_id = (tx ==
TX_8X8);
1214 int l2 = tx + ss_h - 1, step1d;
1215 static const unsigned masks[4] = { 0xff, 0x55, 0x11, 0x01 };
1216 int m_row = m_col & masks[l2];
1220 if (ss_h && tx >
TX_8X8 && (
w ^ (
w - 1)) == 1) {
1221 int m_row_16 = ((t << (
w - 1)) - t) & masks[l2];
1222 int m_row_8 = m_row - m_row_16;
1224 for (y = row_and_7; y <
h + row_and_7; y++) {
1225 mask[0][y][0] |= m_row_16;
1226 mask[0][y][1] |= m_row_8;
1229 for (y = row_and_7; y <
h + row_and_7; y++)
1230 mask[0][y][mask_id] |= m_row;
1235 if (ss_v && tx >
TX_8X8 && (
h ^ (
h - 1)) == 1) {
1236 for (y = row_and_7; y <
h + row_and_7 - 1; y += step1d)
1237 mask[1][y][0] |= m_col;
1238 if (y - row_and_7 ==
h - 1)
1239 mask[1][y][1] |= m_col;
1241 for (y = row_and_7; y <
h + row_and_7; y += step1d)
1242 mask[1][y][mask_id] |= m_col;
1244 }
else if (tx !=
TX_4X4) {
1247 mask_id = (tx ==
TX_8X8) || (
h == ss_v);
1248 mask[1][row_and_7][mask_id] |= m_col;
1249 mask_id = (tx ==
TX_8X8) || (
w == ss_h);
1250 for (y = row_and_7; y <
h + row_and_7; y++)
1251 mask[0][y][mask_id] |= t;
1253 int t8 = t & wide_filter_col_mask[ss_h], t4 = t - t8;
1255 for (y = row_and_7; y <
h + row_and_7; y++) {
1256 mask[0][y][2] |= t4;
1257 mask[0][y][1] |= t8;
1259 mask[1][row_and_7][2 - !(row_and_7 & wide_filter_row_mask[ss_v])] |= m_col;
1265 VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
1271 int bytesperpixel =
s->bytesperpixel;
1281 td->
min_mv.
x = -(128 + col * 64);
1282 td->
min_mv.
y = -(128 + row * 64);
1283 td->
max_mv.
x = 128 + (
s->cols - col - w4) * 64;
1284 td->
max_mv.
y = 128 + (
s->rows - row - h4) * 64;
1291 b->uvtx =
b->tx - ((
s->ss_h && w4 * 2 == (1 <<
b->tx)) ||
1292 (
s->ss_v && h4 * 2 == (1 <<
b->tx)));
1305 if (bytesperpixel == 1) {
1310 if (!has_coeffs &&
b->bs <=
BS_8x8 && !
b->intra) {
1312 memset(&
s->above_skip_ctx[col], 1, w4);
1316 int row7 = td->
row7;
1318 #define SPLAT_ZERO_CTX(v, n) \
1320 case 1: v = 0; break; \
1321 case 2: AV_ZERO16(&v); break; \
1322 case 4: AV_ZERO32(&v); break; \
1323 case 8: AV_ZERO64(&v); break; \
1324 case 16: AV_ZERO128(&v); break; \
1326 #define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \
1328 SPLAT_ZERO_CTX(dir##_y_##var[off * 2], n * 2); \
1329 if (s->ss_##dir2) { \
1330 SPLAT_ZERO_CTX(dir##_uv_##var[0][off], n); \
1331 SPLAT_ZERO_CTX(dir##_uv_##var[1][off], n); \
1333 SPLAT_ZERO_CTX(dir##_uv_##var[0][off * 2], n * 2); \
1334 SPLAT_ZERO_CTX(dir##_uv_##var[1][off * 2], n * 2); \
1354 s->td[0].block += w4 * h4 * 64 * bytesperpixel;
1355 s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (
s->ss_h +
s->ss_v);
1356 s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (
s->ss_h +
s->ss_v);
1357 s->td[0].eob += 4 * w4 * h4;
1358 s->td[0].uveob[0] += 4 * w4 * h4 >> (
s->ss_h +
s->ss_v);
1359 s->td[0].uveob[1] += 4 * w4 * h4 >> (
s->ss_h +
s->ss_v);
1368 emu[0] = (col + w4) * 8 * bytesperpixel >
f->linesize[0] ||
1369 (row + h4) >
s->rows;
1370 emu[1] = ((col + w4) * 8 >>
s->ss_h) * bytesperpixel >
f->linesize[1] ||
1371 (row + h4) >
s->rows;
1376 td->
dst[0] =
f->data[0] + yoff;
1384 td->
dst[1] =
f->data[1] + uvoff;
1385 td->
dst[2] =
f->data[2] + uvoff;
1389 if (
s->s.h.bpp > 8) {
1395 if (
s->s.h.bpp > 8) {
1402 int w =
FFMIN(
s->cols - col, w4) * 8,
h =
FFMIN(
s->rows - row, h4) * 8, n, o = 0;
1404 for (n = 0; o <
w; n++) {
1409 s->dsp.mc[n][0][0][0][0](
f->data[0] + yoff + o * bytesperpixel,
f->linesize[0],
1410 td->
tmp_y + o * bytesperpixel, 128,
h, 0, 0);
1416 int w =
FFMIN(
s->cols - col, w4) * 8 >>
s->ss_h;
1417 int h =
FFMIN(
s->rows - row, h4) * 8 >>
s->ss_v, n, o = 0;
1419 for (n =
s->ss_h; o <
w; n++) {
1424 s->dsp.mc[n][0][0][0][0](
f->data[1] + uvoff + o * bytesperpixel,
f->linesize[1],
1425 td->
tmp_uv[0] + o * bytesperpixel, 128,
h, 0, 0);
1426 s->dsp.mc[n][0][0][0][0](
f->data[2] + uvoff + o * bytesperpixel,
f->linesize[2],
1427 td->
tmp_uv[1] + o * bytesperpixel, 128,
h, 0, 0);
1434 if (
s->s.h.filter.level &&
1435 (lvl =
s->s.h.segmentation.feat[
b->seg_id].lflvl[
b->intra ? 0 :
b->ref[0] + 1]
1436 [
b->mode[3] !=
ZEROMV]) > 0) {
1437 int x_end =
FFMIN(
s->cols - col, w4), y_end =
FFMIN(
s->rows - row, h4);
1438 int skip_inter = !
b->intra &&
b->skip, col7 = td->
col7, row7 = td->
row7;
1441 mask_edges(lflvl->
mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0,
b->tx, skip_inter);
1442 if (
s->ss_h ||
s->ss_v)
1444 s->cols & 1 && col + w4 >=
s->cols ?
s->cols & 7 : 0,
1445 s->rows & 1 && row + h4 >=
s->rows ?
s->rows & 7 : 0,
1446 b->uvtx, skip_inter);
1451 s->td[0].block += w4 * h4 * 64 * bytesperpixel;
1452 s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (
s->ss_v +
s->ss_h);
1453 s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (
s->ss_v +
s->ss_h);
1454 s->td[0].eob += 4 * w4 * h4;
1455 s->td[0].uveob[0] += 4 * w4 * h4 >> (
s->ss_v +
s->ss_h);
1456 s->td[0].uveob[1] += 4 * w4 * h4 >> (
s->ss_v +
s->ss_h);