Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: source/libvpx/vp9/decoder/vp9_decodframe.c

Issue 17451020: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/encoder/vp9_bitstream.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 decode_block(plane, block, bsize, ss_txfrm_size, arg); 270 decode_block(plane, block, bsize, ss_txfrm_size, arg);
271 } 271 }
272 272
273 static void decode_atom(VP9D_COMP *pbi, MACROBLOCKD *xd, 273 static void decode_atom(VP9D_COMP *pbi, MACROBLOCKD *xd,
274 int mi_row, int mi_col, 274 int mi_row, int mi_col,
275 vp9_reader *r, BLOCK_SIZE_TYPE bsize) { 275 vp9_reader *r, BLOCK_SIZE_TYPE bsize) {
276 MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi; 276 MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
277 277
278 assert(mbmi->ref_frame[0] != INTRA_FRAME); 278 assert(mbmi->ref_frame[0] != INTRA_FRAME);
279 279 vp9_setup_interp_filters(xd, mbmi->interp_filter, &pbi->common);
280 if ((pbi->common.frame_type != KEY_FRAME) && (!pbi->common.intra_only))
281 vp9_setup_interp_filters(xd, mbmi->interp_filter, &pbi->common);
282 280
283 // prediction 281 // prediction
284 vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize); 282 vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
285 283
286 if (mbmi->mb_skip_coeff) { 284 if (mbmi->mb_skip_coeff) {
287 vp9_reset_sb_tokens_context(xd, bsize); 285 vp9_reset_sb_tokens_context(xd, bsize);
288 } else { 286 } else {
289 if (xd->segmentation_enabled) 287 if (xd->segmentation_enabled)
290 mb_init_dequantizer(&pbi->common, xd); 288 mb_init_dequantizer(&pbi->common, xd);
291 289
(...skipping 28 matching lines...) Expand all
320 const int bw = 1 << bwl, bh = 1 << bhl; 318 const int bw = 1 << bwl, bh = 1 << bhl;
321 int n, eobtotal; 319 int n, eobtotal;
322 VP9_COMMON *const pc = &pbi->common; 320 VP9_COMMON *const pc = &pbi->common;
323 MODE_INFO *const mi = xd->mode_info_context; 321 MODE_INFO *const mi = xd->mode_info_context;
324 MB_MODE_INFO *const mbmi = &mi->mbmi; 322 MB_MODE_INFO *const mbmi = &mi->mbmi;
325 const int mis = pc->mode_info_stride; 323 const int mis = pc->mode_info_stride;
326 324
327 assert(mbmi->sb_type == bsize); 325 assert(mbmi->sb_type == bsize);
328 assert(mbmi->ref_frame[0] != INTRA_FRAME); 326 assert(mbmi->ref_frame[0] != INTRA_FRAME);
329 327
330 if (pbi->common.frame_type != KEY_FRAME) 328 vp9_setup_interp_filters(xd, mbmi->interp_filter, pc);
331 vp9_setup_interp_filters(xd, mbmi->interp_filter, pc);
332 329
333 // generate prediction 330 // generate prediction
334 vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize); 331 vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
335 332
336 if (mbmi->mb_skip_coeff) { 333 if (mbmi->mb_skip_coeff) {
337 vp9_reset_sb_tokens_context(xd, bsize); 334 vp9_reset_sb_tokens_context(xd, bsize);
338 } else { 335 } else {
339 // re-initialize macroblock dequantizer before detokenization 336 // re-initialize macroblock dequantizer before detokenization
340 if (xd->segmentation_enabled) 337 if (xd->segmentation_enabled)
341 mb_init_dequantizer(pc, xd); 338 mb_init_dequantizer(pc, xd);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw); 382 set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw);
386 383
387 setup_dst_planes(xd, &cm->yv12_fb[cm->new_fb_idx], mi_row, mi_col); 384 setup_dst_planes(xd, &cm->yv12_fb[cm->new_fb_idx], mi_row, mi_col);
388 } 385 }
389 386
390 static void set_refs(VP9D_COMP *pbi, int mi_row, int mi_col) { 387 static void set_refs(VP9D_COMP *pbi, int mi_row, int mi_col) {
391 VP9_COMMON *const cm = &pbi->common; 388 VP9_COMMON *const cm = &pbi->common;
392 MACROBLOCKD *const xd = &pbi->mb; 389 MACROBLOCKD *const xd = &pbi->mb;
393 MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi; 390 MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
394 391
395 if (mbmi->ref_frame[0] > INTRA_FRAME) { 392 // Select the appropriate reference frame for this MB
393 const int fb_idx = cm->active_ref_idx[mbmi->ref_frame[0] - 1];
394 const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[fb_idx];
395 xd->scale_factor[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1];
396 xd->scale_factor_uv[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1];
397 setup_pre_planes(xd, cfg, NULL, mi_row, mi_col, xd->scale_factor,
398 xd->scale_factor_uv);
399 xd->corrupted |= cfg->corrupted;
400
401 if (mbmi->ref_frame[1] > INTRA_FRAME) {
396 // Select the appropriate reference frame for this MB 402 // Select the appropriate reference frame for this MB
397 const int fb_idx = cm->active_ref_idx[mbmi->ref_frame[0] - 1]; 403 const int second_fb_idx = cm->active_ref_idx[mbmi->ref_frame[1] - 1];
398 const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[fb_idx]; 404 const YV12_BUFFER_CONFIG *second_cfg = &cm->yv12_fb[second_fb_idx];
399 xd->scale_factor[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1]; 405 xd->scale_factor[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
400 xd->scale_factor_uv[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1]; 406 xd->scale_factor_uv[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
401 setup_pre_planes(xd, cfg, NULL, mi_row, mi_col, 407 setup_pre_planes(xd, NULL, second_cfg, mi_row, mi_col, xd->scale_factor,
402 xd->scale_factor, xd->scale_factor_uv); 408 xd->scale_factor_uv);
403 xd->corrupted |= cfg->corrupted; 409 xd->corrupted |= second_cfg->corrupted;
404
405 if (mbmi->ref_frame[1] > INTRA_FRAME) {
406 // Select the appropriate reference frame for this MB
407 const int second_fb_idx = cm->active_ref_idx[mbmi->ref_frame[1] - 1];
408 const YV12_BUFFER_CONFIG *second_cfg = &cm->yv12_fb[second_fb_idx];
409 xd->scale_factor[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
410 xd->scale_factor_uv[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
411 setup_pre_planes(xd, NULL, second_cfg, mi_row, mi_col,
412 xd->scale_factor, xd->scale_factor_uv);
413 xd->corrupted |= second_cfg->corrupted;
414 }
415 } 410 }
416 } 411 }
417 412
418 static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col, 413 static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
419 vp9_reader *r, BLOCK_SIZE_TYPE bsize) { 414 vp9_reader *r, BLOCK_SIZE_TYPE bsize) {
420 MACROBLOCKD *const xd = &pbi->mb; 415 MACROBLOCKD *const xd = &pbi->mb;
421 416
422 if (bsize < BLOCK_SIZE_SB8X8) 417 if (bsize < BLOCK_SIZE_SB8X8)
423 if (xd->ab_index > 0) 418 if (xd->ab_index > 0)
424 return; 419 return;
425 set_offsets(pbi, bsize, mi_row, mi_col); 420 set_offsets(pbi, bsize, mi_row, mi_col);
426 vp9_decode_mb_mode_mv(pbi, xd, mi_row, mi_col, r); 421 vp9_decode_mb_mode_mv(pbi, xd, mi_row, mi_col, r);
427 set_refs(pbi, mi_row, mi_col);
428 422
429 if (xd->mode_info_context->mbmi.ref_frame[0] == INTRA_FRAME) 423 if (xd->mode_info_context->mbmi.ref_frame[0] == INTRA_FRAME) {
430 decode_sb_intra(pbi, xd, mi_row, mi_col, r, (bsize < BLOCK_SIZE_SB8X8) ? 424 decode_sb_intra(pbi, xd, mi_row, mi_col, r, (bsize < BLOCK_SIZE_SB8X8) ?
431 BLOCK_SIZE_SB8X8 : bsize); 425 BLOCK_SIZE_SB8X8 : bsize);
432 else if (bsize < BLOCK_SIZE_SB8X8) 426 } else {
433 decode_atom(pbi, xd, mi_row, mi_col, r, BLOCK_SIZE_SB8X8); 427 set_refs(pbi, mi_row, mi_col);
434 else 428 if (bsize < BLOCK_SIZE_SB8X8)
435 decode_sb(pbi, xd, mi_row, mi_col, r, bsize); 429 decode_atom(pbi, xd, mi_row, mi_col, r, BLOCK_SIZE_SB8X8);
436 430 else
431 decode_sb(pbi, xd, mi_row, mi_col, r, bsize);
432 }
437 xd->corrupted |= vp9_reader_has_error(r); 433 xd->corrupted |= vp9_reader_has_error(r);
438 } 434 }
439 435
440 static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col, 436 static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
441 vp9_reader* r, BLOCK_SIZE_TYPE bsize) { 437 vp9_reader* r, BLOCK_SIZE_TYPE bsize) {
442 VP9_COMMON *const pc = &pbi->common; 438 VP9_COMMON *const pc = &pbi->common;
443 MACROBLOCKD *const xd = &pbi->mb; 439 MACROBLOCKD *const xd = &pbi->mb;
444 int bs = (1 << mi_width_log2(bsize)) / 2, n; 440 int bs = (1 << mi_width_log2(bsize)) / 2, n;
445 PARTITION_TYPE partition = PARTITION_NONE; 441 PARTITION_TYPE partition = PARTITION_NONE;
446 BLOCK_SIZE_TYPE subsize; 442 BLOCK_SIZE_TYPE subsize;
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 "A stream must start with a complete key frame"); 1176 "A stream must start with a complete key frame");
1181 } 1177 }
1182 1178
1183 // Adaptation 1179 // Adaptation
1184 if (!pc->error_resilient_mode && !pc->frame_parallel_decoding_mode) { 1180 if (!pc->error_resilient_mode && !pc->frame_parallel_decoding_mode) {
1185 vp9_adapt_coef_probs(pc); 1181 vp9_adapt_coef_probs(pc);
1186 1182
1187 if ((!keyframe) && (!pc->intra_only)) { 1183 if ((!keyframe) && (!pc->intra_only)) {
1188 vp9_adapt_mode_probs(pc); 1184 vp9_adapt_mode_probs(pc);
1189 vp9_adapt_mode_context(pc); 1185 vp9_adapt_mode_context(pc);
1190 vp9_adapt_nmv_probs(pc, xd->allow_high_precision_mv); 1186 vp9_adapt_mv_probs(pc, xd->allow_high_precision_mv);
1191 } 1187 }
1192 } 1188 }
1193 1189
1194 if (pc->refresh_frame_context) 1190 if (pc->refresh_frame_context)
1195 pc->frame_contexts[pc->frame_context_idx] = pc->fc; 1191 pc->frame_contexts[pc->frame_context_idx] = pc->fc;
1196 1192
1197 *p_data_end = vp9_reader_find_end(&residual_bc); 1193 *p_data_end = vp9_reader_find_end(&residual_bc);
1198 return 0; 1194 return 0;
1199 } 1195 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/encoder/vp9_bitstream.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698