summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-07-10 10:45:51 +0000
committerPaul B Mahol <onemda@gmail.com>2015-07-10 10:50:28 +0000
commitae55fc82a8401c698f7ec5b50973649d9f1ecd6e (patch)
treed738eb5d0b767a011bf8213232d13452fc2ec10f
parent7b404c94f38e8270ed704dd3d89a35f8f16f25b1 (diff)
avfilter/vf_removegrain: clip to uint16 instead to uint8
This is how original filter behaves. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/vf_removegrain.c16
-rw-r--r--tests/ref/fate/filter-removegrain-mode-062
-rw-r--r--tests/ref/fate/filter-removegrain-mode-082
3 files changed, 10 insertions, 10 deletions
diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c
index 318f17a60c..77b35617cc 100644
--- a/libavfilter/vf_removegrain.c
+++ b/libavfilter/vf_removegrain.c
@@ -167,10 +167,10 @@ static int mode06(int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
const int cli3 = av_clip(c, mi3, ma3);
const int cli4 = av_clip(c, mi4, ma4);
- const int c1 = av_clip_uint8((FFABS(c - cli1) << 1) + d1);
- const int c2 = av_clip_uint8((FFABS(c - cli2) << 1) + d2);
- const int c3 = av_clip_uint8((FFABS(c - cli3) << 1) + d3);
- const int c4 = av_clip_uint8((FFABS(c - cli4) << 1) + d4);
+ const int c1 = av_clip_uint16((FFABS(c - cli1) << 1) + d1);
+ const int c2 = av_clip_uint16((FFABS(c - cli2) << 1) + d2);
+ const int c3 = av_clip_uint16((FFABS(c - cli3) << 1) + d3);
+ const int c4 = av_clip_uint16((FFABS(c - cli4) << 1) + d4);
const int mindiff = FFMIN(FFMIN(c1, c2), FFMIN(c3, c4));
@@ -231,10 +231,10 @@ static int mode08(int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
const int cli3 = av_clip(c, mi3, ma3);
const int cli4 = av_clip(c, mi4, ma4);
- const int c1 = av_clip_uint8(FFABS(c - cli1) + (d1 << 1));
- const int c2 = av_clip_uint8(FFABS(c - cli2) + (d2 << 1));
- const int c3 = av_clip_uint8(FFABS(c - cli3) + (d3 << 1));
- const int c4 = av_clip_uint8(FFABS(c - cli4) + (d4 << 1));
+ const int c1 = av_clip_uint16(FFABS(c - cli1) + (d1 << 1));
+ const int c2 = av_clip_uint16(FFABS(c - cli2) + (d2 << 1));
+ const int c3 = av_clip_uint16(FFABS(c - cli3) + (d3 << 1));
+ const int c4 = av_clip_uint16(FFABS(c - cli4) + (d4 << 1));
const int mindiff = FFMIN(FFMIN(c1, c2), FFMIN(c3, c4));
diff --git a/tests/ref/fate/filter-removegrain-mode-06 b/tests/ref/fate/filter-removegrain-mode-06
index da55d0253b..8d3d318b76 100644
--- a/tests/ref/fate/filter-removegrain-mode-06
+++ b/tests/ref/fate/filter-removegrain-mode-06
@@ -1,2 +1,2 @@
#tb 0: 1/25
-0, 0, 0, 1, 152064, 0x19a63f92
+0, 0, 0, 1, 152064, 0x38e84065
diff --git a/tests/ref/fate/filter-removegrain-mode-08 b/tests/ref/fate/filter-removegrain-mode-08
index 5f9a1f44b0..3a05d10359 100644
--- a/tests/ref/fate/filter-removegrain-mode-08
+++ b/tests/ref/fate/filter-removegrain-mode-08
@@ -1,2 +1,2 @@
#tb 0: 1/25
-0, 0, 0, 1, 152064, 0x820d85aa
+0, 0, 0, 1, 152064, 0x8f7c85a2