Unified · Split
| @@ -42,6 +42,7 @@ typedef struct ColorCorrectContext { · 41 unmodified lines | ||
| 42 | 42 | int analyze; |
| 43 | 43 | |
| 44 | 44 | int depth; |
| 45 | + float max, imax; | |
| 45 | 46 | |
| 46 | 47 | int chroma_w, chroma_h; |
| 47 | 48 | int planeheight[4]; |
| @@ -59,9 +60,7 @@ static int average_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 11 unmodified lines | ||
| 59 | 60 | { |
| 60 | 61 | ColorCorrectContext *s = ctx->priv; |
| 61 | 62 | AVFrame *frame = arg; |
| 62 | − const int depth = s->depth; | |
| 63 | − const float max = (1 << depth) - 1; | |
| 64 | − const float imax = 1.f / max; | |
| 63 | + const float imax = s->imax; | |
| 65 | 64 | const int width = s->planewidth[1]; |
| 66 | 65 | const int height = s->planeheight[1]; |
| 67 | 66 | const int slice_start = (height * jobnr) / nb_jobs; |
| @@ -92,9 +91,7 @@ static int average_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 24 unmodified lines | ||
| 92 | 91 | { |
| 93 | 92 | ColorCorrectContext *s = ctx->priv; |
| 94 | 93 | AVFrame *frame = arg; |
| 95 | − const int depth = s->depth; | |
| 96 | − const float max = (1 << depth) - 1; | |
| 97 | − const float imax = 1.f / max; | |
| 94 | + const float imax = s->imax; | |
| 98 | 95 | const int width = s->planewidth[1]; |
| 99 | 96 | const int height = s->planeheight[1]; |
| 100 | 97 | const int slice_start = (height * jobnr) / nb_jobs; |
| @@ -134,9 +131,8 @@ static int colorcorrect_slice8(AVFilterContext *ctx, void *arg, int jobnr, int n · 33 unmodified lines | ||
| 134 | 131 | { |
| 135 | 132 | ColorCorrectContext *s = ctx->priv; |
| 136 | 133 | AVFrame *frame = arg; |
| 137 | − const int depth = s->depth; | |
| 138 | − const float max = (1 << depth) - 1; | |
| 139 | − const float imax = 1.f / max; | |
| 134 | + const float max = s->max; | |
| 135 | + const float imax = s->imax; | |
| 140 | 136 | const int chroma_w = s->chroma_w; |
| 141 | 137 | const int chroma_h = s->chroma_h; |
| 142 | 138 | const int width = s->planewidth[1]; |
| @@ -176,8 +172,8 @@ static int colorcorrect_slice16(AVFilterContext *ctx, void *arg, int jobnr, int · 33 unmodified lines | ||
| 176 | 172 | ColorCorrectContext *s = ctx->priv; |
| 177 | 173 | AVFrame *frame = arg; |
| 178 | 174 | const int depth = s->depth; |
| 179 | − const float max = (1 << depth) - 1; | |
| 180 | − const float imax = 1.f / max; | |
| 175 | + const float max = s->max; | |
| 176 | + const float imax = s->imax; | |
| 181 | 177 | const int chroma_w = s->chroma_w; |
| 182 | 178 | const int chroma_h = s->chroma_h; |
| 183 | 179 | const int width = s->planewidth[1]; |
| @@ -268,6 +264,8 @@ static av_cold int config_input(AVFilterLink *inlink) · 84 unmodified lines | ||
| 268 | 264 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
| 269 | 265 | |
| 270 | 266 | s->depth = desc->comp[0].depth; |
| 267 | + s->max = (1 << s->depth) - 1; | |
| 268 | + s->imax = 1.f / s->max; | |
| 271 | 269 | s->do_slice = s->depth <= 8 ? colorcorrect_slice8 : colorcorrect_slice16; |
| 272 | 270 | |
| 273 | 271 | s->analyzeret = av_calloc(inlink->h, sizeof(*s->analyzeret)); |