| 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 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 const int bw = 4 << b_width_log2_lookup[bsize]; | 1798 const int bw = 4 << b_width_log2_lookup[bsize]; |
| 1799 const int bh = 4 << b_height_log2_lookup[bsize]; | 1799 const int bh = 4 << b_height_log2_lookup[bsize]; |
| 1800 const int search_width = bw << 1; | 1800 const int search_width = bw << 1; |
| 1801 const int search_height = bh << 1; | 1801 const int search_height = bh << 1; |
| 1802 const int src_stride = x->plane[0].src.stride; | 1802 const int src_stride = x->plane[0].src.stride; |
| 1803 const int ref_stride = xd->plane[0].pre[0].stride; | 1803 const int ref_stride = xd->plane[0].pre[0].stride; |
| 1804 uint8_t const *ref_buf, *src_buf; | 1804 uint8_t const *ref_buf, *src_buf; |
| 1805 MV *tmp_mv = &xd->mi[0].src_mi->mbmi.mv[0].as_mv; | 1805 MV *tmp_mv = &xd->mi[0].src_mi->mbmi.mv[0].as_mv; |
| 1806 unsigned int best_sad, tmp_sad, this_sad[4]; | 1806 unsigned int best_sad, tmp_sad, this_sad[4]; |
| 1807 MV this_mv; | 1807 MV this_mv; |
| 1808 const int norm_factor = 3 + (bw >> 5); |
| 1808 | 1809 |
| 1809 #if CONFIG_VP9_HIGHBITDEPTH | 1810 #if CONFIG_VP9_HIGHBITDEPTH |
| 1810 tmp_mv->row = 0; | 1811 tmp_mv->row = 0; |
| 1811 tmp_mv->col = 0; | 1812 tmp_mv->col = 0; |
| 1812 return cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, src_stride, | 1813 return cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, src_stride, |
| 1813 xd->plane[0].pre[0].buf, ref_stride); | 1814 xd->plane[0].pre[0].buf, ref_stride); |
| 1814 #endif | 1815 #endif |
| 1815 | 1816 |
| 1816 // Set up prediction 1-D reference set | 1817 // Set up prediction 1-D reference set |
| 1817 ref_buf = xd->plane[0].pre[0].buf - (bw >> 1); | 1818 ref_buf = xd->plane[0].pre[0].buf - (bw >> 1); |
| 1818 for (idx = 0; idx < search_width; idx += 16) { | 1819 for (idx = 0; idx < search_width; idx += 16) { |
| 1819 vp9_int_pro_row(&hbuf[idx], ref_buf, ref_stride, bh); | 1820 vp9_int_pro_row(&hbuf[idx], ref_buf, ref_stride, bh); |
| 1820 ref_buf += 16; | 1821 ref_buf += 16; |
| 1821 } | 1822 } |
| 1822 | 1823 |
| 1823 ref_buf = xd->plane[0].pre[0].buf - (bh >> 1) * ref_stride; | 1824 ref_buf = xd->plane[0].pre[0].buf - (bh >> 1) * ref_stride; |
| 1824 for (idx = 0; idx < search_height; ++idx) { | 1825 for (idx = 0; idx < search_height; ++idx) { |
| 1825 vbuf[idx] = vp9_int_pro_col(ref_buf, bw); | 1826 vbuf[idx] = vp9_int_pro_col(ref_buf, bw) >> norm_factor; |
| 1826 ref_buf += ref_stride; | 1827 ref_buf += ref_stride; |
| 1827 } | 1828 } |
| 1828 | 1829 |
| 1829 // Set up src 1-D reference set | 1830 // Set up src 1-D reference set |
| 1830 for (idx = 0; idx < bw; idx += 16) { | 1831 for (idx = 0; idx < bw; idx += 16) { |
| 1831 src_buf = x->plane[0].src.buf + idx; | 1832 src_buf = x->plane[0].src.buf + idx; |
| 1832 vp9_int_pro_row(&src_hbuf[idx], src_buf, src_stride, bh); | 1833 vp9_int_pro_row(&src_hbuf[idx], src_buf, src_stride, bh); |
| 1833 } | 1834 } |
| 1834 | 1835 |
| 1835 src_buf = x->plane[0].src.buf; | 1836 src_buf = x->plane[0].src.buf; |
| 1836 for (idx = 0; idx < bh; ++idx) { | 1837 for (idx = 0; idx < bh; ++idx) { |
| 1837 src_vbuf[idx] = vp9_int_pro_col(src_buf, bw); | 1838 src_vbuf[idx] = vp9_int_pro_col(src_buf, bw) >> norm_factor; |
| 1838 src_buf += src_stride; | 1839 src_buf += src_stride; |
| 1839 } | 1840 } |
| 1840 | 1841 |
| 1841 // Find the best match per 1-D search | 1842 // Find the best match per 1-D search |
| 1842 tmp_mv->col = vector_match(hbuf, src_hbuf, b_width_log2_lookup[bsize]); | 1843 tmp_mv->col = vector_match(hbuf, src_hbuf, b_width_log2_lookup[bsize]); |
| 1843 tmp_mv->row = vector_match(vbuf, src_vbuf, b_height_log2_lookup[bsize]); | 1844 tmp_mv->row = vector_match(vbuf, src_vbuf, b_height_log2_lookup[bsize]); |
| 1844 | 1845 |
| 1845 this_mv = *tmp_mv; | 1846 this_mv = *tmp_mv; |
| 1846 src_buf = x->plane[0].src.buf; | 1847 src_buf = x->plane[0].src.buf; |
| 1847 ref_buf = xd->plane[0].pre[0].buf + this_mv.row * ref_stride + this_mv.col; | 1848 ref_buf = xd->plane[0].pre[0].buf + this_mv.row * ref_stride + this_mv.col; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 break; | 2318 break; |
| 2318 default: | 2319 default: |
| 2319 assert(0 && "Invalid search method."); | 2320 assert(0 && "Invalid search method."); |
| 2320 } | 2321 } |
| 2321 | 2322 |
| 2322 if (method != NSTEP && rd && var < var_max) | 2323 if (method != NSTEP && rd && var < var_max) |
| 2323 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); | 2324 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); |
| 2324 | 2325 |
| 2325 return var; | 2326 return var; |
| 2326 } | 2327 } |
| OLD | NEW |