ivi_dsp.h
Go to the documentation of this file.
1 /*
2  * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
3  *
4  * Copyright (c) 2009-2011 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[in] plane pointer to the descriptor of the plane being processed
39  * @param[out] dst pointer to the destination buffer
40  * @param[in] dst_pitch pitch of the destination buffer
41  */
42 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
43  const int dst_pitch);
44 
45 /**
46  * Haar wavelet recomposition filter for Indeo 4
47  *
48  * @param[in] plane pointer to the descriptor of the plane being processed
49  * @param[out] dst pointer to the destination buffer
50  * @param[in] dst_pitch pitch of the destination buffer
51  */
52 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
53  const int dst_pitch);
54 
55 /**
56  * two-dimensional inverse Haar 8x8 transform for Indeo 4
57  *
58  * @param[in] in pointer to the vector of transform coefficients
59  * @param[out] out pointer to the output buffer (frame)
60  * @param[in] pitch pitch to move to the next y line
61  * @param[in] flags pointer to the array of column flags:
62  * != 0 - non_empty column, 0 - empty one
63  * (this array must be filled by caller)
64  */
65 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
66  const uint8_t *flags);
67 
68 /**
69  * DC-only two-dimensional inverse Haar transform for Indeo 4.
70  * Performing the inverse transform in this case is equivalent to
71  * spreading DC_coeff >> 3 over the whole block.
72  *
73  * @param[in] in pointer to the dc coefficient
74  * @param[out] out pointer to the output buffer (frame)
75  * @param[in] pitch pitch to move to the next y line
76  * @param[in] blk_size transform block size
77  */
78 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
79  int blk_size);
80 
81 /**
82  * two-dimensional inverse slant 8x8 transform
83  *
84  * @param[in] in pointer to the vector of transform coefficients
85  * @param[out] out pointer to the output buffer (frame)
86  * @param[in] pitch pitch to move to the next y line
87  * @param[in] flags pointer to the array of column flags:
88  * != 0 - non_empty column, 0 - empty one
89  * (this array must be filled by caller)
90  */
91 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
92  const uint8_t *flags);
93 
94 /**
95  * two-dimensional inverse slant 4x4 transform
96  *
97  * @param[in] in pointer to the vector of transform coefficients
98  * @param[out] out pointer to the output buffer (frame)
99  * @param[in] pitch pitch to move to the next y line
100  * @param[in] flags pointer to the array of column flags:
101  * != 0 - non_empty column, 0 - empty one
102  * (this array must be filled by caller)
103  */
104 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
105  const uint8_t *flags);
106 
107 /**
108  * DC-only two-dimensional inverse slant transform.
109  * Performing the inverse slant transform in this case is equivalent to
110  * spreading (DC_coeff + 1)/2 over the whole block.
111  * It works much faster than performing the slant transform on a vector of zeroes.
112  *
113  * @param[in] in pointer to the dc coefficient
114  * @param[out] out pointer to the output buffer (frame)
115  * @param[in] pitch pitch to move to the next y line
116  * @param[in] blk_size transform block size
117  */
118 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
119 
120 /**
121  * inverse 1D row slant transform
122  *
123  * @param[in] in pointer to the vector of transform coefficients
124  * @param[out] out pointer to the output buffer (frame)
125  * @param[in] pitch pitch to move to the next y line
126  * @param[in] flags pointer to the array of column flags (unused here)
127  */
128 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
129  const uint8_t *flags);
130 
131 /**
132  * inverse 1D column slant transform
133  *
134  * @param[in] in pointer to the vector of transform coefficients
135  * @param[out] out pointer to the output buffer (frame)
136  * @param[in] pitch pitch to move to the next y line
137  * @param[in] flags pointer to the array of column flags:
138  * != 0 - non_empty column, 0 - empty one
139  * (this array must be filled by caller)
140  */
141 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
142  const uint8_t *flags);
143 
144 /**
145  * DC-only inverse row slant transform
146  */
147 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
148 
149 /**
150  * DC-only inverse column slant transform
151  */
152 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
153 
154 /**
155  * Copy the pixels into the frame buffer.
156  */
157 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
158 
159 /**
160  * Copy the DC coefficient into the first pixel of the block and
161  * zero all others.
162  */
163 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
164 
165 /**
166  * 8x8 block motion compensation with adding delta
167  *
168  * @param[in,out] buf pointer to the block in the current frame buffer containing delta
169  * @param[in] ref_buf pointer to the corresponding block in the reference frame
170  * @param[in] pitch pitch for moving to the next y line
171  * @param[in] mc_type interpolation type
172  */
173 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
174 
175 /**
176  * 4x4 block motion compensation with adding delta
177  *
178  * @param[in,out] buf pointer to the block in the current frame buffer containing delta
179  * @param[in] ref_buf pointer to the corresponding block in the reference frame
180  * @param[in] pitch pitch for moving to the next y line
181  * @param[in] mc_type interpolation type
182  */
183 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
184 
185 /**
186  * motion compensation without adding delta
187  *
188  * @param[in,out] buf pointer to the block in the current frame receiving the result
189  * @param[in] ref_buf pointer to the corresponding block in the reference frame
190  * @param[in] pitch pitch for moving to the next y line
191  * @param[in] mc_type interpolation type
192  */
193 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
194 
195 /**
196  * 4x4 block motion compensation without adding delta
197  *
198  * @param[in,out] buf pointer to the block in the current frame receiving the result
199  * @param[in] ref_buf pointer to the corresponding block in the reference frame
200  * @param[in] pitch pitch for moving to the next y line
201  * @param[in] mc_type interpolation type
202  */
203 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
204 
205 #endif /* AVCODEC_IVI_DSP_H */
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D column slant transform
Definition: ivi_dsp.c:518
void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
Copy the pixels into the frame buffer.
Definition: ivi_dsp.c:559
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
Definition: git-howto.txt:5
void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type)
4x4 block motion compensation with adding delta
void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
Copy the DC coefficient into the first pixel of the block and zero all others.
Definition: ivi_dsp.c:569
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, const int dst_pitch)
5/3 wavelet recomposition filter for Indeo5
Definition: ivi_dsp.c:33
void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 4x4 transform
Definition: ivi_dsp.c:427
uint8_t
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 8x8 transform for Indeo 4
Definition: ivi_dsp.c:268
void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type)
motion compensation without adding delta
void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse row slant transform.
Definition: ivi_dsp.c:500
This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.
int ref_buf
inter frame reference buffer index
Definition: ivi_common.h:220
void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type)
8x8 block motion compensation with adding delta
external API header
void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse column slant transform.
Definition: ivi_dsp.c:545
void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 8x8 transform
Definition: ivi_dsp.c:387
int32_t
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D row slant transform
Definition: ivi_dsp.c:480
void * buf
Definition: avisynth_c.h:594
void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse slant transform.
Definition: ivi_dsp.c:467
void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst, const int dst_pitch)
Haar wavelet recomposition filter for Indeo 4.
Definition: ivi_dsp.c:190
static int flags
Definition: cpu.c:23
void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type)
4x4 block motion compensation without adding delta
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> out
color plane (luma or chroma) information
Definition: ivi_common.h:179
BYTE int dst_pitch
Definition: avisynth_c.h:713
void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse Haar transform for Indeo 4.
Definition: ivi_dsp.c:323