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

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

Issue 181493009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 9 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
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
11 #include <assert.h> 11 #include <assert.h>
12 #include <stdlib.h> // qsort() 12 #include <stdlib.h> // qsort()
13 13
14 #include "./vp9_rtcd.h" 14 #include "./vp9_rtcd.h"
15 #include "./vpx_scale_rtcd.h" 15 #include "./vpx_scale_rtcd.h"
16 16
17 #include "vpx_mem/vpx_mem.h" 17 #include "vpx_mem/vpx_mem.h"
18 #include "vpx_ports/mem_ops.h"
18 #include "vpx_scale/vpx_scale.h" 19 #include "vpx_scale/vpx_scale.h"
19 20
20 #include "vp9/common/vp9_alloccommon.h" 21 #include "vp9/common/vp9_alloccommon.h"
21 #include "vp9/common/vp9_common.h" 22 #include "vp9/common/vp9_common.h"
22 #include "vp9/common/vp9_entropy.h" 23 #include "vp9/common/vp9_entropy.h"
23 #include "vp9/common/vp9_entropymode.h" 24 #include "vp9/common/vp9_entropymode.h"
24 #include "vp9/common/vp9_idct.h" 25 #include "vp9/common/vp9_idct.h"
25 #include "vp9/common/vp9_pred_common.h" 26 #include "vp9/common/vp9_pred_common.h"
26 #include "vp9/common/vp9_quant_common.h" 27 #include "vp9/common/vp9_quant_common.h"
27 #include "vp9/common/vp9_reconintra.h" 28 #include "vp9/common/vp9_reconintra.h"
28 #include "vp9/common/vp9_reconinter.h" 29 #include "vp9/common/vp9_reconinter.h"
29 #include "vp9/common/vp9_seg_common.h" 30 #include "vp9/common/vp9_seg_common.h"
30 #include "vp9/common/vp9_tile_common.h" 31 #include "vp9/common/vp9_tile_common.h"
31 32
32 #include "vp9/decoder/vp9_decodeframe.h" 33 #include "vp9/decoder/vp9_decodeframe.h"
33 #include "vp9/decoder/vp9_detokenize.h" 34 #include "vp9/decoder/vp9_detokenize.h"
34 #include "vp9/decoder/vp9_decodemv.h" 35 #include "vp9/decoder/vp9_decodemv.h"
35 #include "vp9/decoder/vp9_dsubexp.h" 36 #include "vp9/decoder/vp9_dsubexp.h"
36 #include "vp9/decoder/vp9_dthread.h" 37 #include "vp9/decoder/vp9_dthread.h"
37 #include "vp9/decoder/vp9_onyxd_int.h" 38 #include "vp9/decoder/vp9_onyxd_int.h"
38 #include "vp9/decoder/vp9_read_bit_buffer.h" 39 #include "vp9/decoder/vp9_read_bit_buffer.h"
39 #include "vp9/decoder/vp9_reader.h" 40 #include "vp9/decoder/vp9_reader.h"
40 #include "vp9/decoder/vp9_thread.h" 41 #include "vp9/decoder/vp9_thread.h"
41 42
42 static int read_be32(const uint8_t *p) {
43 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
44 }
45
46 static int is_compound_reference_allowed(const VP9_COMMON *cm) { 43 static int is_compound_reference_allowed(const VP9_COMMON *cm) {
47 int i; 44 int i;
48 for (i = 1; i < REFS_PER_FRAME; ++i) 45 for (i = 1; i < REFS_PER_FRAME; ++i)
49 if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1]) 46 if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1])
50 return 1; 47 return 1;
51 48
52 return 0; 49 return 0;
53 } 50 }
54 51
55 static void setup_compound_reference(VP9_COMMON *cm) { 52 static void setup_compound_reference_mode(VP9_COMMON *cm) {
56 if (cm->ref_frame_sign_bias[LAST_FRAME] == 53 if (cm->ref_frame_sign_bias[LAST_FRAME] ==
57 cm->ref_frame_sign_bias[GOLDEN_FRAME]) { 54 cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
58 cm->comp_fixed_ref = ALTREF_FRAME; 55 cm->comp_fixed_ref = ALTREF_FRAME;
59 cm->comp_var_ref[0] = LAST_FRAME; 56 cm->comp_var_ref[0] = LAST_FRAME;
60 cm->comp_var_ref[1] = GOLDEN_FRAME; 57 cm->comp_var_ref[1] = GOLDEN_FRAME;
61 } else if (cm->ref_frame_sign_bias[LAST_FRAME] == 58 } else if (cm->ref_frame_sign_bias[LAST_FRAME] ==
62 cm->ref_frame_sign_bias[ALTREF_FRAME]) { 59 cm->ref_frame_sign_bias[ALTREF_FRAME]) {
63 cm->comp_fixed_ref = GOLDEN_FRAME; 60 cm->comp_fixed_ref = GOLDEN_FRAME;
64 cm->comp_var_ref[0] = LAST_FRAME; 61 cm->comp_var_ref[0] = LAST_FRAME;
65 cm->comp_var_ref[1] = ALTREF_FRAME; 62 cm->comp_var_ref[1] = ALTREF_FRAME;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 vp9_diff_update_prob(r, &fc->switchable_interp_prob[j][i]); 106 vp9_diff_update_prob(r, &fc->switchable_interp_prob[j][i]);
110 } 107 }
111 108
112 static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) { 109 static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
113 int i, j; 110 int i, j;
114 for (i = 0; i < INTER_MODE_CONTEXTS; ++i) 111 for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
115 for (j = 0; j < INTER_MODES - 1; ++j) 112 for (j = 0; j < INTER_MODES - 1; ++j)
116 vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]); 113 vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
117 } 114 }
118 115
119 static REFERENCE_MODE read_reference_mode(VP9_COMMON *cm, vp9_reader *r) { 116 static REFERENCE_MODE read_frame_reference_mode(const VP9_COMMON *cm,
117 vp9_reader *r) {
120 if (is_compound_reference_allowed(cm)) { 118 if (is_compound_reference_allowed(cm)) {
121 REFERENCE_MODE mode = vp9_read_bit(r); 119 return vp9_read_bit(r) ? (vp9_read_bit(r) ? REFERENCE_MODE_SELECT
122 if (mode) 120 : COMPOUND_REFERENCE)
123 mode += vp9_read_bit(r); 121 : SINGLE_REFERENCE;
124 setup_compound_reference(cm);
125 return mode;
126 } else { 122 } else {
127 return SINGLE_REFERENCE; 123 return SINGLE_REFERENCE;
128 } 124 }
129 } 125 }
130 126
131 static void read_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) { 127 static void read_frame_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) {
128 FRAME_CONTEXT *const fc = &cm->fc;
132 int i; 129 int i;
130
133 if (cm->reference_mode == REFERENCE_MODE_SELECT) 131 if (cm->reference_mode == REFERENCE_MODE_SELECT)
134 for (i = 0; i < COMP_INTER_CONTEXTS; i++) 132 for (i = 0; i < COMP_INTER_CONTEXTS; ++i)
135 vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]); 133 vp9_diff_update_prob(r, &fc->comp_inter_prob[i]);
136 134
137 if (cm->reference_mode != COMPOUND_REFERENCE) 135 if (cm->reference_mode != COMPOUND_REFERENCE)
138 for (i = 0; i < REF_CONTEXTS; i++) { 136 for (i = 0; i < REF_CONTEXTS; ++i) {
139 vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][0]); 137 vp9_diff_update_prob(r, &fc->single_ref_prob[i][0]);
140 vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]); 138 vp9_diff_update_prob(r, &fc->single_ref_prob[i][1]);
141 } 139 }
142 140
143 if (cm->reference_mode != SINGLE_REFERENCE) 141 if (cm->reference_mode != SINGLE_REFERENCE)
144 for (i = 0; i < REF_CONTEXTS; i++) 142 for (i = 0; i < REF_CONTEXTS; ++i)
145 vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]); 143 vp9_diff_update_prob(r, &fc->comp_ref_prob[i]);
146 } 144 }
147 145
148 static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) { 146 static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) {
149 int i; 147 int i;
150 for (i = 0; i < n; ++i) 148 for (i = 0; i < n; ++i)
151 if (vp9_read(r, NMV_UPDATE_PROB)) 149 if (vp9_read(r, NMV_UPDATE_PROB))
152 p[i] = (vp9_read_literal(r, 7) << 1) | 1; 150 p[i] = (vp9_read_literal(r, 7) << 1) | 1;
153 } 151 }
154 152
155 static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) { 153 static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 }; 280 };
283 281
284 static void predict_and_reconstruct_intra_block(int plane, int block, 282 static void predict_and_reconstruct_intra_block(int plane, int block,
285 BLOCK_SIZE plane_bsize, 283 BLOCK_SIZE plane_bsize,
286 TX_SIZE tx_size, void *arg) { 284 TX_SIZE tx_size, void *arg) {
287 struct intra_args *const args = arg; 285 struct intra_args *const args = arg;
288 VP9_COMMON *const cm = args->cm; 286 VP9_COMMON *const cm = args->cm;
289 MACROBLOCKD *const xd = args->xd; 287 MACROBLOCKD *const xd = args->xd;
290 struct macroblockd_plane *const pd = &xd->plane[plane]; 288 struct macroblockd_plane *const pd = &xd->plane[plane];
291 MODE_INFO *const mi = xd->mi_8x8[0]; 289 MODE_INFO *const mi = xd->mi_8x8[0];
292 const MB_PREDICTION_MODE mode = (plane == 0) 290 const MB_PREDICTION_MODE mode = (plane == 0) ? get_y_mode(mi, block)
293 ? ((mi->mbmi.sb_type < BLOCK_8X8) ? mi->bmi[block].as_mode 291 : mi->mbmi.uv_mode;
294 : mi->mbmi.mode)
295 : mi->mbmi.uv_mode;
296 int x, y; 292 int x, y;
297 uint8_t *dst; 293 uint8_t *dst;
298 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y); 294 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
299 dst = &pd->dst.buf[4 * y * pd->dst.stride + 4 * x]; 295 dst = &pd->dst.buf[4 * y * pd->dst.stride + 4 * x];
300 296
301 vp9_predict_intra_block(xd, block >> (tx_size << 1), 297 vp9_predict_intra_block(xd, block >> (tx_size << 1),
302 b_width_log2(plane_bsize), tx_size, mode, 298 b_width_log2(plane_bsize), tx_size, mode,
303 dst, pd->dst.stride, dst, pd->dst.stride, 299 dst, pd->dst.stride, dst, pd->dst.stride,
304 x, y, plane); 300 x, y, plane);
305 301
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 const int bh = num_8x8_blocks_high_lookup[bsize]; 339 const int bh = num_8x8_blocks_high_lookup[bsize];
344 const int x_mis = MIN(bw, cm->mi_cols - mi_col); 340 const int x_mis = MIN(bw, cm->mi_cols - mi_col);
345 const int y_mis = MIN(bh, cm->mi_rows - mi_row); 341 const int y_mis = MIN(bh, cm->mi_rows - mi_row);
346 const int offset = mi_row * cm->mode_info_stride + mi_col; 342 const int offset = mi_row * cm->mode_info_stride + mi_col;
347 const int tile_offset = tile->mi_row_start * cm->mode_info_stride + 343 const int tile_offset = tile->mi_row_start * cm->mode_info_stride +
348 tile->mi_col_start; 344 tile->mi_col_start;
349 int x, y; 345 int x, y;
350 346
351 xd->mi_8x8 = cm->mi_grid_visible + offset; 347 xd->mi_8x8 = cm->mi_grid_visible + offset;
352 xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset; 348 xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset;
353 // Special case: if prev_mi is NULL, the previous mode info context 349
354 // cannot be used. 350 xd->last_mi = cm->coding_use_prev_mi && cm->prev_mi ?
355 xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL; 351 xd->prev_mi_8x8[0] : NULL;
356 352
357 xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset; 353 xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset;
358 xd->mi_8x8[0]->mbmi.sb_type = bsize; 354 xd->mi_8x8[0]->mbmi.sb_type = bsize;
359 for (y = 0; y < y_mis; ++y) 355 for (y = 0; y < y_mis; ++y)
360 for (x = !y; x < x_mis; ++x) 356 for (x = !y; x < x_mis; ++x)
361 xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0]; 357 xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0];
362 358
363 set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col); 359 set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col);
364 360
365 // Distance of Mb to the various image edges. These are specified to 8th pel 361 // Distance of Mb to the various image edges. These are specified to 8th pel
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 int is_last, 825 int is_last,
830 struct vpx_internal_error_info *error_info, 826 struct vpx_internal_error_info *error_info,
831 const uint8_t **data) { 827 const uint8_t **data) {
832 size_t size; 828 size_t size;
833 829
834 if (!is_last) { 830 if (!is_last) {
835 if (!read_is_valid(*data, 4, data_end)) 831 if (!read_is_valid(*data, 4, data_end))
836 vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME, 832 vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME,
837 "Truncated packet or corrupt tile length"); 833 "Truncated packet or corrupt tile length");
838 834
839 size = read_be32(*data); 835 size = mem_get_be32(*data);
840 *data += 4; 836 *data += 4;
841 837
842 if (size > (size_t)(data_end - *data)) 838 if (size > (size_t)(data_end - *data))
843 vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME, 839 vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME,
844 "Truncated packet or corrupt tile size"); 840 "Truncated packet or corrupt tile size");
845 } else { 841 } else {
846 size = data_end - *data; 842 size = data_end - *data;
847 } 843 }
848 return size; 844 return size;
849 } 845 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1080
1085 static void check_sync_code(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { 1081 static void check_sync_code(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
1086 if (vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_0 || 1082 if (vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_0 ||
1087 vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_1 || 1083 vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_1 ||
1088 vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_2) { 1084 vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_2) {
1089 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, 1085 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
1090 "Invalid frame sync code"); 1086 "Invalid frame sync code");
1091 } 1087 }
1092 } 1088 }
1093 1089
1094 static void error_handler(void *data, size_t bit_offset) { 1090 static void error_handler(void *data) {
1095 VP9_COMMON *const cm = (VP9_COMMON *)data; 1091 VP9_COMMON *const cm = (VP9_COMMON *)data;
1096 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet"); 1092 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet");
1097 } 1093 }
1098 1094
1099 #define RESERVED \ 1095 #define RESERVED \
1100 if (vp9_rb_read_bit(rb)) \ 1096 if (vp9_rb_read_bit(rb)) \
1101 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, \ 1097 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, \
1102 "Reserved bit must be unset") 1098 "Reserved bit must be unset")
1103 1099
1104 static size_t read_uncompressed_header(VP9D_COMP *pbi, 1100 static size_t read_uncompressed_header(VP9D_COMP *pbi,
1105 struct vp9_read_bit_buffer *rb) { 1101 struct vp9_read_bit_buffer *rb) {
1106 VP9_COMMON *const cm = &pbi->common; 1102 VP9_COMMON *const cm = &pbi->common;
1107 size_t sz; 1103 size_t sz;
1108 int i; 1104 int i;
1109 1105
1110 cm->last_frame_type = cm->frame_type; 1106 cm->last_frame_type = cm->frame_type;
1111 1107
1112 if (vp9_rb_read_literal(rb, 2) != VP9_FRAME_MARKER) 1108 if (vp9_rb_read_literal(rb, 2) != VP9_FRAME_MARKER)
1113 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, 1109 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
1114 "Invalid frame marker"); 1110 "Invalid frame marker");
1115 1111
1116 cm->version = vp9_rb_read_bit(rb); 1112 cm->version = vp9_rb_read_bit(rb);
1117 RESERVED; 1113 RESERVED;
1118 1114
1119 cm->show_existing_frame = vp9_rb_read_bit(rb); 1115 cm->show_existing_frame = vp9_rb_read_bit(rb);
1120 if (cm->show_existing_frame) { 1116 if (cm->show_existing_frame) {
1121 // Show an existing frame directly. 1117 // Show an existing frame directly.
1122 const int frame_to_show = cm->ref_frame_map[vp9_rb_read_literal(rb, 3)]; 1118 const int frame_to_show = cm->ref_frame_map[vp9_rb_read_literal(rb, 3)];
1119
1120 if (cm->frame_bufs[frame_to_show].ref_count < 1)
1121 vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
1122 "Buffer %d does not contain a decoded frame",
1123 frame_to_show);
1124
1123 ref_cnt_fb(cm->frame_bufs, &cm->new_fb_idx, frame_to_show); 1125 ref_cnt_fb(cm->frame_bufs, &cm->new_fb_idx, frame_to_show);
1124 pbi->refresh_frame_flags = 0; 1126 pbi->refresh_frame_flags = 0;
1125 cm->lf.filter_level = 0; 1127 cm->lf.filter_level = 0;
1126 cm->show_frame = 1; 1128 cm->show_frame = 1;
1127 return 0; 1129 return 0;
1128 } 1130 }
1129 1131
1130 cm->frame_type = (FRAME_TYPE) vp9_rb_read_bit(rb); 1132 cm->frame_type = (FRAME_TYPE) vp9_rb_read_bit(rb);
1131 cm->show_frame = vp9_rb_read_bit(rb); 1133 cm->show_frame = vp9_rb_read_bit(rb);
1132 cm->error_resilient_mode = vp9_rb_read_bit(rb); 1134 cm->error_resilient_mode = vp9_rb_read_bit(rb);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 cm->allow_high_precision_mv = vp9_rb_read_bit(rb); 1191 cm->allow_high_precision_mv = vp9_rb_read_bit(rb);
1190 cm->interp_filter = read_interp_filter(rb); 1192 cm->interp_filter = read_interp_filter(rb);
1191 1193
1192 for (i = 0; i < REFS_PER_FRAME; ++i) { 1194 for (i = 0; i < REFS_PER_FRAME; ++i) {
1193 RefBuffer *const ref_buf = &cm->frame_refs[i]; 1195 RefBuffer *const ref_buf = &cm->frame_refs[i];
1194 vp9_setup_scale_factors_for_frame(&ref_buf->sf, 1196 vp9_setup_scale_factors_for_frame(&ref_buf->sf,
1195 ref_buf->buf->y_crop_width, 1197 ref_buf->buf->y_crop_width,
1196 ref_buf->buf->y_crop_height, 1198 ref_buf->buf->y_crop_height,
1197 cm->width, cm->height); 1199 cm->width, cm->height);
1198 if (vp9_is_scaled(&ref_buf->sf)) 1200 if (vp9_is_scaled(&ref_buf->sf))
1199 vp9_extend_frame_borders(ref_buf->buf, 1201 vp9_extend_frame_borders(ref_buf->buf);
1200 cm->subsampling_x, cm->subsampling_y);
1201 } 1202 }
1202 } 1203 }
1203 } 1204 }
1204 1205
1205 if (!cm->error_resilient_mode) { 1206 if (!cm->error_resilient_mode) {
1207 cm->coding_use_prev_mi = 1;
1206 cm->refresh_frame_context = vp9_rb_read_bit(rb); 1208 cm->refresh_frame_context = vp9_rb_read_bit(rb);
1207 cm->frame_parallel_decoding_mode = vp9_rb_read_bit(rb); 1209 cm->frame_parallel_decoding_mode = vp9_rb_read_bit(rb);
1208 } else { 1210 } else {
1211 cm->coding_use_prev_mi = 0;
1209 cm->refresh_frame_context = 0; 1212 cm->refresh_frame_context = 0;
1210 cm->frame_parallel_decoding_mode = 1; 1213 cm->frame_parallel_decoding_mode = 1;
1211 } 1214 }
1212 1215
1213 // This flag will be overridden by the call to vp9_setup_past_independence 1216 // This flag will be overridden by the call to vp9_setup_past_independence
1214 // below, forcing the use of context 0 for those frame types. 1217 // below, forcing the use of context 0 for those frame types.
1215 cm->frame_context_idx = vp9_rb_read_literal(rb, FRAME_CONTEXTS_LOG2); 1218 cm->frame_context_idx = vp9_rb_read_literal(rb, FRAME_CONTEXTS_LOG2);
1216 1219
1217 if (frame_is_intra_only(cm) || cm->error_resilient_mode) 1220 if (frame_is_intra_only(cm) || cm->error_resilient_mode)
1218 vp9_setup_past_independence(cm); 1221 vp9_setup_past_independence(cm);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 int i, j; 1259 int i, j;
1257 1260
1258 read_inter_mode_probs(fc, &r); 1261 read_inter_mode_probs(fc, &r);
1259 1262
1260 if (cm->interp_filter == SWITCHABLE) 1263 if (cm->interp_filter == SWITCHABLE)
1261 read_switchable_interp_probs(fc, &r); 1264 read_switchable_interp_probs(fc, &r);
1262 1265
1263 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) 1266 for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
1264 vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]); 1267 vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]);
1265 1268
1266 cm->reference_mode = read_reference_mode(cm, &r); 1269 cm->reference_mode = read_frame_reference_mode(cm, &r);
1267 read_reference_mode_probs(cm, &r); 1270 if (cm->reference_mode != SINGLE_REFERENCE)
1271 setup_compound_reference_mode(cm);
1272 read_frame_reference_mode_probs(cm, &r);
1268 1273
1269 for (j = 0; j < BLOCK_SIZE_GROUPS; j++) 1274 for (j = 0; j < BLOCK_SIZE_GROUPS; j++)
1270 for (i = 0; i < INTRA_MODES - 1; ++i) 1275 for (i = 0; i < INTRA_MODES - 1; ++i)
1271 vp9_diff_update_prob(&r, &fc->y_mode_prob[j][i]); 1276 vp9_diff_update_prob(&r, &fc->y_mode_prob[j][i]);
1272 1277
1273 for (j = 0; j < PARTITION_CONTEXTS; ++j) 1278 for (j = 0; j < PARTITION_CONTEXTS; ++j)
1274 for (i = 0; i < PARTITION_TYPES - 1; ++i) 1279 for (i = 0; i < PARTITION_TYPES - 1; ++i)
1275 vp9_diff_update_prob(&r, &fc->partition_prob[j][i]); 1280 vp9_diff_update_prob(&r, &fc->partition_prob[j][i]);
1276 1281
1277 read_mv_probs(nmvc, cm->allow_high_precision_mv, &r); 1282 read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; 1371 pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
1367 if (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) { 1372 if (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) {
1368 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, 1373 vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
1369 "Loop filter thread creation failed"); 1374 "Loop filter thread creation failed");
1370 } 1375 }
1371 } 1376 }
1372 1377
1373 alloc_tile_storage(pbi, tile_rows, tile_cols); 1378 alloc_tile_storage(pbi, tile_rows, tile_cols);
1374 1379
1375 xd->mode_info_stride = cm->mode_info_stride; 1380 xd->mode_info_stride = cm->mode_info_stride;
1376 set_prev_mi(cm); 1381 if (cm->coding_use_prev_mi)
1382 set_prev_mi(cm);
1383 else
1384 cm->prev_mi = NULL;
1377 1385
1378 setup_plane_dequants(cm, xd, cm->base_qindex); 1386 setup_plane_dequants(cm, xd, cm->base_qindex);
1379 vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y); 1387 vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
1380 1388
1381 cm->fc = cm->frame_contexts[cm->frame_context_idx]; 1389 cm->fc = cm->frame_contexts[cm->frame_context_idx];
1382 vp9_zero(cm->counts); 1390 vp9_zero(cm->counts);
1383 for (i = 0; i < MAX_MB_PLANE; ++i) 1391 for (i = 0; i < MAX_MB_PLANE; ++i)
1384 vpx_memset(xd->plane[i].dqcoeff, 0, 64 * 64 * sizeof(int16_t)); 1392 vpx_memset(xd->plane[i].dqcoeff, 0, 64 * 64 * sizeof(int16_t));
1385 1393
1386 xd->corrupted = 0; 1394 xd->corrupted = 0;
(...skipping 27 matching lines...) Expand all
1414 } 1422 }
1415 } else { 1423 } else {
1416 debug_check_frame_counts(cm); 1424 debug_check_frame_counts(cm);
1417 } 1425 }
1418 1426
1419 if (cm->refresh_frame_context) 1427 if (cm->refresh_frame_context)
1420 cm->frame_contexts[cm->frame_context_idx] = cm->fc; 1428 cm->frame_contexts[cm->frame_context_idx] = cm->fc;
1421 1429
1422 return 0; 1430 return 0;
1423 } 1431 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c ('k') | source/libvpx/vp9/decoder/vp9_decodemv.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698