static void denoise_depth(HQDN3DContext *s,

                          uint8_t *src, uint8_t *dst,

                          uint16_t *line_ant, uint16_t **frame_ant_ptr,

                          int w, int h, int sstride, int dstride,

                          int16_t *spatial, int16_t *temporal, int depth)

{

    // FIXME: For 16bit depth, frame_ant could be a pointer to the previous

    // filtered frame rather than a separate buffer.

    long x, y;

    uint16_t *frame_ant = *frame_ant_ptr;

    if (!frame_ant) {

        uint8_t *frame_src = src;

        *frame_ant_ptr = frame_ant = av_malloc(w*h*sizeof(uint16_t));

        for (y = 0; y < h; y++, src += sstride, frame_ant += w)

            for (x = 0; x < w; x++)

                frame_ant[x] = LOAD(x);

        src = frame_src;

        frame_ant = *frame_ant_ptr;

    }



    if (spatial[0])

        denoise_spatial(s, src, dst, line_ant, frame_ant,

                        w, h, sstride, dstride, spatial, temporal, depth);

    else

        denoise_temporal(src, dst, frame_ant,

                         w, h, sstride, dstride, temporal, depth);

    emms_c();

}

static void denoise_depth(HQDN3DContext *s,

                          uint8_t *src, uint8_t *dst,

                          uint16_t *line_ant, uint16_t **frame_ant_ptr,

                          int w, int h, int sstride, int dstride,

                          int16_t *spatial, int16_t *temporal, int depth)

{

    

    

    long x, y;

    uint16_t *frame_ant = *frame_ant_ptr;

    if (!frame_ant) {

        uint8_t *frame_src = src;

        *frame_ant_ptr = frame_ant = av_malloc(w*h*sizeof(uint16_t));

        for (y = 0; y < h; y++, src += sstride, frame_ant += w)

            for (x = 0; x < w; x++)

                frame_ant[x] = LOAD(x);

        src = frame_src;

        frame_ant = *frame_ant_ptr;

    }



    if (spatial[0])

        denoise_spatial(s, src, dst, line_ant, frame_ant,

                        w, h, sstride, dstride, spatial, temporal, depth);

    else

        denoise_temporal(src, dst, frame_ant,

                         w, h, sstride, dstride, temporal, depth);

    emms_c();

}

static void FUNC_0(HQDN3DContext *VAR_0,

                          uint8_t *VAR_1, uint8_t *VAR_2,

                          uint16_t *VAR_3, uint16_t **VAR_4,

                          int VAR_5, int VAR_6, int VAR_7, int VAR_8,

                          int16_t *VAR_9, int16_t *VAR_10, int VAR_11)

{

    

    

    long VAR_12, VAR_13;

    uint16_t *frame_ant = *VAR_4;

    if (!frame_ant) {

        uint8_t *frame_src = VAR_1;

        *VAR_4 = frame_ant = av_malloc(VAR_5*VAR_6*sizeof(uint16_t));

        for (VAR_13 = 0; VAR_13 < VAR_6; VAR_13++, VAR_1 += VAR_7, frame_ant += VAR_5)

            for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++)

                frame_ant[VAR_12] = LOAD(VAR_12);

        VAR_1 = frame_src;

        frame_ant = *VAR_4;

    }



    if (VAR_9[0])

        denoise_spatial(VAR_0, VAR_1, VAR_2, VAR_3, frame_ant,

                        VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11);

    else

        denoise_temporal(VAR_1, VAR_2, frame_ant,

                         VAR_5, VAR_6, VAR_7, VAR_8, VAR_10, VAR_11);

    emms_c();

}

static void FUNC_0(HQDN3DContext *VAR_0,
uint8_t *VAR_1, uint8_t *VAR_2,
uint16_t *VAR_3, uint16_t **VAR_4,
int VAR_5, int VAR_6, int VAR_7, int VAR_8,
int16_t *VAR_9, int16_t *VAR_10, int VAR_11)
{ long VAR_12, VAR_13; uint16_t *frame_ant = *VAR_4; if (!frame_ant) { uint8_t *frame_src = VAR_1; *VAR_4 = frame_ant = av_malloc(VAR_5*VAR_6*sizeof(uint16_t)); for (VAR_13 = 0; VAR_13 < VAR_6; VAR_13++, VAR_1 += VAR_7, frame_ant += VAR_5) for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++) frame_ant[VAR_12] = LOAD(VAR_12); VAR_1 = frame_src; frame_ant = *VAR_4; } if (VAR_9[0])
denoise_spatial(VAR_0, VAR_1, VAR_2, VAR_3, frame_ant,
VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11); else
denoise_temporal(VAR_1, VAR_2, frame_ant,
VAR_5, VAR_6, VAR_7, VAR_8, VAR_10, VAR_11); emms_c(); }