summaryrefslogtreecommitdiff
path: root/libavcodec/vp3dsp.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2019-01-13 14:55:53 +1100
committerPeter Ross <pross@xvid.org>2019-01-26 23:48:34 +1100
commit1dfd7aecf26e2f4d3ee1ca893e6365f90c02b899 (patch)
treec642559c372acd443ecac2ccd7a29dd7b7b7008a /libavcodec/vp3dsp.c
parent260f1960e7e2e2bff56957a216130623f8109d8f (diff)
downloadffmpeg-1dfd7aecf26e2f4d3ee1ca893e6365f90c02b899.tar.gz
avcodec/vp3dsp: move vp3 init loop filter function to vp3dsp
This is also used by the VP6 decoder. Signed-off-by: Peter Ross <pross@xvid.org>
Diffstat (limited to 'libavcodec/vp3dsp.c')
-rw-r--r--libavcodec/vp3dsp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index cdf7d6490e..4e08ee0b8f 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -27,6 +27,7 @@
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/avassert.h"
#include "avcodec.h"
#include "rnd_avg.h"
@@ -296,3 +297,34 @@ av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
if (ARCH_MIPS)
ff_vp3dsp_init_mips(c, flags);
}
+
+/*
+ * This function initializes the loop filter boundary limits if the frame's
+ * quality index is different from the previous frame's.
+ *
+ * where sizeof(bounding_values_array) is 256 * sizeof(int)
+ *
+ * The filter_limit_values may not be larger than 127.
+ */
+void ff_vp3dsp_set_bounding_values(int * bounding_values_array, int filter_limit)
+{
+ int *bounding_values = bounding_values_array + 127;
+ int x;
+ int value;
+
+ av_assert0(filter_limit < 128U);
+
+ /* set up the bounding values */
+ memset(bounding_values_array, 0, 256 * sizeof(int));
+ for (x = 0; x < filter_limit; x++) {
+ bounding_values[-x] = -x;
+ bounding_values[x] = x;
+ }
+ for (x = value = filter_limit; x < 128 && value; x++, value--) {
+ bounding_values[ x] = value;
+ bounding_values[-x] = -value;
+ }
+ if (value)
+ bounding_values[128] = value;
+ bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202;
+}