diff options
-rw-r--r-- | vp9/common/vp9_blockd.h | 9 | ||||
-rw-r--r-- | vp9/common/vp9_convolve.h | 5 | ||||
-rw-r--r-- | vp9/common/vp9_filter.c | 35 | ||||
-rw-r--r-- | vp9/common/vp9_filter.h | 27 | ||||
-rw-r--r-- | vp9/common/vp9_idct.c | 90 | ||||
-rw-r--r-- | vp9/common/vp9_idct.h | 19 | ||||
-rw-r--r-- | vp9/common/vp9_reconinter.c | 27 | ||||
-rw-r--r-- | vp9/common/vp9_rtcd_defs.sh | 16 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodframe.c | 14 | ||||
-rw-r--r-- | vp9/decoder/vp9_idct_blk.c | 101 | ||||
-rw-r--r-- | vp9/decoder/vp9_idct_blk.h | 29 | ||||
-rw-r--r-- | vp9/encoder/vp9_dct.c | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 13 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeintra.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 61 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemv.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_mbgraph.c | 15 | ||||
-rw-r--r-- | vp9/encoder/vp9_onyx_if.c | 45 | ||||
-rw-r--r-- | vp9/encoder/vp9_psnr.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 45 | ||||
-rw-r--r-- | vp9/encoder/vp9_tokenize.c | 7 | ||||
-rw-r--r-- | vp9/vp9dx.mk | 2 |
23 files changed, 244 insertions, 334 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 5c82d0d49..f116c0647 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -20,6 +20,7 @@ #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_common_data.h" #include "vp9/common/vp9_enums.h" +#include "vp9/common/vp9_filter.h" #include "vp9/common/vp9_mv.h" #include "vp9/common/vp9_scale.h" #include "vp9/common/vp9_seg_common.h" @@ -56,14 +57,6 @@ typedef enum { } FRAME_TYPE; typedef enum { - EIGHTTAP = 0, - EIGHTTAP_SMOOTH = 1, - EIGHTTAP_SHARP = 2, - BILINEAR = 3, - SWITCHABLE = 4 /* should be the last one */ -} INTERPOLATIONFILTERTYPE; - -typedef enum { DC_PRED, // Average of above and left pixels V_PRED, // Vertical H_PRED, // Horizontal diff --git a/vp9/common/vp9_convolve.h b/vp9/common/vp9_convolve.h index 3d4cf6914..9a5caa662 100644 --- a/vp9/common/vp9_convolve.h +++ b/vp9/common/vp9_convolve.h @@ -21,9 +21,4 @@ typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride, const int16_t *filter_y, int y_step_q4, int w, int h); -struct subpix_fn_table { - const int16_t (*filter_x)[8]; - const int16_t (*filter_y)[8]; -}; - #endif // VP9_COMMON_VP9_CONVOLVE_H_ diff --git a/vp9/common/vp9_filter.c b/vp9/common/vp9_filter.c index 4ac2bc93f..cedd44cad 100644 --- a/vp9/common/vp9_filter.c +++ b/vp9/common/vp9_filter.c @@ -8,12 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <assert.h> + #include "vpx_ports/mem.h" #include "vp9/common/vp9_filter.h" -DECLARE_ALIGNED(256, const int16_t, - vp9_bilinear_filters[SUBPEL_SHIFTS][SUBPEL_TAPS]) = { +DECLARE_ALIGNED(256, const subpel_kernel, + vp9_bilinear_filters[SUBPEL_SHIFTS]) = { { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 }, { 0, 0, 0, 112, 16, 0, 0, 0 }, @@ -33,8 +35,8 @@ DECLARE_ALIGNED(256, const int16_t, }; // Lagrangian interpolation filter -DECLARE_ALIGNED(256, const int16_t, - vp9_sub_pel_filters_8[SUBPEL_SHIFTS][SUBPEL_TAPS]) = { +DECLARE_ALIGNED(256, const subpel_kernel, + vp9_sub_pel_filters_8[SUBPEL_SHIFTS]) = { { 0, 0, 0, 128, 0, 0, 0, 0}, { 0, 1, -5, 126, 8, -3, 1, 0}, { -1, 3, -10, 122, 18, -6, 2, 0}, @@ -54,8 +56,8 @@ DECLARE_ALIGNED(256, const int16_t, }; // DCT based filter -DECLARE_ALIGNED(256, const int16_t, - vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][SUBPEL_TAPS]) = { +DECLARE_ALIGNED(256, const subpel_kernel, + vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]) = { {0, 0, 0, 128, 0, 0, 0, 0}, {-1, 3, -7, 127, 8, -3, 1, 0}, {-2, 5, -13, 125, 17, -6, 3, -1}, @@ -75,8 +77,8 @@ DECLARE_ALIGNED(256, const int16_t, }; // freqmultiplier = 0.5 -DECLARE_ALIGNED(256, const int16_t, - vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][SUBPEL_TAPS]) = { +DECLARE_ALIGNED(256, const subpel_kernel, + vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]) = { { 0, 0, 0, 128, 0, 0, 0, 0}, {-3, -1, 32, 64, 38, 1, -3, 0}, {-2, -2, 29, 63, 41, 2, -3, 0}, @@ -94,3 +96,20 @@ DECLARE_ALIGNED(256, const int16_t, { 0, -3, 2, 41, 63, 29, -2, -2}, { 0, -3, 1, 38, 64, 32, -1, -3} }; + +const subpel_kernel *vp9_get_filter_kernel(INTERPOLATIONFILTERTYPE type) { + switch (type) { + case EIGHTTAP: + return vp9_sub_pel_filters_8; + case EIGHTTAP_SMOOTH: + return vp9_sub_pel_filters_8lp; + case EIGHTTAP_SHARP: + return vp9_sub_pel_filters_8s; + case BILINEAR: + return vp9_bilinear_filters; + default: + assert(!"Invalid filter type."); + return NULL; + } +} + diff --git a/vp9/common/vp9_filter.h b/vp9/common/vp9_filter.h index 58260ce99..676b274b9 100644 --- a/vp9/common/vp9_filter.h +++ b/vp9/common/vp9_filter.h @@ -19,11 +19,28 @@ #define SUBPEL_SHIFTS (1 << SUBPEL_BITS) #define SUBPEL_TAPS 8 -extern const int16_t vp9_bilinear_filters[SUBPEL_SHIFTS][SUBPEL_TAPS]; -extern const int16_t vp9_sub_pel_filters_6[SUBPEL_SHIFTS][SUBPEL_TAPS]; -extern const int16_t vp9_sub_pel_filters_8[SUBPEL_SHIFTS][SUBPEL_TAPS]; -extern const int16_t vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][SUBPEL_TAPS]; -extern const int16_t vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][SUBPEL_TAPS]; +typedef enum { + EIGHTTAP = 0, + EIGHTTAP_SMOOTH = 1, + EIGHTTAP_SHARP = 2, + BILINEAR = 3, + SWITCHABLE = 4 /* should be the last one */ +} INTERPOLATIONFILTERTYPE; + +typedef const int16_t subpel_kernel[SUBPEL_TAPS]; + +struct subpix_fn_table { + const subpel_kernel *filter_x; + const subpel_kernel *filter_y; +}; + +const subpel_kernel *vp9_get_filter_kernel(INTERPOLATIONFILTERTYPE type); + +extern const subpel_kernel vp9_bilinear_filters[SUBPEL_SHIFTS]; +extern const subpel_kernel vp9_sub_pel_filters_6[SUBPEL_SHIFTS]; +extern const subpel_kernel vp9_sub_pel_filters_8[SUBPEL_SHIFTS]; +extern const subpel_kernel vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]; +extern const subpel_kernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]; // The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear // filter kernel as a 2 tap filter. diff --git a/vp9/common/vp9_idct.c b/vp9/common/vp9_idct.c index 10b83f58b..99d84c9ca 100644 --- a/vp9/common/vp9_idct.c +++ b/vp9/common/vp9_idct.c @@ -1284,3 +1284,93 @@ void vp9_short_idct32x32_1_add_c(int16_t *input, uint8_t *dest, dest += dest_stride; } } + +// idct +void vp9_idct_add(int16_t *input, uint8_t *dest, int stride, int eob) { + if (eob > 1) + vp9_short_idct4x4_add(input, dest, stride); + else + vp9_short_idct4x4_1_add(input, dest, stride); +} + + +void vp9_idct_add_lossless(int16_t *input, uint8_t *dest, int stride, + int eob) { + if (eob > 1) + vp9_short_iwalsh4x4_add(input, dest, stride); + else + vp9_short_iwalsh4x4_1_add_c(input, dest, stride); +} + +void vp9_idct_add_8x8(int16_t *input, uint8_t *dest, int stride, int eob) { + // If dc is 1, then input[0] is the reconstructed value, do not need + // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. + + // The calculation can be simplified if there are not many non-zero dct + // coefficients. Use eobs to decide what to do. + // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. + // Combine that with code here. + if (eob) { + if (eob == 1) + // DC only DCT coefficient + vp9_short_idct8x8_1_add(input, dest, stride); + else if (eob <= 10) + vp9_short_idct8x8_10_add(input, dest, stride); + else + vp9_short_idct8x8_add(input, dest, stride); + } +} + +void vp9_idct_add_16x16(int16_t *input, uint8_t *dest, int stride, int eob) { + /* The calculation can be simplified if there are not many non-zero dct + * coefficients. Use eobs to separate different cases. */ + if (eob) { + if (eob == 1) + /* DC only DCT coefficient. */ + vp9_short_idct16x16_1_add(input, dest, stride); + else if (eob <= 10) + vp9_short_idct16x16_10_add(input, dest, stride); + else + vp9_short_idct16x16_add(input, dest, stride); + } +} + +void vp9_idct_add_32x32(int16_t *input, uint8_t *dest, int stride, int eob) { + if (eob) { + if (eob == 1) + vp9_short_idct32x32_1_add(input, dest, stride); + else + vp9_short_idct32x32_add(input, dest, stride); + } +} + +// iht +void vp9_iht_add(TX_TYPE tx_type, int16_t *input, uint8_t *dest, int stride, + int eob) { + if (tx_type == DCT_DCT) + vp9_idct_add(input, dest, stride, eob); + else + vp9_short_iht4x4_add(input, dest, stride, tx_type); +} + +void vp9_iht_add_8x8(TX_TYPE tx_type, int16_t *input, uint8_t *dest, + int stride, int eob) { + if (tx_type == DCT_DCT) { + vp9_idct_add_8x8(input, dest, stride, eob); + } else { + if (eob > 0) { + vp9_short_iht8x8_add(input, dest, stride, tx_type); + } + } +} + +void vp9_iht_add_16x16(TX_TYPE tx_type, int16_t *input, uint8_t *dest, + int stride, int eob) { + if (tx_type == DCT_DCT) { + vp9_idct_add_16x16(input, dest, stride, eob); + } else { + if (eob > 0) { + vp9_short_iht16x16_add(input, dest, stride, tx_type); + } + } +} diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h index 59892cd03..0ef905cc8 100644 --- a/vp9/common/vp9_idct.h +++ b/vp9/common/vp9_idct.h @@ -16,6 +16,7 @@ #include "./vpx_config.h" #include "vpx/vpx_integer.h" #include "vp9/common/vp9_common.h" +#include "vp9/common/vp9_enums.h" // Constants and Macros used by all idct/dct functions @@ -86,4 +87,22 @@ typedef struct { transform_1d cols, rows; // vertical and horizontal } transform_2d; + +void vp9_idct_add(int16_t *input, uint8_t *dest, int stride, int eob); +void vp9_idct_add_lossless(int16_t *input, uint8_t *dest, + int stride, int eob); +void vp9_idct_add_8x8(int16_t *input, uint8_t *dest, int stride, int eob); +void vp9_idct_add_16x16(int16_t *input, uint8_t *dest, int stride, int eob); +void vp9_idct_add_32x32(int16_t *input, uint8_t *dest, int stride, int eob); + +void vp9_iht_add(TX_TYPE tx_type, int16_t *input, uint8_t *dest, + int stride, int eob); + +void vp9_iht_add_8x8(TX_TYPE tx_type, int16_t *input, uint8_t *dest, + int stride, int eob); + +void vp9_iht_add_16x16(TX_TYPE tx_type, int16_t *input, uint8_t *dest, + int stride, int eob); + + #endif // VP9_COMMON_VP9_IDCT_H_ diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index 18407dd73..b3b9e1d8a 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -20,34 +20,23 @@ #include "vp9/common/vp9_reconinter.h" #include "vp9/common/vp9_reconintra.h" - void vp9_setup_interp_filters(MACROBLOCKD *xd, INTERPOLATIONFILTERTYPE mcomp_filter_type, VP9_COMMON *cm) { if (xd->mi_8x8 && xd->this_mi) { - MB_MODE_INFO * mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; - set_scale_factors(xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1, - cm->active_ref_scale); + set_scale_factors(xd, mbmi->ref_frame[0] - LAST_FRAME, + mbmi->ref_frame[1] - LAST_FRAME, + cm->active_ref_scale); } else { set_scale_factors(xd, -1, -1, cm->active_ref_scale); } - switch (mcomp_filter_type) { - case EIGHTTAP: - case SWITCHABLE: - xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8; - break; - case EIGHTTAP_SMOOTH: - xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8lp; - break; - case EIGHTTAP_SHARP: - xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8s; - break; - case BILINEAR: - xd->subpix.filter_x = xd->subpix.filter_y = vp9_bilinear_filters; - break; - } + xd->subpix.filter_x = xd->subpix.filter_y = + vp9_get_filter_kernel(mcomp_filter_type == SWITCHABLE ? + EIGHTTAP : mcomp_filter_type); + assert(((intptr_t)xd->subpix.filter_x & 0xff) == 0); } diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh index e5439ec8c..61be7c6b7 100644 --- a/vp9/common/vp9_rtcd_defs.sh +++ b/vp9/common/vp9_rtcd_defs.sh @@ -28,22 +28,6 @@ forward_decls vp9_common_forward_decls [ $arch = "x86_64" ] && mmx_x86_64=mmx && sse2_x86_64=sse2 && ssse3_x86_64=ssse3 # -# Dequant -# - -prototype void vp9_idct_add_16x16 "int16_t *input, uint8_t *dest, int stride, int eob" -specialize vp9_idct_add_16x16 - -prototype void vp9_idct_add_8x8 "int16_t *input, uint8_t *dest, int stride, int eob" -specialize vp9_idct_add_8x8 - -prototype void vp9_idct_add "int16_t *input, uint8_t *dest, int stride, int eob" -specialize vp9_idct_add - -prototype void vp9_idct_add_32x32 "int16_t *q, uint8_t *dst, int stride, int eob" -specialize vp9_idct_add_32x32 - -# # RECON # prototype void vp9_d207_predictor_4x4 "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left" diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 9ba49cd84..8b23c731e 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -19,6 +19,7 @@ #include "vp9/common/vp9_entropy.h" #include "vp9/common/vp9_entropymode.h" #include "vp9/common/vp9_extend.h" +#include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_pred_common.h" #include "vp9/common/vp9_quant_common.h" #include "vp9/common/vp9_reconintra.h" @@ -31,7 +32,6 @@ #include "vp9/decoder/vp9_detokenize.h" #include "vp9/decoder/vp9_decodemv.h" #include "vp9/decoder/vp9_dsubexp.h" -#include "vp9/decoder/vp9_idct_blk.h" #include "vp9/decoder/vp9_onyxd_int.h" #include "vp9/decoder/vp9_read_bit_buffer.h" #include "vp9/decoder/vp9_thread.h" @@ -101,15 +101,15 @@ static void decode_block(int plane, int block, BLOCK_SIZE plane_bsize, if (tx_type == DCT_DCT) xd->itxm_add(qcoeff, dst, stride, eob); else - vp9_iht_add_c(tx_type, qcoeff, dst, stride, eob); + vp9_iht_add(tx_type, qcoeff, dst, stride, eob); break; case TX_8X8: tx_type = get_tx_type_8x8(pd->plane_type, xd); - vp9_iht_add_8x8_c(tx_type, qcoeff, dst, stride, eob); + vp9_iht_add_8x8(tx_type, qcoeff, dst, stride, eob); break; case TX_16X16: tx_type = get_tx_type_16x16(pd->plane_type, xd); - vp9_iht_add_16x16_c(tx_type, qcoeff, dst, stride, eob); + vp9_iht_add_16x16(tx_type, qcoeff, dst, stride, eob); break; case TX_32X32: tx_type = DCT_DCT; @@ -224,7 +224,6 @@ static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) { static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col, vp9_reader *r, BLOCK_SIZE bsize) { - VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; const int less8x8 = bsize < BLOCK_8X8; MB_MODE_INFO *mbmi; @@ -261,7 +260,8 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col, if (has_second_ref(mbmi)) set_ref(pbi, 1, mi_row, mi_col); - vp9_setup_interp_filters(xd, mbmi->interp_filter, cm); + xd->subpix.filter_x = xd->subpix.filter_y = + vp9_get_filter_kernel(mbmi->interp_filter); vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize); if (decode_blocks) @@ -490,7 +490,7 @@ static void setup_quantization(VP9D_COMP *pbi, struct vp9_read_bit_buffer *rb) { cm->uv_dc_delta_q == 0 && cm->uv_ac_delta_q == 0; - xd->itxm_add = xd->lossless ? vp9_idct_add_lossless_c + xd->itxm_add = xd->lossless ? vp9_idct_add_lossless : vp9_idct_add; } diff --git a/vp9/decoder/vp9_idct_blk.c b/vp9/decoder/vp9_idct_blk.c deleted file mode 100644 index a0af000b0..000000000 --- a/vp9/decoder/vp9_idct_blk.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "./vp9_rtcd.h" -#include "vp9/common/vp9_blockd.h" -#include "vp9/decoder/vp9_idct_blk.h" - -void vp9_iht_add_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, int stride, - int eob) { - if (tx_type == DCT_DCT) - vp9_idct_add(input, dest, stride, eob); - else - vp9_short_iht4x4_add(input, dest, stride, tx_type); -} - -void vp9_iht_add_8x8_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, - int stride, int eob) { - if (tx_type == DCT_DCT) { - vp9_idct_add_8x8(input, dest, stride, eob); - } else { - if (eob > 0) { - vp9_short_iht8x8_add(input, dest, stride, tx_type); - } - } -} - -void vp9_idct_add_c(int16_t *input, uint8_t *dest, int stride, int eob) { - if (eob > 1) - vp9_short_idct4x4_add(input, dest, stride); - else - vp9_short_idct4x4_1_add(input, dest, stride); -} - -void vp9_idct_add_lossless_c(int16_t *input, uint8_t *dest, int stride, - int eob) { - if (eob > 1) - vp9_short_iwalsh4x4_add(input, dest, stride); - else - vp9_short_iwalsh4x4_1_add_c(input, dest, stride); -} - -void vp9_idct_add_8x8_c(int16_t *input, uint8_t *dest, int stride, int eob) { - // If dc is 1, then input[0] is the reconstructed value, do not need - // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. - - // The calculation can be simplified if there are not many non-zero dct - // coefficients. Use eobs to decide what to do. - // TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. - // Combine that with code here. - if (eob) { - if (eob == 1) - // DC only DCT coefficient - vp9_short_idct8x8_1_add(input, dest, stride); - else if (eob <= 10) - vp9_short_idct8x8_10_add(input, dest, stride); - else - vp9_short_idct8x8_add(input, dest, stride); - } -} - -void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, - int stride, int eob) { - if (tx_type == DCT_DCT) { - vp9_idct_add_16x16(input, dest, stride, eob); - } else { - if (eob > 0) { - vp9_short_iht16x16_add(input, dest, stride, tx_type); - } - } -} - -void vp9_idct_add_16x16_c(int16_t *input, uint8_t *dest, int stride, int eob) { - /* The calculation can be simplified if there are not many non-zero dct - * coefficients. Use eobs to separate different cases. */ - if (eob) { - if (eob == 1) - /* DC only DCT coefficient. */ - vp9_short_idct16x16_1_add(input, dest, stride); - else if (eob <= 10) - vp9_short_idct16x16_10_add(input, dest, stride); - else - vp9_short_idct16x16_add(input, dest, stride); - } -} - -void vp9_idct_add_32x32_c(int16_t *input, uint8_t *dest, int stride, int eob) { - if (eob) { - if (eob == 1) - vp9_short_idct32x32_1_add(input, dest, stride); - else - vp9_short_idct32x32_add(input, dest, stride); - } -} - diff --git a/vp9/decoder/vp9_idct_blk.h b/vp9/decoder/vp9_idct_blk.h deleted file mode 100644 index 00f1bc6a6..000000000 --- a/vp9/decoder/vp9_idct_blk.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef VP9_DECODER_VP9_IDCT_BLK_H_ -#define VP9_DECODER_VP9_IDCT_BLK_H_ - -#include "vp9/common/vp9_blockd.h" - -void vp9_idct_add_lossless_c(int16_t *input, uint8_t *dest, - int stride, int eob); - -void vp9_iht_add_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, - int stride, int eob); - -void vp9_iht_add_8x8_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, - int stride, int eob); - -void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest, - int stride, int eob); - -#endif // VP9_DECODER_VP9_IDCT_BLK_H_ diff --git a/vp9/encoder/vp9_dct.c b/vp9/encoder/vp9_dct.c index b9c300033..27e4cd07f 100644 --- a/vp9/encoder/vp9_dct.c +++ b/vp9/encoder/vp9_dct.c @@ -593,11 +593,11 @@ void vp9_short_fht8x8_c(int16_t *input, int16_t *output, /* 4-point reversible, orthonormal Walsh-Hadamard in 3.5 adds, 0.5 shifts per pixel. */ -void vp9_short_walsh4x4_c(short *input, short *output, int pitch) { +void vp9_short_walsh4x4_c(int16_t *input, int16_t *output, int pitch) { int i; int a1, b1, c1, d1, e1; - short *ip = input; - short *op = output; + int16_t *ip = input; + int16_t *op = output; int pitch_short = pitch >> 1; for (i = 0; i < 4; i++) { @@ -647,7 +647,7 @@ void vp9_short_walsh4x4_c(short *input, short *output, int pitch) { } } -void vp9_short_walsh8x4_c(short *input, short *output, int pitch) { +void vp9_short_walsh8x4_c(int16_t *input, int16_t *output, int pitch) { vp9_short_walsh4x4_c(input, output, pitch); vp9_short_walsh4x4_c(input + 4, output + 16, pitch); } diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4fde38d3f..1fbdb720c 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -173,8 +173,9 @@ static void calc_av_activity(VP9_COMP *cpi, int64_t activity_sum) { tmp = sortlist[j - 1]; sortlist[j - 1] = sortlist[j]; sortlist[j] = tmp; - } else - break; + } else { + break; + } } } @@ -246,13 +247,11 @@ static void calc_activity_index(VP9_COMP *cpi, MACROBLOCK *x) { #if OUTPUT_NORM_ACT_STATS fprintf(f, "\n"); #endif - } #if OUTPUT_NORM_ACT_STATS fclose(f); #endif - } #endif // USE_ACT_INDEX @@ -317,7 +316,6 @@ static void build_activity_map(VP9_COMP *cpi) { // Calculate an activity index number of each mb calc_activity_index(cpi, x); #endif - } // Macroblock activity masking @@ -684,7 +682,7 @@ static PICK_MODE_CONTEXT *get_block_context(MACROBLOCK *x, BLOCK_SIZE bsize) { return &x->ab4x4_context[xd->sb_index][xd->mb_index][xd->b_index]; default: assert(0); - return NULL ; + return NULL; } } @@ -701,7 +699,7 @@ static BLOCK_SIZE *get_sb_partitioning(MACROBLOCK *x, BLOCK_SIZE bsize) { return &x->b_partitioning[xd->sb_index][xd->mb_index][xd->b_index]; default: assert(0); - return NULL ; + return NULL; } } @@ -2012,7 +2010,6 @@ static void encode_frame_internal(VP9_COMP *cpi) { // Keep record of the total distortion this time around for future use cpi->last_frame_distortion = cpi->frame_distortion; #endif - } static int check_dual_ref_flags(VP9_COMP *cpi) { diff --git a/vp9/encoder/vp9_encodeintra.c b/vp9/encoder/vp9_encodeintra.c index c5e5dff08..32b4593fc 100644 --- a/vp9/encoder/vp9_encodeintra.c +++ b/vp9/encoder/vp9_encodeintra.c @@ -9,7 +9,7 @@ */ #include "./vpx_config.h" -#include "vp9_rtcd.h" +#include "./vp9_rtcd.h" #include "vp9/encoder/vp9_quantize.h" #include "vp9/common/vp9_reconintra.h" #include "vp9/encoder/vp9_encodemb.h" diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 76a5d33e7..a610d6340 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -8,16 +8,21 @@ * be found in the AUTHORS file in the root of the source tree. */ + +#include "./vp9_rtcd.h" #include "./vpx_config.h" -#include "vp9/encoder/vp9_encodemb.h" + +#include "vpx_mem/vpx_mem.h" + +#include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_reconinter.h" -#include "vp9/encoder/vp9_quantize.h" -#include "vp9/encoder/vp9_tokenize.h" #include "vp9/common/vp9_reconintra.h" -#include "vpx_mem/vpx_mem.h" -#include "vp9/encoder/vp9_rdopt.h" #include "vp9/common/vp9_systemdependent.h" -#include "vp9_rtcd.h" + +#include "vp9/encoder/vp9_encodemb.h" +#include "vp9/encoder/vp9_quantize.h" +#include "vp9/encoder/vp9_rdopt.h" +#include "vp9/encoder/vp9_tokenize.h" DECLARE_ALIGNED(16, extern const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]); @@ -47,28 +52,6 @@ static void inverse_transform_b_4x4_add(MACROBLOCKD *xd, int eob, xd->inv_txm4x4_add(dqcoeff, dest, stride); } -static void inverse_transform_b_8x8_add(int eob, - int16_t *dqcoeff, uint8_t *dest, - int stride) { - if (eob <= 1) - vp9_short_idct8x8_1_add(dqcoeff, dest, stride); - else if (eob <= 10) - vp9_short_idct8x8_10_add(dqcoeff, dest, stride); - else - vp9_short_idct8x8_add(dqcoeff, dest, stride); -} - -static void inverse_transform_b_16x16_add(int eob, - int16_t *dqcoeff, uint8_t *dest, - int stride) { - if (eob <= 1) - vp9_short_idct16x16_1_add(dqcoeff, dest, stride); - else if (eob <= 10) - vp9_short_idct16x16_10_add(dqcoeff, dest, stride); - else - vp9_short_idct16x16_add(dqcoeff, dest, stride); -} - static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { struct macroblock_plane *const p = &x->plane[plane]; const MACROBLOCKD *const xd = &x->e_mbd; @@ -476,12 +459,10 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride); break; case TX_16X16: - inverse_transform_b_16x16_add(pd->eobs[block], dqcoeff, dst, - pd->dst.stride); + vp9_idct_add_16x16(dqcoeff, dst, pd->dst.stride, pd->eobs[block]); break; case TX_8X8: - inverse_transform_b_8x8_add(pd->eobs[block], dqcoeff, dst, - pd->dst.stride); + vp9_idct_add_8x8(dqcoeff, dst, pd->dst.stride, pd->eobs[block]); break; case TX_4X4: // this is like vp9_short_idct4x4 but has a special case around eob<=1 @@ -597,12 +578,8 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); - if (!x->skip_encode && *eob) { - if (tx_type == DCT_DCT) - inverse_transform_b_16x16_add(*eob, dqcoeff, dst, pd->dst.stride); - else - vp9_short_iht16x16_add(dqcoeff, dst, pd->dst.stride, tx_type); - } + if (!x->skip_encode && *eob) + vp9_iht_add_16x16(tx_type, dqcoeff, dst, pd->dst.stride, *eob); break; case TX_8X8: tx_type = get_tx_type_8x8(pd->plane_type, xd); @@ -626,12 +603,8 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); - if (!x->skip_encode && *eob) { - if (tx_type == DCT_DCT) - inverse_transform_b_8x8_add(*eob, dqcoeff, dst, pd->dst.stride); - else - vp9_short_iht8x8_add(dqcoeff, dst, pd->dst.stride, tx_type); - } + if (!x->skip_encode && *eob) + vp9_iht_add_8x8(tx_type, dqcoeff, dst, pd->dst.stride, *eob); break; case TX_4X4: tx_type = get_tx_type_4x4(pd->plane_type, xd, block); diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index db08ee856..04a4172a5 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -8,13 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <math.h> #include "vp9/common/vp9_common.h" -#include "vp9/encoder/vp9_encodemv.h" #include "vp9/common/vp9_entropymode.h" #include "vp9/common/vp9_systemdependent.h" +#include "vp9/encoder/vp9_encodemv.h" -#include <math.h> #ifdef ENTROPY_STATS extern unsigned int active_section; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index eaa3bd183..471931349 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -569,7 +569,7 @@ void vp9_first_pass(VP9_COMP *cpi) { mb_row << 1, 1 << mi_height_log2(xd->this_mi->mbmi.sb_type), mb_col << 1, - 1 << mi_height_log2(xd->this_mi->mbmi.sb_type)); + 1 << mi_width_log2(xd->this_mi->mbmi.sb_type)); // do intra 16x16 prediction this_error = vp9_encode_intra(x, use_dc_pred); diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 0a6576eb5..f83fcc531 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -103,7 +103,8 @@ static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv, dst_mv->as_int = tmp_mv.as_int; } - // If the current best reference mv is not centred on 0,0 then do a 0,0 based search as well + // If the current best reference mv is not centered on 0,0 then do a 0,0 + // based search as well. if (ref_mv->as_int) { unsigned int tmp_err; int_mv zero_ref_mv, tmp_mv; @@ -217,7 +218,8 @@ static void update_mbgraph_mb_stats stats->ref[GOLDEN_FRAME].m.mv.as_int = 0; } - // Alt-ref frame MV search, if it exists and is different than last/golden frame + // Do an Alt-ref frame MV search, if it exists and is different than + // last/golden frame. if (alt_ref) { int a_motion_error; xd->plane[0].pre[0].buf = alt_ref->y_buffer + mb_y_offset; @@ -246,7 +248,8 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, int_mv arf_top_mv, gld_top_mv; MODE_INFO mi_local = { { 0 } }; - // Set up limit values for motion vectors to prevent them extending outside the UMV borders + // Set up limit values for motion vectors to prevent them extending outside + // the UMV borders. arf_top_mv.as_int = 0; gld_top_mv.as_int = 0; x->mv_row_min = -BORDER_MV_PIXELS_B16; @@ -266,7 +269,8 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, int arf_y_in_offset = arf_y_offset; int gld_y_in_offset = gld_y_offset; - // Set up limit values for motion vectors to prevent them extending outside the UMV borders + // Set up limit values for motion vectors to prevent them extending outside + // the UMV borders. arf_left_mv.as_int = arf_top_mv.as_int; gld_left_mv.as_int = gld_top_mv.as_int; x->mv_col_min = -BORDER_MV_PIXELS_B16; @@ -407,7 +411,8 @@ void vp9_update_mbgraph_stats(VP9_COMP *cpi) { for (i = 0; i < n_frames; i++) { MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i]; vpx_memset(frame_stats->mb_stats, 0, - cm->mb_rows * cm->mb_cols * sizeof(*cpi->mbgraph_stats[i].mb_stats)); + cm->mb_rows * cm->mb_cols * + sizeof(*cpi->mbgraph_stats[i].mb_stats)); } // do motion search to find contribution of each reference to data diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 753afbc78..e7384bab5 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -868,42 +868,43 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->mode_skip_start = 6; } if (speed == 4) { - sf->less_rectangular_check = 1; sf->use_square_partition_only = 1; - sf->comp_inter_joint_search_thresh = BLOCK_SIZES; - sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; - sf->adjust_partitioning_from_last_frame = 1; - sf->last_partitioning_redo_frequency = 3; - sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME || - cpi->common.intra_only || - cpi->common.show_frame == 0) ? - USE_FULL_RD : - USE_LARGESTALL); + sf->tx_size_search_method = USE_LARGESTALL; + sf->disable_split_mask = DISABLE_ALL_SPLIT; + sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | FLAG_SKIP_INTRA_BESTINTER | FLAG_SKIP_COMP_BESTINTRA | FLAG_SKIP_COMP_REFMISMATCH | FLAG_SKIP_INTRA_LOWVAR | FLAG_EARLY_TERMINATE; - sf->intra_y_mode_mask = INTRA_DC_ONLY; - sf->intra_uv_mode_mask = INTRA_DC_ONLY; - sf->use_uv_intra_rd_estimate = 1; + sf->use_rd_breakout = 1; - sf->skip_encode_sb = 1; - sf->use_lp32x32fdct = 1; sf->adaptive_motion_search = 1; - sf->using_small_partition_info = 0; - sf->disable_split_mask = DISABLE_ALL_SPLIT; sf->auto_mv_step_size = 1; - sf->search_method = BIGDIA; - sf->subpel_iters_per_step = 1; - sf->use_fast_lpf_pick = 1; + + sf->disable_filter_search_var_thresh = 16; + sf->comp_inter_joint_search_thresh = BLOCK_SIZES; + sf->auto_min_max_partition_size = 1; - sf->disable_split_var_thresh = 64; - sf->disable_filter_search_var_thresh = 64; + sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; + sf->adjust_partitioning_from_last_frame = 1; + sf->last_partitioning_redo_frequency = 3; + + sf->use_uv_intra_rd_estimate = 1; + sf->skip_encode_sb = 1; + sf->use_lp32x32fdct = 1; + sf->subpel_iters_per_step = 1; sf->use_fast_coef_updates = 2; + sf->adaptive_rd_thresh = 4; sf->mode_skip_start = 6; + + /* sf->intra_y_mode_mask = INTRA_DC_ONLY; + sf->intra_uv_mode_mask = INTRA_DC_ONLY; + sf->search_method = BIGDIA; + sf->disable_split_var_thresh = 64; + sf->disable_filter_search_var_thresh = 64; */ } if (speed == 5) { sf->comp_inter_joint_search_thresh = BLOCK_SIZES; diff --git a/vp9/encoder/vp9_psnr.c b/vp9/encoder/vp9_psnr.c index 94394341d..58294e15a 100644 --- a/vp9/encoder/vp9_psnr.c +++ b/vp9/encoder/vp9_psnr.c @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <math.h> #include "vpx_scale/yv12config.h" -#include "math.h" #define MAX_PSNR 100 diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index e6783558e..26bbc825e 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3910,33 +3910,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, ref_frame = vp9_ref_order[mode_index].ref_frame; second_ref_frame = vp9_ref_order[mode_index].second_ref_frame; - // FIXME(jingning): this was temporarily disabled for sub8x8 blocks. - // Look at the reference frame of the best mode so far and set the - // skip mask to look at a subset of the remaining modes. - if (0 && mode_index > cpi->sf.mode_skip_start) { - if (mode_index == (cpi->sf.mode_skip_start + 1)) { - switch (vp9_ref_order[best_mode_index].ref_frame) { - case INTRA_FRAME: - cpi->mode_skip_mask = 0; - break; - case LAST_FRAME: - cpi->mode_skip_mask = LAST_FRAME_MODE_MASK; - break; - case GOLDEN_FRAME: - cpi->mode_skip_mask = GOLDEN_FRAME_MODE_MASK; - break; - case ALTREF_FRAME: - cpi->mode_skip_mask = ALT_REF_MODE_MASK; - break; - case NONE: - case MAX_REF_FRAMES: - assert(!"Invalid Reference frame"); - } - } - if (cpi->mode_skip_mask & ((int64_t)1 << mode_index)) - continue; - } - // Skip if the current reference frame has been masked off if (cpi->sf.reference_masking && !cpi->set_ref_frame_mask && (cpi->ref_frame_mask & (1 << ref_frame))) @@ -4073,7 +4046,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, for (i = 0; i < TX_MODES; ++i) tx_cache[i] = tx_cache[ONLY_4X4]; } else { - const int is_comp_pred = second_ref_frame > 0; int rate; int64_t distortion; int64_t this_rd_thresh; @@ -4082,23 +4054,14 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int64_t tmp_best_distortion = INT_MAX, tmp_best_sse, uv_sse; int tmp_best_skippable = 0; int switchable_filter_index; - int_mv *second_ref = is_comp_pred ? - &mbmi->ref_mvs[second_ref_frame][0] : NULL; + int_mv *second_ref = comp_pred ? + &mbmi->ref_mvs[second_ref_frame][0] : NULL; b_mode_info tmp_best_bmodes[16]; MB_MODE_INFO tmp_best_mbmode; PARTITION_INFO tmp_best_partition; BEST_SEG_INFO bsi[SWITCHABLE_FILTERS]; int pred_exists = 0; int uv_skippable; - if (is_comp_pred) { - if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) - if (vp9_ref_order[best_mode_index].ref_frame == INTRA_FRAME) - continue; - if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_REFMISMATCH) - if (ref_frame != best_inter_ref_frame && - second_ref_frame != best_inter_ref_frame) - continue; - } this_rd_thresh = (ref_frame == LAST_FRAME) ? cpi->rd_thresh_sub8x8[bsize][THR_LAST] : @@ -4223,12 +4186,12 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, rate2 += get_switchable_rate(x); if (!mode_excluded) { - if (is_comp_pred) + if (comp_pred) mode_excluded = cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY; else mode_excluded = cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY; } - compmode_cost = vp9_cost_bit(comp_mode_p, is_comp_pred); + compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred); tmp_best_rdu = best_rd - MIN(RDCOST(x->rdmult, x->rddiv, rate2, distortion2), diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 7c14c18aa..4e095f243 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -38,7 +38,6 @@ static int dct_value_cost[DCT_MAX_VALUE * 2]; const int *vp9_dct_value_cost_ptr; static void fill_value_tokens() { - TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE; const vp9_extra_bit *const e = vp9_extra_bits; @@ -60,9 +59,9 @@ static void fill_value_tokens() { t[i].token = --j; eb |= (a - e[j].base_val) << 1; - } else + } else { t[i].token = a; - + } t[i].extra = eb; } @@ -81,9 +80,7 @@ static void fill_value_tokens() { cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */ dct_value_cost[i + DCT_MAX_VALUE] = cost; } - } - } while (++i < DCT_MAX_VALUE); vp9_dct_value_tokens_ptr = dct_value_tokens + DCT_MAX_VALUE; diff --git a/vp9/vp9dx.mk b/vp9/vp9dx.mk index 54c9706a5..3a27cdd04 100644 --- a/vp9/vp9dx.mk +++ b/vp9/vp9dx.mk @@ -32,8 +32,6 @@ VP9_DX_SRCS-yes += decoder/vp9_thread.c VP9_DX_SRCS-yes += decoder/vp9_thread.h VP9_DX_SRCS-yes += decoder/vp9_treereader.h VP9_DX_SRCS-yes += decoder/vp9_onyxd_if.c -VP9_DX_SRCS-yes += decoder/vp9_idct_blk.c -VP9_DX_SRCS-yes += decoder/vp9_idct_blk.h VP9_DX_SRCS-yes += decoder/vp9_dsubexp.c VP9_DX_SRCS-yes += decoder/vp9_dsubexp.h |