summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_hue.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-12-20 19:10:46 +0100
committerStefano Sabatini <stefasab@gmail.com>2013-12-20 19:13:42 +0100
commit70e74e007270c43c161dad7495fc3c745d2fb08a (patch)
tree7ea3e455ec7ab20ff440d1800493822a5c85283f /libavfilter/vf_hue.c
parentb07a5e9b6be902b70f536d9dce0dea45f48bc8d4 (diff)
downloadffmpeg-streaming-70e74e007270c43c161dad7495fc3c745d2fb08a.zip
ffmpeg-streaming-70e74e007270c43c161dad7495fc3c745d2fb08a.tar.gz
lavfi/hue: force table initialization for the first frame
Diffstat (limited to 'libavfilter/vf_hue.c')
-rw-r--r--libavfilter/vf_hue.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c
index faa2e8d..e54a13b 100644
--- a/libavfilter/vf_hue.c
+++ b/libavfilter/vf_hue.c
@@ -73,6 +73,7 @@ typedef struct {
AVExpr *brightness_pexpr;
int hsub;
int vsub;
+ int is_first;
int32_t hue_sin;
int32_t hue_cos;
double var_values[VAR_NB];
@@ -207,6 +208,7 @@ static av_cold int init(AVFilterContext *ctx)
"H_expr:%s h_deg_expr:%s s_expr:%s b_expr:%s\n",
hue->hue_expr, hue->hue_deg_expr, hue->saturation_expr, hue->brightness_expr);
compute_sin_and_cos(hue);
+ hue->is_first = 1;
return 0;
}
@@ -356,10 +358,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
hue->var_values[VAR_T], (int)hue->var_values[VAR_N]);
compute_sin_and_cos(hue);
- if (old_hue_sin != hue->hue_sin || old_hue_cos != hue->hue_cos)
+ if (hue->is_first || (old_hue_sin != hue->hue_sin || old_hue_cos != hue->hue_cos))
create_chrominance_lut(hue, hue->hue_cos, hue->hue_sin);
- if (old_brightness != hue->brightness && hue->brightness)
+ if (hue->is_first || (old_brightness != hue->brightness && hue->brightness))
create_luma_lut(hue);
if (!direct) {
@@ -383,6 +385,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
if (!direct)
av_frame_free(&inpic);
+
+ hue->is_first = 0;
return ff_filter_frame(outlink, outpic);
}
OpenPOWER on IntegriCloud