[FFmpeg-devel] [PATCH] lavfi: add histeq filter (WIP)

Jérémy TRAN tran.jeremy.av at gmail.com
Tue Oct 16 11:11:54 CEST 2012


2012/10/15 Stefano Sabatini <stefasab at gmail.com>:
>> I reworked stefano's previous port (that used YUV colorspace) to use RGB
>> colorspace like the original filter but the output is not correct yet.
>
> In which sense is "not correct"? That may help to spot the issue.

The colors are messed up.

>> + at var{intensity} must be an integer and sets the maximum intensity that can
>> +generated and scales the output values appropriately. The strength should be
>> +set as desired and then the intensity can be limited if needed to avoid
>> +washing-out.
>> +It defaults to 210.
>
> This doesn't tell the range of the value. I wonder if we should rather
> adopt a more generic scale (float value in the range 0-1).

Since we don’t have the same constraint than a MP filter
(compatibility), it may be fine.

>> +/**
>> + * @file
>> + * Histogram equalization filter, based on the VirtualDub filter by
>> + * Donald A. Graft  <neuron2 AT home DOT com>.
>> + * Implements global automatic contrast adjustment by means of
>> + * histogram equalization.
>> + */
>
> Note, did you try to contact the author about the licensing? IIRC I
> tried during the port, and I failed to get a reply.

No I didn’t, I’ll see if I can get to him.

>> +    histeq->ia          = 4096;
>> +    histeq->ic          = 150889;
>> +    histeq->im          = 714025;
>
> magic?

I’ll admit that I don’t really know where these values come from.
I’ll investigate on that.

>> +    switch (inlink->format) {
>> +        case PIX_FMT_ARGB:
>> +            histeq->rgba_map[R] = 2;
>> +            histeq->rgba_map[G] = 1;
>> +            histeq->rgba_map[B] = 0;
>> +            histeq->rgba_map[A] = 3;
>> +            break;
>> +        case PIX_FMT_RGBA:
>> +            histeq->rgba_map[R] = 3;
>> +            histeq->rgba_map[G] = 2;
>> +            histeq->rgba_map[B] = 1;
>> +            histeq->rgba_map[A] = 0;
>> +            break;
>> +        case PIX_FMT_ABGR:
>> +            histeq->rgba_map[R] = 0;
>> +            histeq->rgba_map[G] = 1;
>> +            histeq->rgba_map[B] = 2;
>> +            histeq->rgba_map[A] = 3;
>> +            break;
>> +        case PIX_FMT_BGRA:
>> +            histeq->rgba_map[R] = 1;
>> +            histeq->rgba_map[G] = 2;
>> +            histeq->rgba_map[B] = 3;
>> +            histeq->rgba_map[A] = 0;
>> +            break;
>> +        default:
>> +            break;
>> +    }
>> +
>> +    return 0;
>> +}
>
> libavfilter/drawutils.h:ff_fill_rgba_map

That’s great !

As always, thanks for the review.

-- 
Jérémy Tran
ACU 2013
EPITA GISTRE 2013


More information about the ffmpeg-devel mailing list