static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, int plane, AVFrame *frame)
{
    PixletContext *ctx = avctx->priv_data;
    ptrdiff_t stride = frame->linesize[plane] / 2;
    int i, ret;
    for (i = 0; i < ctx->levels * 3; i++) {
        int32_t a = bytestream2_get_be32(&ctx->gb);
        int32_t b = bytestream2_get_be32(&ctx->gb);
        int32_t c = bytestream2_get_be32(&ctx->gb);
        int32_t d = bytestream2_get_be32(&ctx->gb);
        int16_t *dest = (int16_t *)frame->data[plane] + ctx->band[plane][i + 1].x +
                                               stride * ctx->band[plane][i + 1].y;
        unsigned size = ctx->band[plane][i + 1].size;
        uint32_t magic;
        magic = bytestream2_get_be32(&ctx->gb);
        if (magic != 0xDEADBEEF) {
            av_log(avctx, AV_LOG_ERROR, "wrong magic number: 0x%08"PRIX32
                   " for plane %d, band %d\n", magic, plane, i);
        }
        ret = read_high_coeffs(avctx, ptr + bytestream2_tell(&ctx->gb), dest, size,
                               c, (b >= FFABS(a)) ? b : a, d,
                               ctx->band[plane][i + 1].width, stride);
        if (ret < 0) {
            av_log(avctx, AV_LOG_ERROR, "error in highpass coefficients for plane %d, band %d\n", plane, i);
            return ret;
        }
        bytestream2_skip(&ctx->gb, ret);
    }
    return 0;
}
static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, int plane, AVFrame *frame)
{
    PixletContext *ctx = avctx->priv_data;
    ptrdiff_t stride = frame->linesize[plane] / 2;
    int i, ret;
    for (i = 0; i < ctx->levels * 3; i++) {
        int32_t a = bytestream2_get_be32(&ctx->gb);
        int32_t b = bytestream2_get_be32(&ctx->gb);
        int32_t c = bytestream2_get_be32(&ctx->gb);
        int32_t d = bytestream2_get_be32(&ctx->gb);
        int16_t *dest = (int16_t *)frame->data[plane] + ctx->band[plane][i + 1].x +
                                               stride * ctx->band[plane][i + 1].y;
        unsigned size = ctx->band[plane][i + 1].size;
        uint32_t magic;
        magic = bytestream2_get_be32(&ctx->gb);
        if (magic != 0xDEADBEEF) {
            av_log(avctx, AV_LOG_ERROR, "wrong magic number: 0x%08"PRIX32
                   " for plane %d, band %d\n", magic, plane, i);
        }
        ret = read_high_coeffs(avctx, ptr + bytestream2_tell(&ctx->gb), dest, size,
                               c, (b >= FFABS(a)) ? b : a, d,
                               ctx->band[plane][i + 1].width, stride);
        if (ret < 0) {
            av_log(avctx, AV_LOG_ERROR, "error in highpass coefficients for plane %d, band %d\n", plane, i);
            return ret;
        }
        bytestream2_skip(&ctx->gb, ret);
    }
    return 0;
}
static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2, AVFrame *VAR_3)
{
    PixletContext *ctx = VAR_0->priv_data;
    ptrdiff_t stride = VAR_3->linesize[VAR_2] / 2;
    int VAR_4, VAR_5;
    for (VAR_4 = 0; VAR_4 < ctx->levels * 3; VAR_4++) {
        int32_t a = bytestream2_get_be32(&ctx->gb);
        int32_t b = bytestream2_get_be32(&ctx->gb);
        int32_t c = bytestream2_get_be32(&ctx->gb);
        int32_t d = bytestream2_get_be32(&ctx->gb);
        int16_t *dest = (int16_t *)VAR_3->data[VAR_2] + ctx->band[VAR_2][VAR_4 + 1].x +
                                               stride * ctx->band[VAR_2][VAR_4 + 1].y;
        unsigned size = ctx->band[VAR_2][VAR_4 + 1].size;
        uint32_t magic;
        magic = bytestream2_get_be32(&ctx->gb);
        if (magic != 0xDEADBEEF) {
            av_log(VAR_0, AV_LOG_ERROR, "wrong magic number: 0x%08"PRIX32
                   " for VAR_2 %d, band %d\n", magic, VAR_2, VAR_4);
        }
        VAR_5 = read_high_coeffs(VAR_0, VAR_1 + bytestream2_tell(&ctx->gb), dest, size,
                               c, (b >= FFABS(a)) ? b : a, d,
                               ctx->band[VAR_2][VAR_4 + 1].width, stride);
        if (VAR_5 < 0) {
            av_log(VAR_0, AV_LOG_ERROR, "error in highpass coefficients for VAR_2 %d, band %d\n", VAR_2, VAR_4);
            return VAR_5;
        }
        bytestream2_skip(&ctx->gb, VAR_5);
    }
    return 0;
}
static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2, AVFrame *VAR_3)
{ PixletContext *ctx = VAR_0->priv_data; ptrdiff_t stride = VAR_3->linesize[VAR_2] / 2; int VAR_4, VAR_5; for (VAR_4 = 0; VAR_4 < ctx->levels * 3; VAR_4++) { int32_t a = bytestream2_get_be32(&ctx->gb); int32_t b = bytestream2_get_be32(&ctx->gb); int32_t c = bytestream2_get_be32(&ctx->gb); int32_t d = bytestream2_get_be32(&ctx->gb); int16_t *dest = (int16_t *)VAR_3->data[VAR_2] + ctx->band[VAR_2][VAR_4 + 1].x +
stride * ctx->band[VAR_2][VAR_4 + 1].y; unsigned size = ctx->band[VAR_2][VAR_4 + 1].size; uint32_t magic; magic = bytestream2_get_be32(&ctx->gb); if (magic != 0xDEADBEEF) { av_log(VAR_0, AV_LOG_ERROR, "wrong magic number: 0x%08"PRIX32
" for VAR_2 %d, band %d\n", magic, VAR_2, VAR_4); } VAR_5 = read_high_coeffs(VAR_0, VAR_1 + bytestream2_tell(&ctx->gb), dest, size,
c, (b >= FFABS(a)) ? b : a, d,
ctx->band[VAR_2][VAR_4 + 1].width, stride); if (VAR_5 < 0) { av_log(VAR_0, AV_LOG_ERROR, "error in highpass coefficients for VAR_2 %d, band %d\n", VAR_2, VAR_4); return VAR_5; } bytestream2_skip(&ctx->gb, VAR_5); } return 0; }