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

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

Issue 1302353004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodeframe.c ('k') | source/libvpx/vp9/decoder/vp9_decoder.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd, 82 static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
83 int allow_select, vpx_reader *r) { 83 int allow_select, vpx_reader *r) {
84 TX_MODE tx_mode = cm->tx_mode; 84 TX_MODE tx_mode = cm->tx_mode;
85 BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; 85 BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
86 const TX_SIZE max_tx_size = max_txsize_lookup[bsize]; 86 const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
87 if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8) 87 if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
88 return read_selected_tx_size(cm, xd, max_tx_size, r); 88 return read_selected_tx_size(cm, xd, max_tx_size, r);
89 else 89 else
90 return MIN(max_tx_size, tx_mode_to_biggest_tx_size[tx_mode]); 90 return VPXMIN(max_tx_size, tx_mode_to_biggest_tx_size[tx_mode]);
91 } 91 }
92 92
93 static int dec_get_segment_id(const VP9_COMMON *cm, const uint8_t *segment_ids, 93 static int dec_get_segment_id(const VP9_COMMON *cm, const uint8_t *segment_ids,
94 int mi_offset, int x_mis, int y_mis) { 94 int mi_offset, int x_mis, int y_mis) {
95 int x, y, segment_id = INT_MAX; 95 int x, y, segment_id = INT_MAX;
96 96
97 for (y = 0; y < y_mis; y++) 97 for (y = 0; y < y_mis; y++)
98 for (x = 0; x < x_mis; x++) 98 for (x = 0; x < x_mis; x++)
99 segment_id = MIN(segment_id, 99 segment_id =
100 segment_ids[mi_offset + y * cm->mi_cols + x]); 100 VPXMIN(segment_id, segment_ids[mi_offset + y * cm->mi_cols + x]);
101 101
102 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); 102 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
103 return segment_id; 103 return segment_id;
104 } 104 }
105 105
106 static void set_segment_id(VP9_COMMON *cm, int mi_offset, 106 static void set_segment_id(VP9_COMMON *cm, int mi_offset,
107 int x_mis, int y_mis, int segment_id) { 107 int x_mis, int y_mis, int segment_id) {
108 int x, y; 108 int x, y;
109 109
110 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); 110 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd, 149 static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
150 int mi_row, int mi_col, vpx_reader *r) { 150 int mi_row, int mi_col, vpx_reader *r) {
151 struct segmentation *const seg = &cm->seg; 151 struct segmentation *const seg = &cm->seg;
152 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; 152 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
153 int predicted_segment_id, segment_id; 153 int predicted_segment_id, segment_id;
154 const int mi_offset = mi_row * cm->mi_cols + mi_col; 154 const int mi_offset = mi_row * cm->mi_cols + mi_col;
155 const int bw = xd->plane[0].n4_w >> 1; 155 const int bw = xd->plane[0].n4_w >> 1;
156 const int bh = xd->plane[0].n4_h >> 1; 156 const int bh = xd->plane[0].n4_h >> 1;
157 157
158 // TODO(slavarnway): move x_mis, y_mis into xd ????? 158 // TODO(slavarnway): move x_mis, y_mis into xd ?????
159 const int x_mis = MIN(cm->mi_cols - mi_col, bw); 159 const int x_mis = VPXMIN(cm->mi_cols - mi_col, bw);
160 const int y_mis = MIN(cm->mi_rows - mi_row, bh); 160 const int y_mis = VPXMIN(cm->mi_rows - mi_row, bh);
161 161
162 if (!seg->enabled) 162 if (!seg->enabled)
163 return 0; // Default for disabled segmentation 163 return 0; // Default for disabled segmentation
164 164
165 predicted_segment_id = cm->last_frame_seg_map ? 165 predicted_segment_id = cm->last_frame_seg_map ?
166 dec_get_segment_id(cm, cm->last_frame_seg_map, mi_offset, x_mis, y_mis) : 166 dec_get_segment_id(cm, cm->last_frame_seg_map, mi_offset, x_mis, y_mis) :
167 0; 167 0;
168 168
169 if (!seg->update_map) { 169 if (!seg->update_map) {
170 copy_segment_id(cm, cm->last_frame_seg_map, cm->current_frame_seg_map, 170 copy_segment_id(cm, cm->last_frame_seg_map, cm->current_frame_seg_map,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 MB_MODE_INFO *const mbmi = &mi->mbmi; 205 MB_MODE_INFO *const mbmi = &mi->mbmi;
206 const MODE_INFO *above_mi = xd->above_mi; 206 const MODE_INFO *above_mi = xd->above_mi;
207 const MODE_INFO *left_mi = xd->left_mi; 207 const MODE_INFO *left_mi = xd->left_mi;
208 const BLOCK_SIZE bsize = mbmi->sb_type; 208 const BLOCK_SIZE bsize = mbmi->sb_type;
209 int i; 209 int i;
210 const int mi_offset = mi_row * cm->mi_cols + mi_col; 210 const int mi_offset = mi_row * cm->mi_cols + mi_col;
211 const int bw = xd->plane[0].n4_w >> 1; 211 const int bw = xd->plane[0].n4_w >> 1;
212 const int bh = xd->plane[0].n4_h >> 1; 212 const int bh = xd->plane[0].n4_h >> 1;
213 213
214 // TODO(slavarnway): move x_mis, y_mis into xd ????? 214 // TODO(slavarnway): move x_mis, y_mis into xd ?????
215 const int x_mis = MIN(cm->mi_cols - mi_col, bw); 215 const int x_mis = VPXMIN(cm->mi_cols - mi_col, bw);
216 const int y_mis = MIN(cm->mi_rows - mi_row, bh); 216 const int y_mis = VPXMIN(cm->mi_rows - mi_row, bh);
217 217
218 mbmi->segment_id = read_intra_segment_id(cm, mi_offset, x_mis, y_mis, r); 218 mbmi->segment_id = read_intra_segment_id(cm, mi_offset, x_mis, y_mis, r);
219 mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r); 219 mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
220 mbmi->tx_size = read_tx_size(cm, xd, 1, r); 220 mbmi->tx_size = read_tx_size(cm, xd, 1, r);
221 mbmi->ref_frame[0] = INTRA_FRAME; 221 mbmi->ref_frame[0] = INTRA_FRAME;
222 mbmi->ref_frame[1] = NONE; 222 mbmi->ref_frame[1] = NONE;
223 223
224 switch (bsize) { 224 switch (bsize) {
225 case BLOCK_4X4: 225 case BLOCK_4X4:
226 for (i = 0; i < 4; ++i) 226 for (i = 0; i < 4; ++i)
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 &nearest_sub8x8[ref], 553 &nearest_sub8x8[ref],
554 &near_sub8x8[ref], 554 &near_sub8x8[ref],
555 dummy_mode_ctx); 555 dummy_mode_ctx);
556 } 556 }
557 557
558 if (!assign_mv(cm, xd, b_mode, block, nearestmv, 558 if (!assign_mv(cm, xd, b_mode, block, nearestmv,
559 nearest_sub8x8, near_sub8x8, 559 nearest_sub8x8, near_sub8x8,
560 is_compound, allow_hp, r)) { 560 is_compound, allow_hp, r)) {
561 xd->corrupted |= 1; 561 xd->corrupted |= 1;
562 break; 562 break;
563 }; 563 }
564 564
565 mi->bmi[j].as_mv[0].as_int = block[0].as_int; 565 mi->bmi[j].as_mv[0].as_int = block[0].as_int;
566 if (is_compound) 566 if (is_compound)
567 mi->bmi[j].as_mv[1].as_int = block[1].as_int; 567 mi->bmi[j].as_mv[1].as_int = block[1].as_int;
568 568
569 if (num_4x4_h == 2) 569 if (num_4x4_h == 2)
570 mi->bmi[j + 2] = mi->bmi[j]; 570 mi->bmi[j + 2] = mi->bmi[j];
571 if (num_4x4_w == 2) 571 if (num_4x4_w == 2)
572 mi->bmi[j + 1] = mi->bmi[j]; 572 mi->bmi[j + 1] = mi->bmi[j];
573 } 573 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 for (w = 0; w < x_mis; ++w) { 622 for (w = 0; w < x_mis; ++w) {
623 MV_REF *const mv = frame_mv + w; 623 MV_REF *const mv = frame_mv + w;
624 mv->ref_frame[0] = mi->mbmi.ref_frame[0]; 624 mv->ref_frame[0] = mi->mbmi.ref_frame[0];
625 mv->ref_frame[1] = mi->mbmi.ref_frame[1]; 625 mv->ref_frame[1] = mi->mbmi.ref_frame[1];
626 mv->mv[0].as_int = mi->mbmi.mv[0].as_int; 626 mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
627 mv->mv[1].as_int = mi->mbmi.mv[1].as_int; 627 mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
628 } 628 }
629 } 629 }
630 } 630 }
631 } 631 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodeframe.c ('k') | source/libvpx/vp9/decoder/vp9_decoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698