[FFmpeg-devel] [PATCH] MS Video 1 encoder, take 2

Michael Niedermayer michaelni
Wed Mar 11 20:37:00 CET 2009


On Wed, Mar 11, 2009 at 08:11:39AM +0200, Kostya wrote:
> $subj
> 
> It is quality-based encoder since this codec is not fit for bitrate-based encoding,
> so it should be run as ffmpeg -i infile -vcodec msvideo1 -qscale 3 output.avi

[...]
> Index: libavcodec/msvideo1enc.c
> ===================================================================
> --- libavcodec/msvideo1enc.c	(revision 0)
> +++ libavcodec/msvideo1enc.c	(revision 0)
[...]
> +#include "avcodec.h"
> +#include "bytestream.h"
> +#include "libavutil/lfg.h"
> +#include "elbg.h"
> +

> +/**
> + * Encoder context
> + */
> +typedef struct Msvideo1EncContext {
> +    AVCodecContext *avctx;
> +    AVFrame pic;
> +    AVLFG rnd;
> +    uint8_t *prev;
> +
> +    int block[16*3];
> +    int block2[16*3];
> +    int codebook[8*3];
> +    int codebook2[8*3];
> +    int output[16*3];
> +    int output2[16*3];
> +    int avg[3];

i dont think all that belongs in the context, some clearly are local vars


[...]
> +                for(i = 0; i < 4*4*3; i++){
> +                    int t = prevptr[i] - c->block[i];
> +                    bestscore += t*t;
> +                }
> +                if(!skips)
> +                    bestscore += 2;

this is not a correct method of combining rate and distortion

rest not reviewed, this is a grave error and has to be fixed first

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090311/b7ec77c8/attachment.pgp>



More information about the ffmpeg-devel mailing list