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

Function decode_tiles

libavcodec/vp9.c:1292–1419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1290}
1291
1292static int decode_tiles(AVCodecContext *avctx,
1293 const uint8_t *data, int size)
1294{
1295 VP9Context *s = avctx->priv_data;
1296 VP9TileData *td = &s->td[0];
1297 int row, col, tile_row, tile_col, ret;
1298 int bytesperpixel;
1299 int tile_row_start, tile_row_end, tile_col_start, tile_col_end;
1300 AVFrame *f;
1301 ptrdiff_t yoff, uvoff, ls_y, ls_uv;
1302
1303 f = s->s.frames[CUR_FRAME].tf.f;
1304 ls_y = f->linesize[0];
1305 ls_uv =f->linesize[1];
1306 bytesperpixel = s->bytesperpixel;
1307
1308 yoff = uvoff = 0;
1309 for (tile_row = 0; tile_row < s->s.h.tiling.tile_rows; tile_row++) {
1310 set_tile_offset(&tile_row_start, &tile_row_end,
1311 tile_row, s->s.h.tiling.log2_tile_rows, s->sb_rows);
1312
1313 for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
1314 int64_t tile_size;
1315
1316 if (tile_col == s->s.h.tiling.tile_cols - 1 &&
1317 tile_row == s->s.h.tiling.tile_rows - 1) {
1318 tile_size = size;
1319 } else {
1320 tile_size = AV_RB32(data);
1321 data += 4;
1322 size -= 4;
1323 }
1324 if (tile_size > size)
1325 return AVERROR_INVALIDDATA;
1326 ret = ff_vpx_init_range_decoder(&td->c_b[tile_col], data, tile_size);
1327 if (ret < 0)
1328 return ret;
1329 if (vpx_rac_get_prob_branchy(&td->c_b[tile_col], 128)) // marker bit
1330 return AVERROR_INVALIDDATA;
1331 data += tile_size;
1332 size -= tile_size;
1333 }
1334
1335 for (row = tile_row_start; row < tile_row_end;
1336 row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
1337 VP9Filter *lflvl_ptr = s->lflvl;
1338 ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
1339
1340 for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
1341 set_tile_offset(&tile_col_start, &tile_col_end,
1342 tile_col, s->s.h.tiling.log2_tile_cols, s->sb_cols);
1343 td->tile_col_start = tile_col_start;
1344 if (s->pass != 2) {
1345 memset(td->left_partition_ctx, 0, 8);
1346 memset(td->left_skip_ctx, 0, 8);
1347 if (s->s.h.keyframe || s->s.h.intraonly) {
1348 memset(td->left_mode_ctx, DC_PRED, 16);
1349 } else {

Callers 1

vp9_decode_frameFunction · 0.70

Calls 8

set_tile_offsetFunction · 0.85
vpx_rac_get_prob_branchyFunction · 0.85
decode_sb_memFunction · 0.85
vpx_rac_is_endFunction · 0.85
decode_sbFunction · 0.85
ff_vp9_loopfilter_sbFunction · 0.85
ff_progress_frame_reportFunction · 0.85

Tested by

no test coverage detected