On Fri, Feb 07, 2014 at 04:50:55PM +0000, Derek Buitenhuis wrote:
> From: Kostya Shishkov <[email protected]>
>
> Does not contain cursor rendering yet.
>
> Signed-off-by: Derek Buitenhuis <[email protected]>
> ---
> Changelog | 1 +
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/avcodec.h | 1 +
> libavcodec/codec_desc.c | 7 ++
> libavcodec/fic.c | 311
> ++++++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/version.h | 4 +-
> libavformat/riff.c | 1 +
> 8 files changed, 325 insertions(+), 2 deletions(-)
> create mode 100644 libavcodec/fic.c
Docs update is missing, FATE tests would be welcome.
> --- /dev/null
> +++ b/libavcodec/fic.c
> @@ -0,0 +1,311 @@
> +
> +#include "avcodec.h"
> +#include "internal.h"
> +#include "dsputil.h"
> +#include "get_bits.h"
> +#include "golomb.h"
> +#include "libavutil/common.h"
Reorder please and place libavutil headers before libavcodec headers.
> +typedef struct FICThreadContext {
> + DECLARE_ALIGNED(16, int16_t, block)[64];
> + uint8_t *src;
> + int slice_h;
> + int src_size;
trailing whitespace
> +typedef struct FICContext {
> + AVCodecContext *avctx;
> + AVFrame *frame;
> +
> + DSPContext dsp;
> + ScanTable scantable;
This decoder needs a dsputil and a golomb dependency in configure.
Does it compile standalone?
> +static int fic_decode_block(FICContext *ctx, GetBitContext *gb,
> + uint8_t *dst, int stride, int16_t *block)
> +{
> + int i, num_coeff;
> +
> + /* Is it a skip block? */
> + if (get_bits1(gb)) {
> + /* This is a P frame. */
nit: P-frame
> +static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
> +{
> + FICContext *ctx = avctx->priv_data;
> + FICThreadContext *tctx = tdata;
> + GetBitContext gb;
> + int x, y, p;
> + uint8_t *src = tctx->src;
> + uint8_t *dst;
> + int slice_h = tctx->slice_h;
> + int src_size = tctx->src_size;
> + int stride;
> + int ret;
> + int y_off = tctx->y_off;
> +
> + init_get_bits(&gb, src, src_size * 8);
> +
> + for (p = 0; p < 3; p++) {
> + stride = ctx->frame->linesize[p];
> + dst = ctx->frame->data[p] + (y_off >> !!p) * stride;
> +
> + for (y = 0; y < (slice_h >> !!p); y += 8) {
> + for (x = 0; x < (ctx->aligned_width >> !!p); x += 8)
> + if ((ret = fic_decode_block(ctx, &gb, dst + x, stride,
> tctx->block)) != 0)
> + return ret;
> +
> + dst += 8 * stride;
> + }
> + }
> +
> + return 0;
> +}
IMO this would be more readable if you moved variables to a smaller scope
where possible.
> + /*
> + * Set the frametype to I initially. It will be set to P if the frame
> + * has any dependencies (skip blocks). There will be a race condition
> + * inside the slice decode functiono to set these, but we do not care.
function_
> + for (slice = 0; slice < nslices; slice++) {
> + int slice_off = AV_RB32(src + tsize + 27 + slice * 4);
> + int slice_size;
> + int y_off = ctx->slice_h * slice;
> + int slice_h = ctx->slice_h;
> +
trailing whitespace
> + /*
> + * Either read the slice size, or consume all data left.
> + * Also, special case the last slight height.
> + */
> + if (slice == nslices - 1) {
> + slice_size = msize;
ditto
> +static av_cold int fic_decode_init(AVCodecContext *avctx)
> +{
> + FICContext *ctx = avctx->priv_data;
> +
> + /* Initialize various context values */
> + ctx->avctx = avctx;
> + ctx->aligned_width = FFALIGN(avctx->width, 16);
> + ctx->aligned_height = FFALIGN(avctx->height, 16);
nit: stray extra spaces
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel