static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *image) {

    uint16_t *img_ptr;

    int index, x, y, c;

    int adjust[4];

    for (x = 0; x < image->numcomps; x++)

        adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0);



    for (y = 0; y < picture->height; y++) {

        index = y*picture->width;

        img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]);

        for (x = 0; x < picture->width; x++, index++) {

            for (c = 0; c < image->numcomps; c++) {

                *img_ptr++ = 0x8000 * image->comps[c].sgnd + (image->comps[c].data[index] << adjust[c]);

            }

        }

    }

}

static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *image) {

    uint16_t *img_ptr;

    int index, x, y, c;

    int adjust[4];

    for (x = 0; x < image->numcomps; x++)

        adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0);



    for (y = 0; y < picture->height; y++) {

        index = y*picture->width;

        img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]);

        for (x = 0; x < picture->width; x++, index++) {

            for (c = 0; c < image->numcomps; c++) {

                *img_ptr++ = 0x8000 * image->comps[c].sgnd + (image->comps[c].data[index] << adjust[c]);

            }

        }

    }

}

                *img_ptr++ = 0x8000 * image->comps[c].sgnd + (image->comps[c].data[index] << adjust[c]);
static inline void FUNC_0(AVFrame *VAR_0, opj_image_t *VAR_1) {

    uint16_t *img_ptr;

    int VAR_2, VAR_3, VAR_4, VAR_5;

    int VAR_6[4];

    for (VAR_3 = 0; VAR_3 < VAR_1->numcomps; VAR_3++)

        VAR_6[VAR_3] = FFMAX(FFMIN(av_pix_fmt_desc_get(VAR_0->format)->comp[VAR_3].depth_minus1 + 1 - VAR_1->comps[VAR_3].prec, 8), 0);



    for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {

        VAR_2 = VAR_4*VAR_0->width;

        img_ptr = (uint16_t*) (VAR_0->data[0] + VAR_4*VAR_0->linesize[0]);

        for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++, VAR_2++) {

            for (VAR_5 = 0; VAR_5 < VAR_1->numcomps; VAR_5++) {

                *img_ptr++ = 0x8000 * VAR_1->comps[VAR_5].sgnd + (VAR_1->comps[VAR_5].data[VAR_2] << VAR_6[VAR_5]);

            }

        }

    }

}

static inline void FUNC_0(AVFrame *VAR_0, opj_image_t *VAR_1) { uint16_t *img_ptr; int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6[4]; for (VAR_3 = 0; VAR_3 < VAR_1->numcomps; VAR_3++) VAR_6[VAR_3] = FFMAX(FFMIN(av_pix_fmt_desc_get(VAR_0->format)->comp[VAR_3].depth_minus1 + 1 - VAR_1->comps[VAR_3].prec, 8), 0); for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { VAR_2 = VAR_4*VAR_0->width; img_ptr = (uint16_t*) (VAR_0->data[0] + VAR_4*VAR_0->linesize[0]); for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++, VAR_2++) { for (VAR_5 = 0; VAR_5 < VAR_1->numcomps; VAR_5++) { *img_ptr++ = 0x8000 * VAR_1->comps[VAR_5].sgnd + (VAR_1->comps[VAR_5].data[VAR_2] << VAR_6[VAR_5]); } } } }