MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_sb

Function decode_sb

libavcodec/vp9.c:1118–1196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1116}
1117
1118static void decode_sb(VP9TileData *td, int row, int col, VP9Filter *lflvl,
1119 ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
1120{
1121 const VP9Context *s = td->s;
1122 int c = ((s->above_partition_ctx[col] >> (3 - bl)) & 1) |
1123 (((td->left_partition_ctx[row & 0x7] >> (3 - bl)) & 1) << 1);
1124 const uint8_t *p = s->s.h.keyframe || s->s.h.intraonly ? ff_vp9_default_kf_partition_probs[bl][c] :
1125 s->prob.p.partition[bl][c];
1126 enum BlockPartition bp;
1127 ptrdiff_t hbs = 4 >> bl;
1128 AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
1129 ptrdiff_t y_stride = f->linesize[0], uv_stride = f->linesize[1];
1130 int bytesperpixel = s->bytesperpixel;
1131
1132 if (bl == BL_8X8) {
1133 bp = vp89_rac_get_tree(td->c, ff_vp9_partition_tree, p);
1134 ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
1135 } else if (col + hbs < s->cols) { // FIXME why not <=?
1136 if (row + hbs < s->rows) { // FIXME why not <=?
1137 bp = vp89_rac_get_tree(td->c, ff_vp9_partition_tree, p);
1138 switch (bp) {
1139 case PARTITION_NONE:
1140 ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
1141 break;
1142 case PARTITION_H:
1143 ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
1144 yoff += hbs * 8 * y_stride;
1145 uvoff += hbs * 8 * uv_stride >> s->ss_v;
1146 ff_vp9_decode_block(td, row + hbs, col, lflvl, yoff, uvoff, bl, bp);
1147 break;
1148 case PARTITION_V:
1149 ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
1150 yoff += hbs * 8 * bytesperpixel;
1151 uvoff += hbs * 8 * bytesperpixel >> s->ss_h;
1152 ff_vp9_decode_block(td, row, col + hbs, lflvl, yoff, uvoff, bl, bp);
1153 break;
1154 case PARTITION_SPLIT:
1155 decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
1156 decode_sb(td, row, col + hbs, lflvl,
1157 yoff + 8 * hbs * bytesperpixel,
1158 uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
1159 yoff += hbs * 8 * y_stride;
1160 uvoff += hbs * 8 * uv_stride >> s->ss_v;
1161 decode_sb(td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
1162 decode_sb(td, row + hbs, col + hbs, lflvl,
1163 yoff + 8 * hbs * bytesperpixel,
1164 uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
1165 break;
1166 default:
1167 av_unreachable("ff_vp9_partition_tree only has "
1168 "the four PARTITION_* terminal codes");
1169 }
1170 } else if (vpx_rac_get_prob_branchy(td->c, p[1])) {
1171 bp = PARTITION_SPLIT;
1172 decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
1173 decode_sb(td, row, col + hbs, lflvl,
1174 yoff + 8 * hbs * bytesperpixel,
1175 uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);

Callers 2

decode_tilesFunction · 0.85
decode_tiles_mtFunction · 0.85

Calls 3

vp89_rac_get_treeFunction · 0.85
ff_vp9_decode_blockFunction · 0.85
vpx_rac_get_prob_branchyFunction · 0.85

Tested by

no test coverage detected