All looks good except these extremely minor points - no objection if
patch applied as is:

In libavcodec/hapdec.c

> +/* Prepare the texture to be decompressed */
> +static int setup_texture(AVCodecContext *avctx, size_t length)
> +{
> +    HapContext *ctx = avctx->priv_data;
> +    GetByteContext *gbc = &ctx->gbc;
> +    int64_t snappy_size;
> +    const char *texture_name;
> +    const char *compressorstr;
> +    int ret;
> +
> +    switch (ctx->section_type & 0x0F) {
> +    case HAP_FMT_RGBDXT1:
> +        ctx->tex_rat = 8;
> +        ctx->tex_fun = ctx->dxtc.dxt1_block;
> +        texture_name = "DXT1";
> +        break;
> +    case HAP_FMT_RGBADXT5:
> +        ctx->tex_rat = 16;
> +        ctx->tex_fun = ctx->dxtc.dxt5_block;
> +        texture_name = "DXT5";
> +        break;
> +    case HAP_FMT_YCOCGDXT5:
> +        ctx->tex_rat = 16;
> +        ctx->tex_fun = ctx->dxtc.dxt5ys_block;
> +        texture_name = "DXT5-YCoCg-scaled";
> +        break;
> +    default:
> +        av_log(avctx, AV_LOG_ERROR,
> +               "Invalid format mode %02X.\n", ctx->section_type);
> +        return AVERROR_INVALIDDATA;
> +    }
> +
> +    switch (ctx->section_type & 0xF0) {
> +    case HAP_COMP_NONE:
> +        /* Only DXTC texture compression */
> +        ctx->tex_data = gbc->buffer;
> +        ctx->tex_size = length;
> +        compressorstr = "none";
> +        break;
> +    case HAP_COMP_SNAPPY:
> +        /* Uncompress the frame */
> +        ret = ff_snappy_uncompress(gbc, &ctx->snappied, &snappy_size);
> +        if (ret < 0) {
> +             av_log(avctx, AV_LOG_ERROR, "Snappy uncompress error\n");
> +             return ret;
> +        }
> +
> +        ctx->tex_data = ctx->snappied;
> +        ctx->tex_size = snappy_size;
> +        compressorstr = "snappy";
> +        break;
> +    case HAP_COMP_COMPLEX:
> +        compressorstr = "complex";
> +        avpriv_request_sample(avctx, "Complex HAP compressor");

Hap not HAP

In libavcodec/hapenc.c

> +static av_cold int hap_init(AVCodecContext *avctx)
> +{
> +    HapContext *ctx = avctx->priv_data;
> +    int ratio;
> +    int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
> +
> +    if (ret < 0) {
> +        av_log(avctx, AV_LOG_ERROR, "Invalid video size %dx%d.\n",
> +               avctx->width, avctx->height);
> +        return ret;
> +    }
> +
> +    if (avctx->width % 4 || avctx->height % 4) {
> +        av_log(avctx, AV_LOG_ERROR, "Video size %dx%d is not multiple of 
> 4.\n",
> +               avctx->width, avctx->height);
> +        return AVERROR_INVALIDDATA;
> +    }

Could be AVERROR_PATCHWELCOME
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to