int ff_scale_image(uint8_t *dst_data[4], int dst_linesize[4],

                   int dst_w, int dst_h, enum AVPixelFormat dst_pix_fmt,

                   uint8_t * const src_data[4], int src_linesize[4],

                   int src_w, int src_h, enum AVPixelFormat src_pix_fmt,

                   void *log_ctx)

{

    int ret;

    struct SwsContext *sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt,

                                                dst_w, dst_h, dst_pix_fmt,

                                                SWS_BILINEAR, NULL, NULL, NULL);

    if (!sws_ctx) {

        av_log(log_ctx, AV_LOG_ERROR,

               "Impossible to create scale context for the conversion "

               "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",

               av_get_pix_fmt_name(src_pix_fmt), src_w, src_h,

               av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h);

        ret = AVERROR(EINVAL);

        goto end;

    }



    if ((ret = av_image_alloc(dst_data, dst_linesize, dst_w, dst_h, dst_pix_fmt, 16)) < 0)

        goto end;

    ret = 0;

    sws_scale(sws_ctx, (const uint8_t * const*)src_data, src_linesize, 0, src_h, dst_data, dst_linesize);



end:

    sws_freeContext(sws_ctx);

    return ret;

}

int ff_scale_image(uint8_t *dst_data[4], int dst_linesize[4],

                   int dst_w, int dst_h, enum AVPixelFormat dst_pix_fmt,

                   uint8_t * const src_data[4], int src_linesize[4],

                   int src_w, int src_h, enum AVPixelFormat src_pix_fmt,

                   void *log_ctx)

{

    int ret;

    struct SwsContext *sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt,

                                                dst_w, dst_h, dst_pix_fmt,

                                                SWS_BILINEAR, NULL, NULL, NULL);

    if (!sws_ctx) {

        av_log(log_ctx, AV_LOG_ERROR,

               "Impossible to create scale context for the conversion "

               "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",

               av_get_pix_fmt_name(src_pix_fmt), src_w, src_h,

               av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h);

        ret = AVERROR(EINVAL);

        goto end;

    }



    if ((ret = av_image_alloc(dst_data, dst_linesize, dst_w, dst_h, dst_pix_fmt, 16)) < 0)

        goto end;

    ret = 0;

    sws_scale(sws_ctx, (const uint8_t * const*)src_data, src_linesize, 0, src_h, dst_data, dst_linesize);



end:

    sws_freeContext(sws_ctx);

    return ret;

}

int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],

                   int VAR_2, int VAR_3, enum AVPixelFormat VAR_4,

                   uint8_t * const VAR_5[4], int VAR_6[4],

                   int VAR_7, int VAR_8, enum AVPixelFormat VAR_9,

                   void *VAR_10)

{

    int VAR_11;

    struct SwsContext *VAR_12 = sws_getContext(VAR_7, VAR_8, VAR_9,

                                                VAR_2, VAR_3, VAR_4,

                                                SWS_BILINEAR, NULL, NULL, NULL);

    if (!VAR_12) {

        av_log(VAR_10, AV_LOG_ERROR,

               "Impossible to create scale context for the conversion "

               "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",

               av_get_pix_fmt_name(VAR_9), VAR_7, VAR_8,

               av_get_pix_fmt_name(VAR_4), VAR_2, VAR_3);

        VAR_11 = AVERROR(EINVAL);

        goto end;

    }



    if ((VAR_11 = av_image_alloc(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, 16)) < 0)

        goto end;

    VAR_11 = 0;

    sws_scale(VAR_12, (const uint8_t * const*)VAR_5, VAR_6, 0, VAR_8, VAR_0, VAR_1);



end:

    sws_freeContext(VAR_12);

    return VAR_11;

}

int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],
int VAR_2, int VAR_3, enum AVPixelFormat VAR_4,
uint8_t * const VAR_5[4], int VAR_6[4],
int VAR_7, int VAR_8, enum AVPixelFormat VAR_9,
void *VAR_10)
{ int VAR_11; struct SwsContext *VAR_12 = sws_getContext(VAR_7, VAR_8, VAR_9,
VAR_2, VAR_3, VAR_4,
SWS_BILINEAR, NULL, NULL, NULL); if (!VAR_12) { av_log(VAR_10, AV_LOG_ERROR,
"Impossible to create scale context for the conversion "
"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
av_get_pix_fmt_name(VAR_9), VAR_7, VAR_8,
av_get_pix_fmt_name(VAR_4), VAR_2, VAR_3); VAR_11 = AVERROR(EINVAL); goto end; } if ((VAR_11 = av_image_alloc(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, 16)) < 0)
goto end; VAR_11 = 0; sws_scale(VAR_12, (const uint8_t * const*)VAR_5, VAR_6, 0, VAR_8, VAR_0, VAR_1); end:
sws_freeContext(VAR_12); return VAR_11; }