static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx,
                                          AVCodecContext *avctx)
{
    int p, luma_width, luma_height, chroma_width, chroma_height;
    int luma_pitch, chroma_pitch, luma_size, chroma_size;
    luma_width  = ctx->width;
    luma_height = ctx->height;
    if (luma_width  < 16 || luma_width  > 640 ||
        luma_height < 16 || luma_height > 480 ||
        luma_width  &  3 || luma_height &   3) {
        av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n",
               luma_width, luma_height);
        return AVERROR_INVALIDDATA;
    }
    chroma_width  = FFALIGN(luma_width  >> 2, 4);
    chroma_height = FFALIGN(luma_height >> 2, 4);
    luma_pitch   = FFALIGN(luma_width,   16);
    chroma_pitch = FFALIGN(chroma_width, 16);
    luma_size = luma_pitch * (luma_height + 1);
    chroma_size = chroma_pitch * (chroma_height + 1);
    for (p = 0; p < 3; p++) {
        ctx->planes[p].pitch  = !p ? luma_pitch  : chroma_pitch;
        ctx->planes[p].width  = !p ? luma_width  : chroma_width;
        ctx->planes[p].height = !p ? luma_height : chroma_height;
        ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size);
        ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size);
        memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch);
        memset(ctx->planes[p].buffers[1], 0x40, ctx->planes[p].pitch);
        ctx->planes[p].pixels[0] = ctx->planes[p].buffers[0] + ctx->planes[p].pitch;
        ctx->planes[p].pixels[1] = ctx->planes[p].buffers[1] + ctx->planes[p].pitch;
    }
    return 0;
}
['static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx,\n                                          AVCodecContext *avctx)\n{\n    int p, luma_width, luma_height, chroma_width, chroma_height;\n    int luma_pitch, chroma_pitch, luma_size, chroma_size;\n    luma_width  = ctx->width;\n    luma_height = ctx->height;\n    if (luma_width  < 16 || luma_width  > 640 ||\n        luma_height < 16 || luma_height > 480 ||\n        luma_width  &  3 || luma_height &   3) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\\n",\n               luma_width, luma_height);\n        return AVERROR_INVALIDDATA;\n    }\n    chroma_width  = FFALIGN(luma_width  >> 2, 4);\n    chroma_height = FFALIGN(luma_height >> 2, 4);\n    luma_pitch   = FFALIGN(luma_width,   16);\n    chroma_pitch = FFALIGN(chroma_width, 16);\n    luma_size = luma_pitch * (luma_height + 1);\n    chroma_size = chroma_pitch * (chroma_height + 1);\n    for (p = 0; p < 3; p++) {\n        ctx->planes[p].pitch  = !p ? luma_pitch  : chroma_pitch;\n        ctx->planes[p].width  = !p ? luma_width  : chroma_width;\n        ctx->planes[p].height = !p ? luma_height : chroma_height;\n        ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size);\n        ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size);\n        memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch);\n        memset(ctx->planes[p].buffers[1], 0x40, ctx->planes[p].pitch);\n        ctx->planes[p].pixels[0] = ctx->planes[p].buffers[0] + ctx->planes[p].pitch;\n        ctx->planes[p].pixels[1] = ctx->planes[p].buffers[1] + ctx->planes[p].pitch;\n    }\n    return 0;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-32) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+32);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&31) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,32,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(32,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']