Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 1 | /* |
| 2 | * VC-1 and WMV3 decoder - DSP functions |
| 3 | * Copyright (c) 2006 Konstantin Shishkov |
| 4 | * |
| 5 | * This file is part of FFmpeg. |
| 6 | * |
| 7 | * FFmpeg is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * FFmpeg is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with FFmpeg; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * @file |
| 24 | * VC-1 and WMV3 decoder |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 25 | */ |
| 26 | |
| 27 | #ifndef AVCODEC_VC1DSP_H |
| 28 | #define AVCODEC_VC1DSP_H |
| 29 | |
Ronald S. Bultje | 54cd5e4 | 2013-03-10 21:23:46 | [diff] [blame] | 30 | #include "hpeldsp.h" |
Diego Biurrun | 79dad2a | 2013-01-19 02:34:47 | [diff] [blame] | 31 | #include "h264chroma.h" |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 32 | |
Michael Niedermayer | 019b378 | 2013-03-13 13:31:39 | [diff] [blame] | 33 | typedef void (*vc1op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, ptrdiff_t line_size, int h); |
Michael Niedermayer | 0ddca7d | 2013-02-06 12:16:31 | [diff] [blame] | 34 | |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 35 | typedef struct VC1DSPContext { |
| 36 | /* vc1 functions */ |
Diego Biurrun | 88bd7fd | 2013-01-20 00:02:29 | [diff] [blame] | 37 | void (*vc1_inv_trans_8x8)(int16_t *b); |
Diego Biurrun | 2ec9fa5 | 2016-09-07 15:02:06 | [diff] [blame] | 38 | void (*vc1_inv_trans_8x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 39 | void (*vc1_inv_trans_4x8)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 40 | void (*vc1_inv_trans_4x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 41 | void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 42 | void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 43 | void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
| 44 | void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block); |
Martin Storsjö | db54426 | 2022-03-29 12:34:19 | [diff] [blame] | 45 | void (*vc1_v_overlap)(uint8_t *src, ptrdiff_t stride); |
| 46 | void (*vc1_h_overlap)(uint8_t *src, ptrdiff_t stride); |
Diego Biurrun | 88bd7fd | 2013-01-20 00:02:29 | [diff] [blame] | 47 | void (*vc1_v_s_overlap)(int16_t *top, int16_t *bottom); |
Martin Storsjö | db54426 | 2022-03-29 12:34:19 | [diff] [blame] | 48 | void (*vc1_h_s_overlap)(int16_t *left, int16_t *right, ptrdiff_t left_stride, ptrdiff_t right_stride, int flags); |
| 49 | void (*vc1_v_loop_filter4)(uint8_t *src, ptrdiff_t stride, int pq); |
| 50 | void (*vc1_h_loop_filter4)(uint8_t *src, ptrdiff_t stride, int pq); |
| 51 | void (*vc1_v_loop_filter8)(uint8_t *src, ptrdiff_t stride, int pq); |
| 52 | void (*vc1_h_loop_filter8)(uint8_t *src, ptrdiff_t stride, int pq); |
| 53 | void (*vc1_v_loop_filter16)(uint8_t *src, ptrdiff_t stride, int pq); |
| 54 | void (*vc1_h_loop_filter16)(uint8_t *src, ptrdiff_t stride, int pq); |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 55 | |
| 56 | /* put 8x8 block with bicubic interpolation and quarterpel precision |
| 57 | * last argument is actually round value instead of height |
| 58 | */ |
Christophe Gisquet | 319235c | 2014-04-11 19:02:08 | [diff] [blame] | 59 | vc1op_pixels_func put_vc1_mspel_pixels_tab[2][16]; |
| 60 | vc1op_pixels_func avg_vc1_mspel_pixels_tab[2][16]; |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 61 | |
| 62 | /* This is really one func used in VC-1 decoding */ |
| 63 | h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; |
| 64 | h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]; |
Alberto Delmás | 45ecda8 | 2011-08-17 12:24:42 | [diff] [blame] | 65 | |
| 66 | /* Windows Media Image functions */ |
| 67 | void (*sprite_h)(uint8_t *dst, const uint8_t *src, int offset, int advance, int count); |
| 68 | void (*sprite_v_single)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset, int width); |
| 69 | void (*sprite_v_double_noscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src2a, int alpha, int width); |
| 70 | void (*sprite_v_double_onescale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1, |
| 71 | const uint8_t *src2a, int alpha, int width); |
| 72 | void (*sprite_v_double_twoscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1, |
| 73 | const uint8_t *src2a, const uint8_t *src2b, int offset2, |
| 74 | int alpha, int width); |
Ben Avison | 9d8ecdd | 2014-04-16 00:51:32 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Search buf from the start for up to size bytes. Return the index |
| 78 | * of a zero byte, or >= size if not found. Ideally, use lookahead |
| 79 | * to filter out any zero bytes that are known to not be followed by |
| 80 | * one or more further zero bytes and a one byte. |
| 81 | */ |
Ben Avison | adf8227 | 2014-07-21 13:53:08 | [diff] [blame] | 82 | int (*startcode_find_candidate)(const uint8_t *buf, int size); |
Ben Avison | 2e26847 | 2022-03-31 17:23:45 | [diff] [blame] | 83 | |
| 84 | /* Copy a buffer, removing startcode emulation escape bytes as we go */ |
| 85 | int (*vc1_unescape_buffer)(const uint8_t *src, int size, uint8_t *dst); |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 86 | } VC1DSPContext; |
| 87 | |
| 88 | void ff_vc1dsp_init(VC1DSPContext* c); |
Janne Grunau | 7161788 | 2013-12-10 19:16:08 | [diff] [blame] | 89 | void ff_vc1dsp_init_aarch64(VC1DSPContext* dsp); |
Mason Carter | 832e190 | 2013-12-15 01:32:56 | [diff] [blame] | 90 | void ff_vc1dsp_init_arm(VC1DSPContext* dsp); |
Diego Biurrun | 3828214 | 2013-04-14 12:47:30 | [diff] [blame] | 91 | void ff_vc1dsp_init_ppc(VC1DSPContext *c); |
sunyuechi | 0b9d009 | 2023-12-01 02:07:40 | [diff] [blame] | 92 | void ff_vc1dsp_init_riscv(VC1DSPContext *c); |
Janne Grunau | 7e52285 | 2012-10-07 15:41:10 | [diff] [blame] | 93 | void ff_vc1dsp_init_x86(VC1DSPContext* dsp); |
Zhou Xiaoyong | 5b74ebe | 2016-10-10 08:11:37 | [diff] [blame] | 94 | void ff_vc1dsp_init_mips(VC1DSPContext* dsp); |
Hao Chen | 60ead5c | 2021-12-18 14:27:57 | [diff] [blame] | 95 | void ff_vc1dsp_init_loongarch(VC1DSPContext* dsp); |
Ronald S. Bultje | 9a1ced3 | 2011-02-17 19:45:03 | [diff] [blame] | 96 | |
| 97 | #endif /* AVCODEC_VC1DSP_H */ |