From: chiyotsai Date: Fri, 1 Feb 2019 05:39:19 +0000 (-0800) Subject: Some cosmetic fixes to temporal filter X-Git-Tag: v1.8.1~264 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cab8adc9e6274a62c796f9434459f316f622652;p=libvpx Some cosmetic fixes to temporal filter BUG=webm:1591 Change-Id: I34fd7e6cbe6f3d5486a669d0895402fd21de7641 --- diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index d02603615..0b636b85c 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -225,24 +225,24 @@ static INLINE int get_filter_weight(unsigned int i, unsigned int j, unsigned int block_height, unsigned int block_width, const int *const blk_fw, int use_32x32) { - int filter_weight = 0; - - if (use_32x32) - // blk_fw[0] ~ blk_fw[3] are the same. + // blk_fw[0] ~ blk_fw[3] are the same. + if (use_32x32) { return blk_fw[0]; + } if (i < block_height / 2) { - if (j < block_width / 2) - filter_weight = blk_fw[0]; - else - filter_weight = blk_fw[1]; - } else { - if (j < block_width / 2) - filter_weight = blk_fw[2]; - else - filter_weight = blk_fw[3]; + if (j < block_width / 2) { + return blk_fw[0]; + } + + return blk_fw[1]; + } + + if (j < block_width / 2) { + return blk_fw[2]; } - return filter_weight; + + return blk_fw[3]; } void vp9_apply_temporal_filter_c( @@ -296,7 +296,7 @@ void vp9_apply_temporal_filter_c( for (i = 0, k = 0, m = 0; i < block_height; i++) { for (j = 0; j < block_width; j++) { const int pixel_value = y_pred[i * y_buf_stride + j]; - int filter_weight = + const int filter_weight = get_filter_weight(i, j, block_height, block_width, blk_fw, use_32x32); // non-local mean approach diff --git a/vp9/encoder/x86/temporal_filter_sse4.c b/vp9/encoder/x86/temporal_filter_sse4.c index 9f9483a9b..76c0d5a29 100644 --- a/vp9/encoder/x86/temporal_filter_sse4.c +++ b/vp9/encoder/x86/temporal_filter_sse4.c @@ -254,7 +254,7 @@ static INLINE void read_chroma_dist_row_16(int ss_x, const uint16_t *u_dist, __m128i *v_first, __m128i *v_second) { if (!ss_x) { - // If there is no chroma subsampling in the horizaontal direction, then we + // If there is no chroma subsampling in the horizontal direction, then we // need to load 16 entries from chroma. read_dist_16(u_dist, u_first, u_second); read_dist_16(v_dist, v_first, v_second); @@ -274,8 +274,8 @@ static INLINE void read_chroma_dist_row_16(int ss_x, const uint16_t *u_dist, } } -// Horizonta add unsigned 16-bit ints in src and store them as signed 32-bit int -// in dst. +// Horizontal add unsigned 16-bit ints in src and store them as signed 32-bit +// int in dst. static INLINE void hadd_epu16(__m128i *src, __m128i *dst) { const __m128i zero = _mm_setzero_si128(); const __m128i shift_right = _mm_srli_si128(*src, 2); @@ -323,7 +323,7 @@ static INLINE void add_luma_dist_to_8_chroma_mod(const uint16_t *y_dist, // Apply temporal filter to the luma components. This performs temporal // filtering on a luma block of 16 X block_height. Use blk_fw as an array of -// size 4for the weights for each of the 4 subblocks if blk_fw is not NULL, +// size 4 for the weights for each of the 4 subblocks if blk_fw is not NULL, // else use top_weight for top half, and bottom weight for bottom half. static void vp9_apply_temporal_filter_luma_16( const uint8_t *y_src, int y_src_stride, const uint8_t *y_pre,