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

Side by Side Diff: source/libvpx/vp9/encoder/vp9_bitstream.c

Issue 592203002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_block.h » ('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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 static void write_segment_id(vp9_writer *w, const struct segmentation *seg, 183 static void write_segment_id(vp9_writer *w, const struct segmentation *seg,
184 int segment_id) { 184 int segment_id) {
185 if (seg->enabled && seg->update_map) 185 if (seg->enabled && seg->update_map)
186 vp9_write_tree(w, vp9_segment_tree, seg->tree_probs, segment_id, 3, 0); 186 vp9_write_tree(w, vp9_segment_tree, seg->tree_probs, segment_id, 3, 0);
187 } 187 }
188 188
189 // This function encodes the reference frame 189 // This function encodes the reference frame
190 static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd, 190 static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
191 vp9_writer *w) { 191 vp9_writer *w) {
192 const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; 192 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
193 const int is_compound = has_second_ref(mbmi); 193 const int is_compound = has_second_ref(mbmi);
194 const int segment_id = mbmi->segment_id; 194 const int segment_id = mbmi->segment_id;
195 195
196 // If segment level coding of this signal is disabled... 196 // If segment level coding of this signal is disabled...
197 // or the segment allows multiple reference frame options 197 // or the segment allows multiple reference frame options
198 if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) { 198 if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
199 assert(!is_compound); 199 assert(!is_compound);
200 assert(mbmi->ref_frame[0] == 200 assert(mbmi->ref_frame[0] ==
201 vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME)); 201 vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME));
202 } else { 202 } else {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 for (ref = 0; ref < 1 + is_compound; ++ref) 322 for (ref = 0; ref < 1 + is_compound; ++ref)
323 vp9_encode_mv(cpi, w, &mbmi->mv[ref].as_mv, 323 vp9_encode_mv(cpi, w, &mbmi->mv[ref].as_mv,
324 &mbmi->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, nmvc, 324 &mbmi->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, nmvc,
325 allow_hp); 325 allow_hp);
326 } 326 }
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd, 331 static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd,
332 MODE_INFO **mi_8x8, vp9_writer *w) { 332 MODE_INFO *mi_8x8, vp9_writer *w) {
333 const struct segmentation *const seg = &cm->seg; 333 const struct segmentation *const seg = &cm->seg;
334 const MODE_INFO *const mi = mi_8x8[0]; 334 const MODE_INFO *const mi = mi_8x8;
335 const MODE_INFO *const above_mi = mi_8x8[-xd->mi_stride]; 335 const MODE_INFO *const above_mi = mi_8x8[-xd->mi_stride].src_mi;
336 const MODE_INFO *const left_mi = xd->left_available ? mi_8x8[-1] : NULL; 336 const MODE_INFO *const left_mi =
337 xd->left_available ? mi_8x8[-1].src_mi : NULL;
337 const MB_MODE_INFO *const mbmi = &mi->mbmi; 338 const MB_MODE_INFO *const mbmi = &mi->mbmi;
338 const BLOCK_SIZE bsize = mbmi->sb_type; 339 const BLOCK_SIZE bsize = mbmi->sb_type;
339 340
340 if (seg->update_map) 341 if (seg->update_map)
341 write_segment_id(w, seg, mbmi->segment_id); 342 write_segment_id(w, seg, mbmi->segment_id);
342 343
343 write_skip(cm, xd, mbmi->segment_id, mi, w); 344 write_skip(cm, xd, mbmi->segment_id, mi, w);
344 345
345 if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT) 346 if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
346 write_selected_tx_size(cm, xd, mbmi->tx_size, bsize, w); 347 write_selected_tx_size(cm, xd, mbmi->tx_size, bsize, w);
(...skipping 18 matching lines...) Expand all
365 } 366 }
366 367
367 static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile, 368 static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
368 vp9_writer *w, TOKENEXTRA **tok, 369 vp9_writer *w, TOKENEXTRA **tok,
369 const TOKENEXTRA *const tok_end, 370 const TOKENEXTRA *const tok_end,
370 int mi_row, int mi_col) { 371 int mi_row, int mi_col) {
371 const VP9_COMMON *const cm = &cpi->common; 372 const VP9_COMMON *const cm = &cpi->common;
372 MACROBLOCKD *const xd = &cpi->mb.e_mbd; 373 MACROBLOCKD *const xd = &cpi->mb.e_mbd;
373 MODE_INFO *m; 374 MODE_INFO *m;
374 375
375 xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col); 376 xd->mi = cm->mi + (mi_row * cm->mi_stride + mi_col);
376 m = xd->mi[0]; 377 m = xd->mi;
377 378
378 set_mi_row_col(xd, tile, 379 set_mi_row_col(xd, tile,
379 mi_row, num_8x8_blocks_high_lookup[m->mbmi.sb_type], 380 mi_row, num_8x8_blocks_high_lookup[m->mbmi.sb_type],
380 mi_col, num_8x8_blocks_wide_lookup[m->mbmi.sb_type], 381 mi_col, num_8x8_blocks_wide_lookup[m->mbmi.sb_type],
381 cm->mi_rows, cm->mi_cols); 382 cm->mi_rows, cm->mi_cols);
382 if (frame_is_intra_only(cm)) { 383 if (frame_is_intra_only(cm)) {
383 write_mb_modes_kf(cm, xd, xd->mi, w); 384 write_mb_modes_kf(cm, xd, xd->mi, w);
384 } else { 385 } else {
385 pack_inter_mode_mvs(cpi, m, w); 386 pack_inter_mode_mvs(cpi, m, w);
386 } 387 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 421
421 const int bsl = b_width_log2(bsize); 422 const int bsl = b_width_log2(bsize);
422 const int bs = (1 << bsl) / 4; 423 const int bs = (1 << bsl) / 4;
423 PARTITION_TYPE partition; 424 PARTITION_TYPE partition;
424 BLOCK_SIZE subsize; 425 BLOCK_SIZE subsize;
425 const MODE_INFO *m = NULL; 426 const MODE_INFO *m = NULL;
426 427
427 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) 428 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
428 return; 429 return;
429 430
430 m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]; 431 m = cm->mi[mi_row * cm->mi_stride + mi_col].src_mi;
431 432
432 partition = partition_lookup[bsl][m->mbmi.sb_type]; 433 partition = partition_lookup[bsl][m->mbmi.sb_type];
433 write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w); 434 write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
434 subsize = get_subsize(bsize, partition); 435 subsize = get_subsize(bsize, partition);
435 if (subsize < BLOCK_8X8) { 436 if (subsize < BLOCK_8X8) {
436 write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); 437 write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
437 } else { 438 } else {
438 switch (partition) { 439 switch (partition) {
439 case PARTITION_NONE: 440 case PARTITION_NONE:
440 write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); 441 write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1236
1236 first_part_size = write_compressed_header(cpi, data); 1237 first_part_size = write_compressed_header(cpi, data);
1237 data += first_part_size; 1238 data += first_part_size;
1238 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. 1239 // TODO(jbb): Figure out what to do if first_part_size > 16 bits.
1239 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16); 1240 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16);
1240 1241
1241 data += encode_tiles(cpi, data); 1242 data += encode_tiles(cpi, data);
1242 1243
1243 *size = data - dest; 1244 *size = data - dest;
1244 } 1245 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_block.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698