static int init_dimensions(H264Context *h)

{

    int width  = h->width  - (h->sps.crop_right + h->sps.crop_left);

    int height = h->height - (h->sps.crop_top   + h->sps.crop_bottom);



    /* handle container cropping */

    if (FFALIGN(h->avctx->width,  16) == FFALIGN(width,  16) &&

        FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16)) {

        width  = h->avctx->width;

        height = h->avctx->height;

    }



    if (width <= 0 || height <= 0) {

        av_log(h->avctx, AV_LOG_ERROR, "Invalid cropped dimensions: %dx%d.\n",

               width, height);

        if (h->avctx->err_recognition & AV_EF_EXPLODE)

            return AVERROR_INVALIDDATA;



        av_log(h->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n");

        h->sps.crop_bottom =

        h->sps.crop_top    =

        h->sps.crop_right  =

        h->sps.crop_left   =

        h->sps.crop        = 0;



        width  = h->width;

        height = h->height;

    }



    h->avctx->coded_width  = h->width;

    h->avctx->coded_height = h->height;

    h->avctx->width        = width;

    h->avctx->height       = height;



    return 0;

}

static int init_dimensions(H264Context *h)

{

    int width  = h->width  - (h->sps.crop_right + h->sps.crop_left);

    int height = h->height - (h->sps.crop_top   + h->sps.crop_bottom);



    

    if (FFALIGN(h->avctx->width,  16) == FFALIGN(width,  16) &&

        FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16)) {

        width  = h->avctx->width;

        height = h->avctx->height;

    }



    if (width <= 0 || height <= 0) {

        av_log(h->avctx, AV_LOG_ERROR, "Invalid cropped dimensions: %dx%d.\n",

               width, height);

        if (h->avctx->err_recognition & AV_EF_EXPLODE)

            return AVERROR_INVALIDDATA;



        av_log(h->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n");

        h->sps.crop_bottom =

        h->sps.crop_top    =

        h->sps.crop_right  =

        h->sps.crop_left   =

        h->sps.crop        = 0;



        width  = h->width;

        height = h->height;

    }



    h->avctx->coded_width  = h->width;

    h->avctx->coded_height = h->height;

    h->avctx->width        = width;

    h->avctx->height       = height;



    return 0;

}

static int FUNC_0(H264Context *VAR_0)

{

    int VAR_1  = VAR_0->VAR_1  - (VAR_0->sps.crop_right + VAR_0->sps.crop_left);

    int VAR_2 = VAR_0->VAR_2 - (VAR_0->sps.crop_top   + VAR_0->sps.crop_bottom);



    

    if (FFALIGN(VAR_0->avctx->VAR_1,  16) == FFALIGN(VAR_1,  16) &&

        FFALIGN(VAR_0->avctx->VAR_2, 16) == FFALIGN(VAR_2, 16)) {

        VAR_1  = VAR_0->avctx->VAR_1;

        VAR_2 = VAR_0->avctx->VAR_2;

    }



    if (VAR_1 <= 0 || VAR_2 <= 0) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid cropped dimensions: %dx%d.\n",

               VAR_1, VAR_2);

        if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)

            return AVERROR_INVALIDDATA;



        av_log(VAR_0->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n");

        VAR_0->sps.crop_bottom =

        VAR_0->sps.crop_top    =

        VAR_0->sps.crop_right  =

        VAR_0->sps.crop_left   =

        VAR_0->sps.crop        = 0;



        VAR_1  = VAR_0->VAR_1;

        VAR_2 = VAR_0->VAR_2;

    }



    VAR_0->avctx->coded_width  = VAR_0->VAR_1;

    VAR_0->avctx->coded_height = VAR_0->VAR_2;

    VAR_0->avctx->VAR_1        = VAR_1;

    VAR_0->avctx->VAR_2       = VAR_2;



    return 0;

}

static int FUNC_0(H264Context *VAR_0)
{ int VAR_1  = VAR_0->VAR_1  - (VAR_0->sps.crop_right + VAR_0->sps.crop_left); int VAR_2 = VAR_0->VAR_2 - (VAR_0->sps.crop_top   + VAR_0->sps.crop_bottom); if (FFALIGN(VAR_0->avctx->VAR_1,  16) == FFALIGN(VAR_1,  16) &&
FFALIGN(VAR_0->avctx->VAR_2, 16) == FFALIGN(VAR_2, 16)) { VAR_1  = VAR_0->avctx->VAR_1; VAR_2 = VAR_0->avctx->VAR_2; } if (VAR_1 <= 0 || VAR_2 <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid cropped dimensions: %dx%d.\n",
VAR_1, VAR_2); if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA; av_log(VAR_0->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n"); VAR_0->sps.crop_bottom =
VAR_0->sps.crop_top    =
VAR_0->sps.crop_right  =
VAR_0->sps.crop_left   =
VAR_0->sps.crop        = 0; VAR_1  = VAR_0->VAR_1; VAR_2 = VAR_0->VAR_2; } VAR_0->avctx->coded_width  = VAR_0->VAR_1; VAR_0->avctx->coded_height = VAR_0->VAR_2; VAR_0->avctx->VAR_1        = VAR_1; VAR_0->avctx->VAR_2       = VAR_2; return 0; }