| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 for (i = 0; i < len; i++) { | 247 for (i = 0; i < len; i++) { |
| 248 if (!p[i].in_use) { | 248 if (!p[i].in_use) { |
| 249 p[i].in_use = 1; | 249 p[i].in_use = 1; |
| 250 return i; | 250 return i; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 return -1; | 253 return -1; |
| 254 } | 254 } |
| 255 | 255 |
| 256 static void free_pred_buffer(PRED_BUFFER *p) { | 256 static void free_pred_buffer(PRED_BUFFER *p) { |
| 257 p->in_use = 0; | 257 if (p != NULL) |
| 258 p->in_use = 0; |
| 258 } | 259 } |
| 259 | 260 |
| 260 static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x, | 261 static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x, |
| 261 BLOCK_SIZE bsize, int mi_row, int mi_col, | 262 BLOCK_SIZE bsize, int mi_row, int mi_col, |
| 262 MV_REFERENCE_FRAME ref_frame, | 263 MV_REFERENCE_FRAME ref_frame, |
| 263 PREDICTION_MODE this_mode, | 264 PREDICTION_MODE this_mode, |
| 264 unsigned int var_y, unsigned int sse_y, | 265 unsigned int var_y, unsigned int sse_y, |
| 265 struct buf_2d yv12_mb[][MAX_MB_PLANE], | 266 struct buf_2d yv12_mb[][MAX_MB_PLANE], |
| 266 int *rate, int64_t *dist) { | 267 int *rate, int64_t *dist) { |
| 267 MACROBLOCKD *xd = &x->e_mbd; | 268 MACROBLOCKD *xd = &x->e_mbd; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 best_rd = this_rd; | 665 best_rd = this_rd; |
| 665 *returnrate = rate; | 666 *returnrate = rate; |
| 666 *returndistortion = dist; | 667 *returndistortion = dist; |
| 667 best_mode = this_mode; | 668 best_mode = this_mode; |
| 668 best_pred_filter = mbmi->interp_filter; | 669 best_pred_filter = mbmi->interp_filter; |
| 669 best_tx_size = mbmi->tx_size; | 670 best_tx_size = mbmi->tx_size; |
| 670 best_ref_frame = ref_frame; | 671 best_ref_frame = ref_frame; |
| 671 skip_txfm = x->skip_txfm[0]; | 672 skip_txfm = x->skip_txfm[0]; |
| 672 | 673 |
| 673 if (cpi->sf.reuse_inter_pred_sby) { | 674 if (cpi->sf.reuse_inter_pred_sby) { |
| 674 if (best_pred != NULL) | 675 free_pred_buffer(best_pred); |
| 675 free_pred_buffer(best_pred); | |
| 676 | 676 |
| 677 best_pred = this_mode_pred; | 677 best_pred = this_mode_pred; |
| 678 } | 678 } |
| 679 } else { | 679 } else { |
| 680 if (cpi->sf.reuse_inter_pred_sby) | 680 if (cpi->sf.reuse_inter_pred_sby) |
| 681 free_pred_buffer(this_mode_pred); | 681 free_pred_buffer(this_mode_pred); |
| 682 } | 682 } |
| 683 | 683 |
| 684 if (x->skip) | 684 if (x->skip) |
| 685 break; | 685 break; |
| 686 } | 686 } |
| 687 // If the current reference frame is valid and we found a usable mode, | 687 // If the current reference frame is valid and we found a usable mode, |
| 688 // we are done. | 688 // we are done. |
| 689 if (best_rd < INT64_MAX) | 689 if (best_rd < INT64_MAX) |
| 690 break; | 690 break; |
| 691 } | 691 } |
| 692 | 692 |
| 693 // If best prediction is not in dst buf, then copy the prediction block from | 693 // If best prediction is not in dst buf, then copy the prediction block from |
| 694 // temp buf to dst buf. | 694 // temp buf to dst buf. |
| 695 if (cpi->sf.reuse_inter_pred_sby && best_pred->data != orig_dst.buf) { | 695 if (best_pred != NULL && cpi->sf.reuse_inter_pred_sby && |
| 696 best_pred->data != orig_dst.buf) { |
| 696 uint8_t *copy_from, *copy_to; | 697 uint8_t *copy_from, *copy_to; |
| 697 | 698 |
| 698 pd->dst = orig_dst; | 699 pd->dst = orig_dst; |
| 699 copy_to = pd->dst.buf; | 700 copy_to = pd->dst.buf; |
| 700 | 701 |
| 701 copy_from = best_pred->data; | 702 copy_from = best_pred->data; |
| 702 | 703 |
| 703 vp9_convolve_copy(copy_from, bw, copy_to, pd->dst.stride, NULL, 0, NULL, 0, | 704 vp9_convolve_copy(copy_from, bw, copy_to, pd->dst.stride, NULL, 0, NULL, 0, |
| 704 bw, bh); | 705 bw, bh); |
| 705 } | 706 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } else { | 755 } else { |
| 755 x->skip_txfm[0] = skip_txfm; | 756 x->skip_txfm[0] = skip_txfm; |
| 756 } | 757 } |
| 757 } | 758 } |
| 758 if (cpi->sf.reuse_inter_pred_sby) | 759 if (cpi->sf.reuse_inter_pred_sby) |
| 759 pd->dst = orig_dst; | 760 pd->dst = orig_dst; |
| 760 } | 761 } |
| 761 | 762 |
| 762 return INT64_MAX; | 763 return INT64_MAX; |
| 763 } | 764 } |
| OLD | NEW |