1/*
2 * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
3 *
4 * Copyright (c) 2009 Maxim Poliakovski
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23/**
24 * @file
25 * DSP functions (inverse transforms, motion compensations, wavelet recompostion)
26 * for Indeo Video Interactive codecs.
27 */
28
29#ifndef AVCODEC_IVI_DSP_H
30#define AVCODEC_IVI_DSP_H
31
32#include "avcodec.h"
33#include "ivi_common.h"
34
35/**
36 *  5/3 wavelet recomposition filter for Indeo5
37 *
38 *  @param plane        [in]  pointer to the descriptor of the plane being processed
39 *  @param dst          [out] pointer to the destination buffer
40 *  @param dst_pitch    [in]  pitch of the destination buffer
41 *  @param num_bands    [in]  number of wavelet bands to be processed
42 */
43void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
44                        const int dst_pitch, const int num_bands);
45
46/**
47 *  two-dimensional inverse slant 8x8 transform
48 *
49 *  @param  in      [in]  pointer to the vector of transform coefficients
50 *  @param  out     [out] pointer to the output buffer (frame)
51 *  @param  pitch   [in]  pitch to move to the next y line
52 *  @param  flags   [in]  pointer to the array of column flags:
53 *                        != 0 - non_empty column, 0 - empty one
54 *                        (this array must be filled by caller)
55 */
56void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
57                              const uint8_t *flags);
58
59/**
60 *  two-dimensional inverse slant 4x4 transform
61 *
62 *  @param  in      [in]  pointer to the vector of transform coefficients
63 *  @param  out     [out] pointer to the output buffer (frame)
64 *  @param  pitch   [in]  pitch to move to the next y line
65 *  @param  flags   [in]  pointer to the array of column flags:
66 *                        != 0 - non_empty column, 0 - empty one
67 *                        (this array must be filled by caller)
68 */
69void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
70                              const uint8_t *flags);
71
72/**
73 *  DC-only two-dimensional inverse slant transform.
74 *  Performing the inverse slant transform in this case is equivalent to
75 *  spreading (DC_coeff + 1)/2 over the whole block.
76 *  It works much faster than performing the slant transform on a vector of zeroes.
77 *
78 *  @param  in          [in]  pointer to the dc coefficient
79 *  @param  out         [out] pointer to the output buffer (frame)
80 *  @param  pitch       [in]  pitch to move to the next y line
81 *  @param  blk_size    [in]  transform block size
82 */
83void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
84
85/**
86 *  inverse 1D row slant transform
87 *
88 *  @param  in      [in]  pointer to the vector of transform coefficients
89 *  @param  out     [out] pointer to the output buffer (frame)
90 *  @param  pitch   [in]  pitch to move to the next y line
91 *  @param  flags   [in]  pointer to the array of column flags (unused here)
92 */
93void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
94                       const uint8_t *flags);
95
96/**
97 *  inverse 1D column slant transform
98 *
99 *  @param  in      [in]  pointer to the vector of transform coefficients
100 *  @param  out     [out] pointer to the output buffer (frame)
101 *  @param  pitch   [in]  pitch to move to the next y line
102 *  @param  flags   [in]  pointer to the array of column flags:
103 *                        != 0 - non_empty column, 0 - empty one
104 *                        (this array must be filled by caller)
105 */
106void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
107                       const uint8_t *flags);
108
109/**
110 *  DC-only inverse row slant transform
111 */
112void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
113
114/**
115 *  DC-only inverse column slant transform
116 */
117void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
118
119/**
120 *  Copies the pixels into the frame buffer.
121 */
122void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
123
124/**
125 *  Copies the DC coefficient into the first pixel of the block and
126 *  zeroes all others.
127 */
128void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
129
130/**
131 *  8x8 block motion compensation with adding delta
132 *
133 *  @param  buf     [in,out] pointer to the block in the current frame buffer containing delta
134 *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
135 *  @param  pitch   [in]     pitch for moving to the next y line
136 *  @param  mc_type [in]     interpolation type
137 */
138void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
139
140/**
141 *  4x4 block motion compensation with adding delta
142 *
143 *  @param  buf     [in,out] pointer to the block in the current frame buffer containing delta
144 *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
145 *  @param  pitch   [in]     pitch for moving to the next y line
146 *  @param  mc_type [in]     interpolation type
147 */
148void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
149
150/**
151 *  motion compensation without adding delta
152 *
153 *  @param  buf     [in,out] pointer to the block in the current frame receiving the result
154 *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
155 *  @param  pitch   [in]     pitch for moving to the next y line
156 *  @param  mc_type [in]     interpolation type
157 */
158void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
159
160/**
161 *  4x4 block motion compensation without adding delta
162 *
163 *  @param  buf     [in,out] pointer to the block in the current frame receiving the result
164 *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
165 *  @param  pitch   [in]     pitch for moving to the next y line
166 *  @param  mc_type [in]     interpolation type
167 */
168void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
169
170#endif /* AVCODEC_IVI_DSP_H */
171