vp9 temporal filter: add const to function prototype
authorJohann <johannkoenig@google.com>
Wed, 22 Mar 2017 17:15:22 +0000 (10:15 -0700)
committerJohann Koenig <johannkoenig@google.com>
Wed, 22 Mar 2017 18:14:21 +0000 (18:14 +0000)
The input frames are not modified.

Change-Id: Ideb810e3c5afeb4dbdc4c7d54024c43a8129ad39

test/temporal_filter_test.cc
vp9/common/vp9_rtcd_defs.pl
vp9/encoder/mips/msa/vp9_temporal_filter_msa.c
vp9/encoder/vp9_temporal_filter.c

index a7bc436..c92ee72 100644 (file)
@@ -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
index cd5da4f..10c779c 100644 (file)
@@ -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
index 23f7eba..1ab5f36 100644 (file)
 #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) {
index e02c342..34f6121 100644 (file)
@@ -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;