[FFmpeg-devel] [Toy] MS Video 1 encoder
Michael Niedermayer
michaelni
Sun Jan 25 19:05:06 CET 2009
On Sun, Jan 25, 2009 at 05:56:28PM +0200, Kostya wrote:
> Here's a result of sleepless day :).
>
> With a small patch to ELBG it was possible to implement simple
> 15-bit MSVC encoder. At least it can encode more or less recognizable video.
>
> Since I have no intentions nor time to polish it, feel free to use it as you
> like - finish, rework into RPZA encoder, add link to this post to
> "Interesting patches" on Multimedia Wiki and forget it, whatever.
>
> (I should be working on AAC encoder anyway)
just a quick review (no point in doing a more complete one if noone will
work on it ...)
[...]
> +typedef struct Msvideo1EncContext {
> + AVCodecContext *avctx;
> + AVFrame pic;
> + AVRandomState 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];
> + int bestpos;
unused
> + int keyint;
> +} Msvideo1EncContext;
> +
> +enum MSV1Mode{
> + MODE_SKIP = 0,
> + MODE_FILL,
> + MODE_2COL,
> + MODE_8COL,
> +};
> +
> +#define SKIP_PREFIX 0x8400
> +#define SKIPS_MAX 0x0FFF
> +#define MKRGB555(in, off) ((in[off] << 10) | (in[off + 1] << 5) | (in[off + 2]))
> +
> +static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
fits in uint8_t
> +
> +static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
> +{
> + Msvideo1EncContext * const c = avctx->priv_data;
> + AVFrame *pict = data;
> + AVFrame * const p = &c->pic;
> + uint16_t *src;
> + uint8_t *prevptr;
> + uint8_t *dst = buf;
> + int keyframe = 1;
constant
> + int no_skips = 1;
> + int i, j, k, x, y;
> + int skips = 0;
> +
> + *p = *pict;
> + if(!c->prev)
> + c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
> + prevptr = c->prev + avctx->width * 3 * (((avctx->height + 3)&~3) - 1);
> + src = (uint16_t*)(p->data[0] + p->linesize[0]*(((avctx->height + 3)&~3) - 1));
> + if(c->keyint >= avctx->keyint_min)
> + keyframe = 1;
> +
trailing whitespace
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20090125/524961f6/attachment.pgp>
More information about the ffmpeg-devel
mailing list