static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,

                    AVFrame *ref, const Mv *mv, int x_off, int y_off,

                    int block_w, int block_h)

{

    HEVCLocalContext *lc = &s->HEVClc;

    uint8_t *src         = ref->data[0];

    ptrdiff_t srcstride  = ref->linesize[0];

    int pic_width        = s->ps.sps->width;

    int pic_height       = s->ps.sps->height;



    int mx         = mv->x & 3;

    int my         = mv->y & 3;

    int extra_left = ff_hevc_qpel_extra_before[mx];

    int extra_top  = ff_hevc_qpel_extra_before[my];



    x_off += mv->x >> 2;

    y_off += mv->y >> 2;

    src   += y_off * srcstride + (x_off << s->ps.sps->pixel_shift);



    if (x_off < extra_left || y_off < extra_top ||

        x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] ||

        y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) {

        const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;

        int offset = extra_top * srcstride + (extra_left << s->ps.sps->pixel_shift);

        int buf_offset = extra_top *

                         edge_emu_stride + (extra_left << s->ps.sps->pixel_shift);



        s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - offset,

                                 edge_emu_stride, srcstride,

                                 block_w + ff_hevc_qpel_extra[mx],

                                 block_h + ff_hevc_qpel_extra[my],

                                 x_off - extra_left, y_off - extra_top,

                                 pic_width, pic_height);

        src = lc->edge_emu_buffer + buf_offset;

        srcstride = edge_emu_stride;

    }

    s->hevcdsp.put_hevc_qpel[my][mx](dst, dststride, src, srcstride, block_w,

                                     block_h, lc->mc_buffer);

}

static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,

                    AVFrame *ref, const Mv *mv, int x_off, int y_off,

                    int block_w, int block_h)

{

    HEVCLocalContext *lc = &s->HEVClc;

    uint8_t *src         = ref->data[0];

    ptrdiff_t srcstride  = ref->linesize[0];

    int pic_width        = s->ps.sps->width;

    int pic_height       = s->ps.sps->height;



    int mx         = mv->x & 3;

    int my         = mv->y & 3;

    int extra_left = ff_hevc_qpel_extra_before[mx];

    int extra_top  = ff_hevc_qpel_extra_before[my];



    x_off += mv->x >> 2;

    y_off += mv->y >> 2;

    src   += y_off * srcstride + (x_off << s->ps.sps->pixel_shift);



    if (x_off < extra_left || y_off < extra_top ||

        x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] ||

        y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) {

        const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;

        int offset = extra_top * srcstride + (extra_left << s->ps.sps->pixel_shift);

        int buf_offset = extra_top *

                         edge_emu_stride + (extra_left << s->ps.sps->pixel_shift);



        s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - offset,

                                 edge_emu_stride, srcstride,

                                 block_w + ff_hevc_qpel_extra[mx],

                                 block_h + ff_hevc_qpel_extra[my],

                                 x_off - extra_left, y_off - extra_top,

                                 pic_width, pic_height);

        src = lc->edge_emu_buffer + buf_offset;

        srcstride = edge_emu_stride;

    }

    s->hevcdsp.put_hevc_qpel[my][mx](dst, dststride, src, srcstride, block_w,

                                     block_h, lc->mc_buffer);

}

static void FUNC_0(HEVCContext *VAR_0, int16_t *VAR_1, ptrdiff_t VAR_2,

                    AVFrame *VAR_3, const Mv *VAR_4, int VAR_5, int VAR_6,

                    int VAR_7, int VAR_8)

