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