On Sat, Jun 16, 2012 at 12:36:16PM +0200, Kostya Shishkov wrote:
> ---
> As a side note, I must say that lavf ASF demuxer outputs wrong data, so for
> example eleventh or twelfth frame in
> http://samples.ffmpeg.org/V-codecs/MSS1/screen_codec.wmv
> is demuxed wrong compared to MPlayer. And of course it causes decoding errors.
Who can fix it? :)
Please add a Bugzilla entry if we don't have one already...
> --- /dev/null
> +++ b/libavcodec/mss1.c
> @@ -0,0 +1,844 @@
> +
> +static void arith_init(ArithCoder *c, GetBitContext *gb)
av_cold?
You don't have av_cold on any function, which is surprising.
> +static int arith_get_bit(ArithCoder *c)
> +{
> + int range = c->high - c->low + 1;
> + int bit = (((c->value - c->low) << 1) + 1) / range;
> +
> + if (bit)
> + c->low += range >> 1;
> + else
> + c->high = c->low + (range >> 1) - 1;
> +
> + arith_normalise(c);
> +
> + return bit;
> +}
> +
> +static int arith_get_bits(ArithCoder *c, int bits)
> +{
> + int range = c->high - c->low + 1;
> + int val = (((c->value - c->low + 1) << bits) - 1) / range;
> + int prob = range * val;
> +
> + c->high = ((prob + range) >> bits) + c->low - 1;
> + c->low += prob >> bits;
> +
> + arith_normalise(c);
> +
> + return val;
> +}
> +
> +static int arith_get_number(ArithCoder *c, int mod_val)
> +{
> + int range = c->high - c->low + 1;
> + int val = ((c->value - c->low + 1) * mod_val - 1) / range;
> + int prob = range * val;
> +
> + c->high = (prob + range) / mod_val + c->low - 1;
> + c->low += prob / mod_val;
> +
> + arith_normalise(c);
> +
> + return val;
> +}
This would be easy to refactor in Haskell ;)
> +static void model_init(Model *m, int num_syms, int thr_weight)
av_cold?
> +static void codec_init(MSS1Context *ctx)
av_cold?
> + c->pic.reference = 3;
> + c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
> + FF_BUFFER_HINTS_REUSABLE;
align
> + if (!arith_get_bit(&acoder)) {
> + codec_reset(c);
> + pal_changed = decode_pal(c, &acoder);
> + c->corrupted = decode_intra(c, &acoder, 0, 0, avctx->width,
> avctx->height);
> + c->pic.key_frame = 1;
> + c->pic.pict_type = AV_PICTURE_TYPE_I;
align
> + } else {
> + if (c->corrupted)
> + return AVERROR_INVALIDDATA;
> + c->corrupted = decode_inter(c, &acoder, 0, 0, avctx->width,
> avctx->height);
> + c->pic.key_frame = 0;
> + c->pic.pict_type = AV_PICTURE_TYPE_P;
> + }
align
> + c->mask_linesize = FFALIGN(avctx->coded_width, 16);
> + c->mask = av_malloc(c->mask_linesize * avctx->coded_height);
align
> +static av_cold int decode_init(AVCodecContext *avctx)
av_cold
> +static av_cold int decode_end(AVCodecContext *avctx)
av_cold
I thought generic function names like decode_init/decode_end/decode_frame
should be avoided in modern code. Should I make this an entry in the dev
docs?
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel