mc.h 5.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/*
 * Copyright © 2018, VideoLAN and dav1d authors
 * Copyright © 2018, Two Orioles, LLC
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __DAV1D_SRC_MC_H__
#define __DAV1D_SRC_MC_H__

#include <stdint.h>
#include <stddef.h>

#include "common/bitdepth.h"

#include "src/levels.h"

#define decl_mc_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
            const pixel *src, ptrdiff_t src_stride, \
            int w, int h, int mx, int my)
typedef decl_mc_fn(*mc_fn);

44 45 46 47 48 49
#define decl_mc_scaled_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
            const pixel *src, ptrdiff_t src_stride, \
            int w, int h, int mx, int my, int dx, int dy)
typedef decl_mc_scaled_fn(*mc_scaled_fn);

50 51 52 53 54 55 56
#define decl_warp8x8_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
            const pixel *src, ptrdiff_t src_stride, \
            const int16_t *abcd, int mx, int my)
typedef decl_warp8x8_fn(*warp8x8_fn);

#define decl_mct_fn(name) \
57
void (name)(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, \
58 59 60
            int w, int h, int mx, int my)
typedef decl_mct_fn(*mct_fn);

61
#define decl_mct_scaled_fn(name) \
62
void (name)(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, \
63 64 65
            int w, int h, int mx, int my, int dx, int dy)
typedef decl_mct_scaled_fn(*mct_scaled_fn);

66
#define decl_warp8x8t_fn(name) \
67
void (name)(int16_t *tmp, const ptrdiff_t tmp_stride, \
68 69 70 71 72 73
            const pixel *src, ptrdiff_t src_stride, \
            const int16_t *abcd, int mx, int my)
typedef decl_warp8x8t_fn(*warp8x8t_fn);

#define decl_avg_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
74
            const int16_t *tmp1, const int16_t *tmp2, int w, int h)
75 76 77 78
typedef decl_avg_fn(*avg_fn);

#define decl_w_avg_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
79
            const int16_t *tmp1, const int16_t *tmp2, int w, int h, int weight)
80 81 82 83
typedef decl_w_avg_fn(*w_avg_fn);

#define decl_mask_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
84
            const int16_t *tmp1, const int16_t *tmp2, int w, int h, \
85 86 87 88 89
            const uint8_t *mask)
typedef decl_mask_fn(*mask_fn);

#define decl_w_mask_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
90
            const int16_t *tmp1, const int16_t *tmp2, int w, int h, \
91 92 93 94
            uint8_t *mask, int sign)
typedef decl_w_mask_fn(*w_mask_fn);

#define decl_blend_fn(name) \
Henrik Gramner's avatar
Henrik Gramner committed
95 96
void (name)(pixel *dst, ptrdiff_t dst_stride, const pixel *tmp, \
            int w, int h, const uint8_t *mask)
97 98
typedef decl_blend_fn(*blend_fn);

Henrik Gramner's avatar
Henrik Gramner committed
99 100 101 102
#define decl_blend_dir_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, const pixel *tmp, int w, int h)
typedef decl_blend_dir_fn(*blend_dir_fn);

103
#define decl_emu_edge_fn(name) \
104 105
void (name)(intptr_t bw, intptr_t bh, intptr_t iw, intptr_t ih, intptr_t x, intptr_t y, \
            pixel *dst, ptrdiff_t dst_stride, const pixel *src, ptrdiff_t src_stride)
106 107
typedef decl_emu_edge_fn(*emu_edge_fn);

108 109 110 111 112 113
#define decl_resize_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
            const pixel *src, ptrdiff_t src_stride, \
            int dst_w, int src_w, int h, int dx, int mx)
typedef decl_resize_fn(*resize_fn);

114 115
typedef struct Dav1dMCDSPContext {
    mc_fn mc[N_2D_FILTERS];
116
    mc_scaled_fn mc_scaled[N_2D_FILTERS];
117
    mct_fn mct[N_2D_FILTERS];
118
    mct_scaled_fn mct_scaled[N_2D_FILTERS];
119 120 121 122 123
    avg_fn avg;
    w_avg_fn w_avg;
    mask_fn mask;
    w_mask_fn w_mask[3 /* 444, 422, 420 */];
    blend_fn blend;
Henrik Gramner's avatar
Henrik Gramner committed
124 125
    blend_dir_fn blend_v;
    blend_dir_fn blend_h;
126 127
    warp8x8_fn warp8x8;
    warp8x8t_fn warp8x8t;
128
    emu_edge_fn emu_edge;
129
    resize_fn resize;
130 131 132 133 134
} Dav1dMCDSPContext;

void dav1d_mc_dsp_init_8bpc(Dav1dMCDSPContext *c);
void dav1d_mc_dsp_init_10bpc(Dav1dMCDSPContext *c);

135 136 137
void dav1d_mc_dsp_init_arm_8bpc(Dav1dMCDSPContext *c);
void dav1d_mc_dsp_init_arm_10bpc(Dav1dMCDSPContext *c);

Henrik Gramner's avatar
Henrik Gramner committed
138 139 140
void dav1d_mc_dsp_init_x86_8bpc(Dav1dMCDSPContext *c);
void dav1d_mc_dsp_init_x86_10bpc(Dav1dMCDSPContext *c);

141
#endif /* __DAV1D_SRC_MC_H__ */