OLD | NEW |
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 d = 0; | 217 d = 0; |
218 for (i = 0; i < n; ++i) | 218 for (i = 0; i < n; ++i) |
219 d |= vp9_read(r, mvcomp->bits[i]) << i; | 219 d |= vp9_read(r, mvcomp->bits[i]) << i; |
220 } | 220 } |
221 | 221 |
222 // Fractional part | 222 // Fractional part |
223 fr = vp9_read_tree(r, vp9_mv_fp_tree, class0 ? mvcomp->class0_fp[d] | 223 fr = vp9_read_tree(r, vp9_mv_fp_tree, class0 ? mvcomp->class0_fp[d] |
224 : mvcomp->fp); | 224 : mvcomp->fp); |
225 | 225 |
226 | |
227 // High precision part (if hp is not used, the default value of the hp is 1) | 226 // High precision part (if hp is not used, the default value of the hp is 1) |
228 hp = usehp ? vp9_read(r, class0 ? mvcomp->class0_hp : mvcomp->hp) | 227 hp = usehp ? vp9_read(r, class0 ? mvcomp->class0_hp : mvcomp->hp) |
229 : 1; | 228 : 1; |
230 | 229 |
231 // Result | 230 // Result |
232 mag = vp9_get_mv_mag(mv_class, (d << 3) | (fr << 1) | hp) + 1; | 231 mag = vp9_get_mv_mag(mv_class, (d << 3) | (fr << 1) | hp) + 1; |
233 return sign ? -mag : mag; | 232 return sign ? -mag : mag; |
234 } | 233 } |
235 | 234 |
236 static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref, | 235 static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 const int allow_hp = cm->allow_high_precision_mv; | 427 const int allow_hp = cm->allow_high_precision_mv; |
429 | 428 |
430 int_mv nearestmv[2], nearmv[2]; | 429 int_mv nearestmv[2], nearmv[2]; |
431 int inter_mode_ctx, ref, is_compound; | 430 int inter_mode_ctx, ref, is_compound; |
432 | 431 |
433 read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame); | 432 read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame); |
434 is_compound = has_second_ref(mbmi); | 433 is_compound = has_second_ref(mbmi); |
435 | 434 |
436 for (ref = 0; ref < 1 + is_compound; ++ref) { | 435 for (ref = 0; ref < 1 + is_compound; ++ref) { |
437 const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; | 436 const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; |
438 const int ref_idx = frame - LAST_FRAME; | 437 RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME]; |
439 if (cm->frame_refs[ref_idx].sf.x_scale_fp == REF_INVALID_SCALE || | 438 xd->block_refs[ref] = ref_buf; |
440 cm->frame_refs[ref_idx].sf.y_scale_fp == REF_INVALID_SCALE ) | 439 if ((!vp9_is_valid_scale(&ref_buf->sf))) |
441 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, | 440 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, |
442 "Reference frame has invalid dimensions"); | 441 "Reference frame has invalid dimensions"); |
| 442 if (ref_buf->buf->corrupted) |
| 443 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, |
| 444 "Block reference is corrupt"); |
| 445 vp9_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col, |
| 446 &ref_buf->sf); |
443 vp9_find_mv_refs(cm, xd, tile, mi, frame, mbmi->ref_mvs[frame], | 447 vp9_find_mv_refs(cm, xd, tile, mi, frame, mbmi->ref_mvs[frame], |
444 mi_row, mi_col); | 448 mi_row, mi_col); |
445 } | 449 } |
446 | 450 |
447 inter_mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]]; | 451 inter_mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]]; |
448 | 452 |
449 if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { | 453 if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { |
450 mbmi->mode = ZEROMV; | 454 mbmi->mode = ZEROMV; |
451 if (bsize < BLOCK_8X8) { | 455 if (bsize < BLOCK_8X8) { |
452 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, | 456 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 } | 542 } |
539 | 543 |
540 void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd, | 544 void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd, |
541 const TileInfo *const tile, | 545 const TileInfo *const tile, |
542 int mi_row, int mi_col, vp9_reader *r) { | 546 int mi_row, int mi_col, vp9_reader *r) { |
543 if (frame_is_intra_only(cm)) | 547 if (frame_is_intra_only(cm)) |
544 read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r); | 548 read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r); |
545 else | 549 else |
546 read_inter_frame_mode_info(cm, xd, tile, mi_row, mi_col, r); | 550 read_inter_frame_mode_info(cm, xd, tile, mi_row, mi_col, r); |
547 } | 551 } |
OLD | NEW |