From 36d732c22b9785a54ea1dad44832ef517846ea61 Mon Sep 17 00:00:00 2001 From: Johann Date: Wed, 22 Mar 2017 10:15:22 -0700 Subject: [PATCH] vp9 temporal filter: add const to function prototype The input frames are not modified. Change-Id: Ideb810e3c5afeb4dbdc4c7d54024c43a8129ad39 --- test/temporal_filter_test.cc | 9 +++++---- vp9/common/vp9_rtcd_defs.pl | 4 ++-- vp9/encoder/mips/msa/vp9_temporal_filter_msa.c | 18 ++++++++++-------- vp9/encoder/vp9_temporal_filter.c | 11 ++++++----- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/test/temporal_filter_test.cc b/test/temporal_filter_test.cc index a7bc436bc..c92ee72d2 100644 --- a/test/temporal_filter_test.cc +++ b/test/temporal_filter_test.cc @@ -21,10 +21,11 @@ namespace { using ::libvpx_test::ACMRandom; using ::libvpx_test::Buffer; -typedef void (*TemporalFilterFunc)(uint8_t *a, unsigned int stride, uint8_t *b, - unsigned int w, unsigned int h, - int filter_strength, int filter_weight, - unsigned int *accumulator, uint16_t *count); +typedef void (*TemporalFilterFunc)(const uint8_t *a, unsigned int stride, + const uint8_t *b, unsigned int w, + unsigned int h, int filter_strength, + int filter_weight, unsigned int *accumulator, + uint16_t *count); // Calculate the difference between 'a' and 'b', sum in blocks of 9, and apply // filter based on strength and weight. Store the resulting filter amount in diff --git a/vp9/common/vp9_rtcd_defs.pl b/vp9/common/vp9_rtcd_defs.pl index cd5da4f6d..10c779c01 100644 --- a/vp9/common/vp9_rtcd_defs.pl +++ b/vp9/common/vp9_rtcd_defs.pl @@ -197,7 +197,7 @@ $vp9_full_search_sad_sse4_1=vp9_full_search_sadx8; add_proto qw/int vp9_diamond_search_sad/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv"; specialize qw/vp9_diamond_search_sad avx/; -add_proto qw/void vp9_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; +add_proto qw/void vp9_temporal_filter_apply/, "const uint8_t *frame1, unsigned int stride, const uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; specialize qw/vp9_temporal_filter_apply sse2 msa/; if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") { @@ -217,7 +217,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") { add_proto qw/void vp9_highbd_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; - add_proto qw/void vp9_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; + add_proto qw/void vp9_highbd_temporal_filter_apply/, "const uint8_t *frame1, unsigned int stride, const uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; } # End vp9_high encoder functions diff --git a/vp9/encoder/mips/msa/vp9_temporal_filter_msa.c b/vp9/encoder/mips/msa/vp9_temporal_filter_msa.c index 23f7ebace..1ab5f36cc 100644 --- a/vp9/encoder/mips/msa/vp9_temporal_filter_msa.c +++ b/vp9/encoder/mips/msa/vp9_temporal_filter_msa.c @@ -11,10 +11,11 @@ #include "./vp9_rtcd.h" #include "vpx_dsp/mips/macros_msa.h" -static void temporal_filter_apply_8size_msa(uint8_t *frm1_ptr, uint32_t stride, - uint8_t *frm2_ptr, int32_t filt_sth, - int32_t filt_wgt, uint32_t *acc, - uint16_t *cnt) { +static void temporal_filter_apply_8size_msa(const uint8_t *frm1_ptr, + uint32_t stride, + const uint8_t *frm2_ptr, + int32_t filt_sth, int32_t filt_wgt, + uint32_t *acc, uint16_t *cnt) { uint32_t row; uint64_t f0, f1, f2, f3; v16i8 frm2, frm1 = { 0 }; @@ -138,8 +139,9 @@ static void temporal_filter_apply_8size_msa(uint8_t *frm1_ptr, uint32_t stride, } } -static void temporal_filter_apply_16size_msa(uint8_t *frm1_ptr, uint32_t stride, - uint8_t *frm2_ptr, +static void temporal_filter_apply_16size_msa(const uint8_t *frm1_ptr, + uint32_t stride, + const uint8_t *frm2_ptr, int32_t filt_sth, int32_t filt_wgt, uint32_t *acc, uint16_t *cnt) { uint32_t row; @@ -265,8 +267,8 @@ static void temporal_filter_apply_16size_msa(uint8_t *frm1_ptr, uint32_t stride, } } -void vp9_temporal_filter_apply_msa(uint8_t *frame1_ptr, uint32_t stride, - uint8_t *frame2_ptr, uint32_t blk_w, +void vp9_temporal_filter_apply_msa(const uint8_t *frame1_ptr, uint32_t stride, + const uint8_t *frame2_ptr, uint32_t blk_w, uint32_t blk_h, int32_t strength, int32_t filt_wgt, uint32_t *accu, uint16_t *cnt) { diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index e02c34224..34f6121ea 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -89,8 +89,9 @@ void vp9_temporal_filter_init(void) { for (i = 1; i < 512; ++i) fixed_divide[i] = 0x80000 / i; } -void vp9_temporal_filter_apply_c(uint8_t *frame1, unsigned int stride, - uint8_t *frame2, unsigned int block_width, +void vp9_temporal_filter_apply_c(const uint8_t *frame1, unsigned int stride, + const uint8_t *frame2, + unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count) { @@ -152,11 +153,11 @@ void vp9_temporal_filter_apply_c(uint8_t *frame1, unsigned int stride, #if CONFIG_VP9_HIGHBITDEPTH void vp9_highbd_temporal_filter_apply_c( - uint8_t *frame1_8, unsigned int stride, uint8_t *frame2_8, + const uint8_t *frame1_8, unsigned int stride, const uint8_t *frame2_8, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count) { - uint16_t *frame1 = CONVERT_TO_SHORTPTR(frame1_8); - uint16_t *frame2 = CONVERT_TO_SHORTPTR(frame2_8); + const uint16_t *frame1 = CONVERT_TO_SHORTPTR(frame1_8); + const uint16_t *frame2 = CONVERT_TO_SHORTPTR(frame2_8); unsigned int i, j, k; int modifier; int byte = 0; -- 2.40.0