summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-16 14:51:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-16 15:04:49 +0200
commited3efbcd0c84669a635d1243282fb3283a4b5c3a (patch)
treeba2008433be19ff53217a24eac0b94b99d89c31a /libavfilter
parentaba61b22f70ff5407cd5ff1f797fff42dee07359 (diff)
downloadffmpeg-ed3efbcd0c84669a635d1243282fb3283a4b5c3a.tar.gz
avfilter/vf_noise: use per component rand_shift
This allows using different shifts per plane Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_noise.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 6250253fba..a7ef35c7fa 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -51,6 +51,8 @@ typedef struct {
int seed;
int8_t *noise;
int8_t *prev_shift[MAX_RES][3];
+ int rand_shift[MAX_RES];
+ int rand_shift_init;
} FilterParams;
typedef struct {
@@ -60,8 +62,6 @@ typedef struct {
int height[4];
FilterParams all;
FilterParams param[4];
- int rand_shift[MAX_RES];
- int rand_shift_init;
void (*line_noise)(uint8_t *dst, const uint8_t *src, const int8_t *noise, int len, int shift);
void (*line_noise_avg)(uint8_t *dst, const uint8_t *src, int len, const int8_t * const *shift);
} NoiseContext;
@@ -344,7 +344,7 @@ static void noise(uint8_t *dst, const uint8_t *src,
int x;
for (x=0; x < width; x+= MAX_RES) {
int w = FFMIN(width - x, MAX_RES);
- int shift = n->rand_shift[ix];
+ int shift = p->rand_shift[ix];
if (flags & NOISE_AVERAGED) {
n->line_noise_avg(dst + x, src + x, w, (const int8_t**)p->prev_shift[ix]);
@@ -399,12 +399,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
for (comp = 0; comp < 4; comp++) {
FilterParams *fp = &n->param[comp];
- if ((!n->rand_shift_init || (fp->flags & NOISE_TEMPORAL)) && fp->strength) {
+ if ((!fp->rand_shift_init || (fp->flags & NOISE_TEMPORAL)) && fp->strength) {
for (i = 0; i < MAX_RES; i++) {
- n->rand_shift[i] = av_lfg_get(&fp->lfg) & (MAX_SHIFT - 1);
+ fp->rand_shift[i] = av_lfg_get(&fp->lfg) & (MAX_SHIFT - 1);
}
- n->rand_shift_init = 1;
+ fp->rand_shift_init = 1;
}
}