[FFmpeg-devel] a64 encoder

Vitor Sessak vitor1001
Mon Jan 19 21:08:00 CET 2009


Bitbreaker/METALVOTZE wrote:
>> is your code better then our elbg ? if so replace elbg.c/h by it
>> if its worse you should use elbg.c/h (possibly with adaptions in elbg to
>> handle the small number of colors)
> 
> elbg code is used now, as it is way faster at similar quality. So code 
> size shrank again, and i am happy to present the third iteration :-)

Just a few comments (only at a64multi.c, since I still believe it is 
better to do one encoder at a time)...

> +
> +/**
> + * @file a64multi.c
> + * a64 video encoder - multicolor modes
> + */
> +
> +#include "a64enc.h"
> +#include "a64tables.h"
> +#include "elbg.h"
> +
> +/* own methods */
> +
> +static void bgr_to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest, int maxsteps)
> +{
> +    int blockx,blocky,x,y;
> +    int col;
> +    double luma=0;
> +    int height=avctx->height;
> +    int width=avctx->width;
> +
> +    for(blocky=0;blocky<height && blocky<C64YRES;blocky+=8) {
> +        for(blockx=0;blockx<width && blockx<C64XRES;blockx+=8) {
> +            for(y=0;y<8 && blocky+y<C64YRES; y++) {
> +                for(x=0;x<8 && blockx+x<C64XRES;x+=2) {
> +                    switch(avctx->pix_fmt) {
> +                        case PIX_FMT_BGR24:
> +                            luma=p->data[0][(blockx+x+(blocky+y)*width)*3+2]*0.11+
> +                                 p->data[0][(blockx+x+(blocky+y)*width)*3+1]*0.59+
> +                                 p->data[0][(blockx+x+(blocky+y)*width)*3+0]*0.30;
> +                        break;

It looks like this encoder really need GRAY8 input, so I think it is 
better to let ffmpeg do the conversion.

> +//                        case PIX_FMT_GRAY8:
> +//                            luma=p->data[0][(blockx+x+(blocky+y)*width)];

You are ignoring half of the lines of the input. You should at least 
average them.

-Vitor




More information about the ffmpeg-devel mailing list