{

    HEVCLocalContext *lc = &VAR_0->HEVClc;

    uint8_t *src         = VAR_3->data[0];

    ptrdiff_t srcstride  = VAR_3->linesize[0];

    int VAR_9        = VAR_0->ps.sps->width;

    int VAR_10       = VAR_0->ps.sps->height;



    int VAR_11         = VAR_4->x & 3;

    int VAR_12         = VAR_4->y & 3;

    int VAR_13 = ff_hevc_qpel_extra_before[VAR_11];

    int VAR_14  = ff_hevc_qpel_extra_before[VAR_12];



    VAR_5 += VAR_4->x >> 2;

    VAR_6 += VAR_4->y >> 2;

    src   += VAR_6 * srcstride + (VAR_5 << VAR_0->ps.sps->pixel_shift);



    if (VAR_5 < VAR_13 || VAR_6 < VAR_14 ||

        VAR_5 >= VAR_9 - VAR_7 - ff_hevc_qpel_extra_after[VAR_11] ||

        VAR_6 >= VAR_10 - VAR_8 - ff_hevc_qpel_extra_after[VAR_12]) {

        const int VAR_15 = EDGE_EMU_BUFFER_STRIDE << VAR_0->ps.sps->pixel_shift;

        int VAR_16 = VAR_14 * srcstride + (VAR_13 << VAR_0->ps.sps->pixel_shift);

        int VAR_17 = VAR_14 *

                         VAR_15 + (VAR_13 << VAR_0->ps.sps->pixel_shift);



        VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - VAR_16,

                                 VAR_15, srcstride,

                                 VAR_7 + ff_hevc_qpel_extra[VAR_11],

                                 VAR_8 + ff_hevc_qpel_extra[VAR_12],

                                 VAR_5 - VAR_13, VAR_6 - VAR_14,

                                 VAR_9, VAR_10);

        src = lc->edge_emu_buffer + VAR_17;

        srcstride = VAR_15;

    }

    VAR_0->hevcdsp.put_hevc_qpel[VAR_12][VAR_11](VAR_1, VAR_2, src, srcstride, VAR_7,

                                     VAR_8, lc->mc_buffer);

}

static void FUNC_0(HEVCContext *VAR_0, int16_t *VAR_1, ptrdiff_t VAR_2,
AVFrame *VAR_3, const Mv *VAR_4, int VAR_5, int VAR_6,
int VAR_7, int VAR_8)
{ HEVCLocalContext *lc = &VAR_0->HEVClc; uint8_t *src         = VAR_3->data[0]; ptrdiff_t srcstride  = VAR_3->linesize[0]; int VAR_9        = VAR_0->ps.sps->width; int VAR_10       = VAR_0->ps.sps->height; int VAR_11         = VAR_4->x & 3; int VAR_12         = VAR_4->y & 3; int VAR_13 = ff_hevc_qpel_extra_before[VAR_11]; int VAR_14  = ff_hevc_qpel_extra_before[VAR_12]; VAR_5 += VAR_4->x >> 2; VAR_6 += VAR_4->y >> 2; src   += VAR_6 * srcstride + (VAR_5 << VAR_0->ps.sps->pixel_shift); if (VAR_5 < VAR_13 || VAR_6 < VAR_14 ||
VAR_5 >= VAR_9 - VAR_7 - ff_hevc_qpel_extra_after[VAR_11] ||
VAR_6 >= VAR_10 - VAR_8 - ff_hevc_qpel_extra_after[VAR_12]) { const int VAR_15 = EDGE_EMU_BUFFER_STRIDE << VAR_0->ps.sps->pixel_shift; int VAR_16 = VAR_14 * srcstride + (VAR_13 << VAR_0->ps.sps->pixel_shift); int VAR_17 = VAR_14 *
VAR_15 + (VAR_13 << VAR_0->ps.sps->pixel_shift); VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - VAR_16,
VAR_15, srcstride,
VAR_7 + ff_hevc_qpel_extra[VAR_11],
VAR_8 + ff_hevc_qpel_extra[VAR_12],
VAR_5 - VAR_13, VAR_6 - VAR_14,
VAR_9, VAR_10); src = lc->edge_emu_buffer + VAR_17; srcstride = VAR_15; } VAR_0->hevcdsp.put_hevc_qpel[VAR_12][VAR_11](VAR_1, VAR_2, src, srcstride, VAR_7,
VAR_8, lc->mc_buffer); }