50 #define OFFSET(x) offsetof(ColorLevelsContext, x)
51 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
111 const int step = s->
step;
128 for (i = 0; i < s->
nb_comp; i++) {
141 for (y = 0; y < inlink->
h; y++) {
144 for (x = 0; x < s->
linesize; x += step)
145 imin =
FFMIN(imin, src[x + offset]);
150 srcrow = in->
data[0];
152 for (y = 0; y < inlink->
h; y++) {
155 for (x = 0; x < s->
linesize; x += step)
156 imax =
FFMAX(imax, src[x + offset]);
161 srcrow = in->
data[0];
162 coeff = (omax - omin) / (
double)(imax - imin);
163 for (y = 0; y < inlink->
h; y++) {
167 for (x = 0; x < s->
linesize; x += step)
168 dst[x + offset] = av_clip_uint8((src[x + offset] - imin) * coeff + omin);
175 for (i = 0; i < s->
nb_comp; i++) {
188 for (y = 0; y < inlink->
h; y++) {
189 const uint16_t *
src = (
const uint16_t *)srcrow;
191 for (x = 0; x < s->
linesize; x += step)
192 imin =
FFMIN(imin, src[x + offset]);
197 srcrow = in->
data[0];
199 for (y = 0; y < inlink->
h; y++) {
200 const uint16_t *
src = (
const uint16_t *)srcrow;
202 for (x = 0; x < s->
linesize; x += step)
203 imax =
FFMAX(imax, src[x + offset]);
208 srcrow = in->
data[0];
209 coeff = (omax - omin) / (
double)(imax - imin);
210 for (y = 0; y < inlink->
h; y++) {
211 const uint16_t *
src = (
const uint16_t*)srcrow;
212 uint16_t *dst = (uint16_t *)dstrow;
214 for (x = 0; x < s->
linesize; x += step)
215 dst[x + offset] = av_clip_uint16((src[x + offset] - imin) * coeff + omin);
246 .
name =
"colorlevels",
249 .priv_class = &colorlevels_class,
251 .
inputs = colorlevels_inputs,
252 .
outputs = colorlevels_outputs,