[FFmpeg-devel] [FFmpeg-cvslog] avcodec/cfhd: add bayer support

Paul B Mahol onemda at gmail.com
Mon Jul 29 19:07:49 EEST 2019


On Mon, Jul 29, 2019 at 6:05 PM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:

> Am Mo., 29. Juli 2019 um 16:35 Uhr schrieb Paul B Mahol <git at videolan.org
> >:
>
> > +static inline void process_bayer(AVFrame *frame)
> > +{
> > +    const int linesize = frame->linesize[0];
> > +    uint16_t *r = (uint16_t *)frame->data[0];
> > +    uint16_t *g1 = (uint16_t *)(frame->data[0] + 2);
> > +    uint16_t *g2 = (uint16_t *)(frame->data[0] + frame->linesize[0]);
> > +    uint16_t *b = (uint16_t *)(frame->data[0] + frame->linesize[0] + 2);
> > +    const int mid = 2048;
> > +
> > +    for (int y = 0; y < frame->height >> 1; y++) {
> > +        for (int x = 0; x < frame->width; x += 2) {
> > +            int R, G1, G2, B;
> > +            int g, rg, bg, gd;
> > +
> > +            g  = r[x];
> > +            rg = g1[x];
> > +            bg = g2[x];
> > +            gd = b[x];
> > +            gd -= mid;
> > +
> > +            R  = (rg - mid) * 2 + g;
> > +            G1 = g + gd;
> > +            G2 = g - gd;
> > +            B  = (bg - mid) * 2 + g;
> > +
> > +            R  = av_clip_uintp2(R  * 16, 16);
> > +            G1 = av_clip_uintp2(G1 * 16, 16);
> > +            G2 = av_clip_uintp2(G2 * 16, 16);
> > +            B  = av_clip_uintp2(B  * 16, 16);
> > +
> > +            r[x]  = R;
> > +            g1[x] = G1;
> > +            g2[x] = G2;
> > +            b[x]  = B;
>
> Doesn't this mean you have to disable direct rendering?
>

Nope. Do you even know what is DR for?


More information about the ffmpeg-devel mailing list