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 |
11 #include "./vpx_config.h" | 11 #include "./vpx_config.h" |
12 | 12 |
13 #include "vpx_mem/vpx_mem.h" | 13 #include "vpx_mem/vpx_mem.h" |
14 #include "vpx_ports/vpx_once.h" | 14 #include "vpx_ports/vpx_once.h" |
15 | 15 |
16 #include "./vp9_rtcd.h" | 16 #include "./vp9_rtcd.h" |
17 | 17 |
18 #include "vp9/common/vp9_reconintra.h" | 18 #include "vp9/common/vp9_reconintra.h" |
19 #include "vp9/common/vp9_onyxc_int.h" | 19 #include "vp9/common/vp9_onyxc_int.h" |
20 | 20 |
21 const TX_TYPE mode2txfm_map[MB_MODE_COUNT] = { | 21 const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = { |
22 DCT_DCT, // DC | 22 DCT_DCT, // DC |
23 ADST_DCT, // V | 23 ADST_DCT, // V |
24 DCT_ADST, // H | 24 DCT_ADST, // H |
25 DCT_DCT, // D45 | 25 DCT_DCT, // D45 |
26 ADST_ADST, // D135 | 26 ADST_ADST, // D135 |
27 ADST_DCT, // D117 | 27 ADST_DCT, // D117 |
28 DCT_ADST, // D153 | 28 DCT_ADST, // D153 |
29 DCT_ADST, // D207 | 29 DCT_ADST, // D207 |
30 ADST_DCT, // D63 | 30 ADST_DCT, // D63 |
31 ADST_ADST, // TM | 31 ADST_ADST, // TM |
32 DCT_DCT, // NEARESTMV | |
33 DCT_DCT, // NEARMV | |
34 DCT_DCT, // ZEROMV | |
35 DCT_DCT // NEWMV | |
36 }; | 32 }; |
37 | 33 |
38 #define intra_pred_sized(type, size) \ | 34 #define intra_pred_sized(type, size) \ |
39 void vp9_##type##_predictor_##size##x##size##_c(uint8_t *dst, \ | 35 void vp9_##type##_predictor_##size##x##size##_c(uint8_t *dst, \ |
40 ptrdiff_t stride, \ | 36 ptrdiff_t stride, \ |
41 const uint8_t *above, \ | 37 const uint8_t *above, \ |
42 const uint8_t *left) { \ | 38 const uint8_t *left) { \ |
43 type##_predictor(dst, stride, size, above, left); \ | 39 type##_predictor(dst, stride, size, above, left); \ |
44 } | 40 } |
45 | 41 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 frame_height = xd->cur_buf->y_height; | 340 frame_height = xd->cur_buf->y_height; |
345 } else { | 341 } else { |
346 frame_width = xd->cur_buf->uv_width; | 342 frame_width = xd->cur_buf->uv_width; |
347 frame_height = xd->cur_buf->uv_height; | 343 frame_height = xd->cur_buf->uv_height; |
348 } | 344 } |
349 | 345 |
350 // Get block position in current frame. | 346 // Get block position in current frame. |
351 x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x; | 347 x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x; |
352 y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y; | 348 y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y; |
353 | 349 |
| 350 vpx_memset(left_col, 129, 64); |
| 351 |
354 // left | 352 // left |
355 if (left_available) { | 353 if (left_available) { |
356 if (xd->mb_to_bottom_edge < 0) { | 354 if (xd->mb_to_bottom_edge < 0) { |
357 /* slower path if the block needs border extension */ | 355 /* slower path if the block needs border extension */ |
358 if (y0 + bs <= frame_height) { | 356 if (y0 + bs <= frame_height) { |
359 for (i = 0; i < bs; ++i) | 357 for (i = 0; i < bs; ++i) |
360 left_col[i] = ref[i * ref_stride - 1]; | 358 left_col[i] = ref[i * ref_stride - 1]; |
361 } else { | 359 } else { |
362 const int extend_bottom = frame_height - y0; | 360 const int extend_bottom = frame_height - y0; |
363 for (i = 0; i < extend_bottom; ++i) | 361 for (i = 0; i < extend_bottom; ++i) |
364 left_col[i] = ref[i * ref_stride - 1]; | 362 left_col[i] = ref[i * ref_stride - 1]; |
365 for (; i < bs; ++i) | 363 for (; i < bs; ++i) |
366 left_col[i] = ref[(extend_bottom - 1) * ref_stride - 1]; | 364 left_col[i] = ref[(extend_bottom - 1) * ref_stride - 1]; |
367 } | 365 } |
368 } else { | 366 } else { |
369 /* faster path if the block does not need extension */ | 367 /* faster path if the block does not need extension */ |
370 for (i = 0; i < bs; ++i) | 368 for (i = 0; i < bs; ++i) |
371 left_col[i] = ref[i * ref_stride - 1]; | 369 left_col[i] = ref[i * ref_stride - 1]; |
372 } | 370 } |
373 } else { | |
374 vpx_memset(left_col, 129, bs); | |
375 } | 371 } |
376 | 372 |
377 // TODO(hkuang) do not extend 2*bs pixels for all modes. | 373 // TODO(hkuang) do not extend 2*bs pixels for all modes. |
378 // above | 374 // above |
379 if (up_available) { | 375 if (up_available) { |
380 const uint8_t *above_ref = ref - ref_stride; | 376 const uint8_t *above_ref = ref - ref_stride; |
381 if (xd->mb_to_right_edge < 0) { | 377 if (xd->mb_to_right_edge < 0) { |
382 /* slower path if the block needs border extension */ | 378 /* slower path if the block needs border extension */ |
383 if (x0 + 2 * bs <= frame_width) { | 379 if (x0 + 2 * bs <= frame_width) { |
384 if (right_available && bs == 4) { | 380 if (right_available && bs == 4) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // predict | 427 // predict |
432 if (mode == DC_PRED) { | 428 if (mode == DC_PRED) { |
433 dc_pred[left_available][up_available][tx_size](dst, dst_stride, | 429 dc_pred[left_available][up_available][tx_size](dst, dst_stride, |
434 const_above_row, left_col); | 430 const_above_row, left_col); |
435 } else { | 431 } else { |
436 pred[mode][tx_size](dst, dst_stride, const_above_row, left_col); | 432 pred[mode][tx_size](dst, dst_stride, const_above_row, left_col); |
437 } | 433 } |
438 } | 434 } |
439 | 435 |
440 void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in, | 436 void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in, |
441 TX_SIZE tx_size, int mode, | 437 TX_SIZE tx_size, MB_PREDICTION_MODE mode, |
442 const uint8_t *ref, int ref_stride, | 438 const uint8_t *ref, int ref_stride, |
443 uint8_t *dst, int dst_stride, | 439 uint8_t *dst, int dst_stride, |
444 int aoff, int loff, int plane) { | 440 int aoff, int loff, int plane) { |
445 const int bwl = bwl_in - tx_size; | 441 const int bwl = bwl_in - tx_size; |
446 const int wmask = (1 << bwl) - 1; | 442 const int wmask = (1 << bwl) - 1; |
447 const int have_top = (block_idx >> bwl) || xd->up_available; | 443 const int have_top = (block_idx >> bwl) || xd->up_available; |
448 const int have_left = (block_idx & wmask) || xd->left_available; | 444 const int have_left = (block_idx & wmask) || xd->left_available; |
449 const int have_right = ((block_idx & wmask) != wmask); | 445 const int have_right = ((block_idx & wmask) != wmask); |
450 const int x = aoff * 4; | 446 const int x = aoff * 4; |
451 const int y = loff * 4; | 447 const int y = loff * 4; |
452 | 448 |
453 assert(bwl >= 0); | 449 assert(bwl >= 0); |
454 build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size, | 450 build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size, |
455 have_top, have_left, have_right, x, y, plane); | 451 have_top, have_left, have_right, x, y, plane); |
456 } | 452 } |
OLD | NEW |