On Fri, Jun 03, 2016 at 03:51:28PM -0400, Vittorio Giovara wrote:
> --- /dev/null
> +++ b/libavcodec/magicyuv.c
> @@ -0,0 +1,464 @@
> +
> +#include <stdio.h>

?

> +typedef struct MagicYUVContext {
> +    int               slice_height;
> +    int               slices_size[4]; // slice sizes for each plane

These could and likely should be unsigned or size_t, more similar cases below.

> +        if (pred == LEFT) {
> +        } else if (pred == GRADIENT) {
> +        } else if (pred == MEDIAN) {
> +        } else {

switch/case would feel cleaner.

> +            avpriv_request_sample(avctx, "unknown prediction: %d", pred);

Unknown

> +    header_size = bytestream2_get_le32(&gbyte);
> +    if (header_size < 32 || header_size >= avpkt->size) {
> +        av_log(avctx, AV_LOG_ERROR,
> +               "header or packet too small %d\n", header_size);

PRIu32

> +    if (version != 7) {
> +        avpriv_request_sample(avctx, "version %d", version);

Version

> +    s->hshift[1] = s->vshift[1] = 0;
> +    s->hshift[2] = s->vshift[2] = 0;

I'd break the lines.

> +    case 0x68:
> +        avctx->pix_fmt = AV_PIX_FMT_YUV422P;
> +        s->planes = 3;
> +        s->hshift[1] = s->hshift[2] = 1;
> +        break;
> +    case 0x69:
> +        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> +        s->planes = 3;
> +        s->hshift[1] = s->vshift[1] = 1;
> +        s->hshift[2] = s->vshift[2] = 1;

same

> +    if (slice_width != avctx->coded_width) {
> +        avpriv_request_sample(avctx, "slice width %d", slice_width);

Slice, PRIu32

> +static av_cold int magy_decode_end(AVCodecContext *avctx)
> +{
> +    MagicYUVContext * const s = avctx->priv_data;
> +    int i;
> +
> +    for (i = 0; i < 4; i++) {

FF_ARRAY_ELEMS maybe

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to