[FFmpeg-devel] a64 encoder 5th round

Diego Biurrun diego
Fri Jan 23 18:52:28 CET 2009


On Fri, Jan 23, 2009 at 10:28:31AM +0100, Bitbreaker/METALVOTZE wrote:
> Cleaned up a few more things in the code, also added issues found by  
> Aurel. Anything else to fix?
>
> --- libavcodec/a64multienc.c	(Revision 0)
> +++ libavcodec/a64multienc.c	(Revision 0)
> @@ -0,0 +1,259 @@
> +/* own methods */
> +static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest)
> +{
> +    int blockx, blocky, x, y;
> +    int luma = 0;
> +    int height = avctx->height;
> +    int width = avctx->width;

align

> +static void render_charset(AVCodecContext *avctx, uint8_t *charset, uint8_t *colrammap)
> +{
> +    A64Context *c = avctx->priv_data;
> +    int charpos;
> +    int x, y;
> +    uint8_t row1;
> +    int dither;
> +    int index1;
> +    int index2;
> +    const uint8_t vals[] = { 3, 2, 1, 0, 3 };
> +    int luma;
> +    int pix;
> +    int lowdiff;
> +    int highdiff;

Maybe you can merge a few of these onto one line..

> +    int dsteps = c->mc_dithersteps;
> +    int maxindex = c->mc_use_5col + 3;
> +    int maxsteps = c->mc_dithersteps * maxindex + 1;
> +    int *best_cb = c->mc_best_cb;

align

> +        lowdiff = 0;
> +        highdiff = 0;

ditto

> +    c->mc_frame_counter = 0;
> +    c->mc_dithersteps = 8;
> +    c->mc_use_5col = avctx->codec->id == CODEC_ID_A64_MULTI5;

align

> +    c->mc_meta_charset = av_malloc(32000 * c->mc_lifetime * sizeof(int));
> +    c->mc_best_cb =      av_malloc(256 * 32 * sizeof(int));
> +    c->mc_charmap =      av_malloc(1000 * c->mc_lifetime * sizeof(int));

align =

> +    avcodec_get_frame_defaults(&c->picture);
> +    avctx->coded_frame = &c->picture;
> +    avctx->coded_frame->pict_type = FF_I_TYPE;
> +    avctx->coded_frame->key_frame = 1;

align

You can find more alignment opportunities below.

> --- libavcodec/a64enc.h	(Revision 0)
> +++ libavcodec/a64enc.h	(Revision 0)
> @@ -0,0 +1,50 @@
> +#endif                          /* AVCODEC_A64ENC_H */

nit: one space is enough


The patch is missing documentation and changelog updates, the build
system part is OK.

Diego




More information about the ffmpeg-devel mailing list