1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * Copyright (C) 2010 David Conrad
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * This file is part of FFmpeg.
5cabdff1aSopenharmony_ci *
6cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
7cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
8cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
9cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
10cabdff1aSopenharmony_ci *
11cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
12cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
13cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14cabdff1aSopenharmony_ci * Lesser General Public License for more details.
15cabdff1aSopenharmony_ci *
16cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
17cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
18cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19cabdff1aSopenharmony_ci */
20cabdff1aSopenharmony_ci
21cabdff1aSopenharmony_ci#ifndef AVCODEC_DIRACDSP_H
22cabdff1aSopenharmony_ci#define AVCODEC_DIRACDSP_H
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#include <stdint.h>
25cabdff1aSopenharmony_ci#include <stddef.h>
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_citypedef void (*dirac_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int h);
28cabdff1aSopenharmony_citypedef void (*dirac_biweight_func)(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, int weightd, int weights, int h);
29cabdff1aSopenharmony_ci
30cabdff1aSopenharmony_citypedef struct {
31cabdff1aSopenharmony_ci    void (*dirac_hpel_filter)(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height);
32cabdff1aSopenharmony_ci    /**
33cabdff1aSopenharmony_ci     * dirac_pixels_tab[width][subpel]
34cabdff1aSopenharmony_ci     * width is 2 for 32, 1 for 16, 0 for 8
35cabdff1aSopenharmony_ci     * subpel is 0 for fpel and hpel (only need to copy from the first plane in src)
36cabdff1aSopenharmony_ci     *           1 if an average of the first 2 planes is needed (TODO: worth it?)
37cabdff1aSopenharmony_ci     *           2 for general qpel (avg of 4)
38cabdff1aSopenharmony_ci     *           3 for general epel (biweight of 4 using the weights in src[4])
39cabdff1aSopenharmony_ci     * src[0-3] is each of the hpel planes
40cabdff1aSopenharmony_ci     * src[4] is the 1/8 pel weights if needed
41cabdff1aSopenharmony_ci     */
42cabdff1aSopenharmony_ci    void (*put_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h);
43cabdff1aSopenharmony_ci    void (*avg_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h);
44cabdff1aSopenharmony_ci
45cabdff1aSopenharmony_ci    void (*put_signed_rect_clamped[3])(uint8_t *dst/*align 16*/, int dst_stride, const uint8_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/);
46cabdff1aSopenharmony_ci    void (*put_rect_clamped)(uint8_t *dst/*align 16*/, int dst_stride, const uint8_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/);
47cabdff1aSopenharmony_ci    void (*add_rect_clamped)(uint8_t *dst/*align 16*/, const uint16_t *src/*align 16*/, int stride, const int16_t *idwt/*align 16*/, int idwt_stride, int width, int height/*mod 2*/);
48cabdff1aSopenharmony_ci    void (*add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen);
49cabdff1aSopenharmony_ci
50cabdff1aSopenharmony_ci    /* 0-1: int16_t and int32_t asm/c, 2-3: int16 and int32_t, C only */
51cabdff1aSopenharmony_ci    void (*dequant_subband[4])(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h);
52cabdff1aSopenharmony_ci
53cabdff1aSopenharmony_ci    dirac_weight_func weight_dirac_pixels_tab[3];
54cabdff1aSopenharmony_ci    dirac_biweight_func biweight_dirac_pixels_tab[3];
55cabdff1aSopenharmony_ci} DiracDSPContext;
56cabdff1aSopenharmony_ci
57cabdff1aSopenharmony_ci#define DECL_DIRAC_PIXOP(PFX, EXT)                                      \
58cabdff1aSopenharmony_ci    void ff_ ## PFX ## _dirac_pixels8_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
59cabdff1aSopenharmony_ci    void ff_ ## PFX ## _dirac_pixels16_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
60cabdff1aSopenharmony_ci    void ff_ ## PFX ## _dirac_pixels32_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h)
61cabdff1aSopenharmony_ci
62cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(put, c);
63cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(avg, c);
64cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(put, l2_c);
65cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(avg, l2_c);
66cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(put, l4_c);
67cabdff1aSopenharmony_ciDECL_DIRAC_PIXOP(avg, l4_c);
68cabdff1aSopenharmony_ci
69cabdff1aSopenharmony_civoid ff_diracdsp_init(DiracDSPContext *c);
70cabdff1aSopenharmony_civoid ff_diracdsp_init_x86(DiracDSPContext* c);
71cabdff1aSopenharmony_ci
72cabdff1aSopenharmony_ci#endif /* AVCODEC_DIRACDSP_H */
73