FFmpeg
h264idct_template.c
Go to the documentation of this file.
1 /*
2  * H.264 IDCT
3  * Copyright (c) 2004-2011 Michael Niedermayer <michaelni@gmx.at>
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  * H.264 IDCT.
25  * @author Michael Niedermayer <michaelni@gmx.at>
26  */
27 
28 #include "bit_depth_template.c"
29 #include "libavutil/common.h"
30 #include "h264dec.h"
31 #include "h264idct.h"
32 
33 void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)
34 {
35  int i;
36  pixel *dst = (pixel*)_dst;
37  dctcoef *block = (dctcoef*)_block;
38  stride >>= sizeof(pixel)-1;
39 
40  block[0] += 1 << 5;
41 
42  for(i=0; i<4; i++){
43  const SUINT z0= block[i + 4*0] + (unsigned)block[i + 4*2];
44  const SUINT z1= block[i + 4*0] - (unsigned)block[i + 4*2];
45  const SUINT z2= (block[i + 4*1]>>1) - (unsigned)block[i + 4*3];
46  const SUINT z3= block[i + 4*1] + (unsigned)(block[i + 4*3]>>1);
47 
48  block[i + 4*0]= z0 + z3;
49  block[i + 4*1]= z1 + z2;
50  block[i + 4*2]= z1 - z2;
51  block[i + 4*3]= z0 - z3;
52  }
53 
54  for(i=0; i<4; i++){
55  const SUINT z0= block[0 + 4*i] + (SUINT)block[2 + 4*i];
56  const SUINT z1= block[0 + 4*i] - (SUINT)block[2 + 4*i];
57  const SUINT z2= (block[1 + 4*i]>>1) - (SUINT)block[3 + 4*i];
58  const SUINT z3= block[1 + 4*i] + (SUINT)(block[3 + 4*i]>>1);
59 
60  dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((int)(z0 + z3) >> 6));
61  dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((int)(z1 + z2) >> 6));
62  dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((int)(z1 - z2) >> 6));
63  dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((int)(z0 - z3) >> 6));
64  }
65 
66  memset(block, 0, 16 * sizeof(dctcoef));
67 }
68 
69 void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
70  int i;
71  pixel *dst = (pixel*)_dst;
72  dctcoef *block = (dctcoef*)_block;
73  stride >>= sizeof(pixel)-1;
74 
75  block[0] += 32;
76 
77  for( i = 0; i < 8; i++ )
78  {
79  const unsigned int a0 = block[i+0*8] + (unsigned)block[i+4*8];
80  const unsigned int a2 = block[i+0*8] - (unsigned)block[i+4*8];
81  const unsigned int a4 = (block[i+2*8]>>1) - (unsigned)block[i+6*8];
82  const unsigned int a6 = (block[i+6*8]>>1) + (unsigned)block[i+2*8];
83 
84  const unsigned int b0 = a0 + a6;
85  const unsigned int b2 = a2 + a4;
86  const unsigned int b4 = a2 - a4;
87  const unsigned int b6 = a0 - a6;
88 
89  const int a1 = -block[i+3*8] + (unsigned)block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
90  const int a3 = block[i+1*8] + (unsigned)block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
91  const int a5 = -block[i+1*8] + (unsigned)block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
92  const int a7 = block[i+3*8] + (unsigned)block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
93 
94  const int b1 = (a7>>2) + (unsigned)a1;
95  const int b3 = (unsigned)a3 + (a5>>2);
96  const int b5 = (a3>>2) - (unsigned)a5;
97  const int b7 = (unsigned)a7 - (a1>>2);
98 
99  block[i+0*8] = b0 + b7;
100  block[i+7*8] = b0 - b7;
101  block[i+1*8] = b2 + b5;
102  block[i+6*8] = b2 - b5;
103  block[i+2*8] = b4 + b3;
104  block[i+5*8] = b4 - b3;
105  block[i+3*8] = b6 + b1;
106  block[i+4*8] = b6 - b1;
107  }
108  for( i = 0; i < 8; i++ )
109  {
110  const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8];
111  const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8];
112  const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8];
113  const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8];
114 
115  const unsigned b0 = a0 + a6;
116  const unsigned b2 = a2 + a4;
117  const unsigned b4 = a2 - a4;
118  const unsigned b6 = a0 - a6;
119 
120  const int a1 = -(unsigned)block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
121  const int a3 = (unsigned)block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
122  const int a5 = -(unsigned)block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
123  const int a7 = (unsigned)block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
124 
125  const unsigned b1 = (a7>>2) + (unsigned)a1;
126  const unsigned b3 = (unsigned)a3 + (a5>>2);
127  const unsigned b5 = (a3>>2) - (unsigned)a5;
128  const unsigned b7 = (unsigned)a7 - (a1>>2);
129 
130  dst[i + 0*stride] = av_clip_pixel( dst[i + 0*stride] + ((int)(b0 + b7) >> 6) );
131  dst[i + 1*stride] = av_clip_pixel( dst[i + 1*stride] + ((int)(b2 + b5) >> 6) );
132  dst[i + 2*stride] = av_clip_pixel( dst[i + 2*stride] + ((int)(b4 + b3) >> 6) );
133  dst[i + 3*stride] = av_clip_pixel( dst[i + 3*stride] + ((int)(b6 + b1) >> 6) );
134  dst[i + 4*stride] = av_clip_pixel( dst[i + 4*stride] + ((int)(b6 - b1) >> 6) );
135  dst[i + 5*stride] = av_clip_pixel( dst[i + 5*stride] + ((int)(b4 - b3) >> 6) );
136  dst[i + 6*stride] = av_clip_pixel( dst[i + 6*stride] + ((int)(b2 - b5) >> 6) );
137  dst[i + 7*stride] = av_clip_pixel( dst[i + 7*stride] + ((int)(b0 - b7) >> 6) );
138  }
139 
140  memset(block, 0, 64 * sizeof(dctcoef));
141 }
142 
143 // assumes all AC coefs are 0
144 void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, int stride){
145  int i, j;
146  pixel *dst = (pixel*)_dst;
147  dctcoef *block = (dctcoef*)_block;
148  int dc = (block[0] + 32) >> 6;
149  stride /= sizeof(pixel);
150  block[0] = 0;
151  for( j = 0; j < 4; j++ )
152  {
153  for( i = 0; i < 4; i++ )
154  dst[i] = av_clip_pixel( dst[i] + dc );
155  dst += stride;
156  }
157 }
158 
159 void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int stride){
160  int i, j;
161  pixel *dst = (pixel*)_dst;
162  dctcoef *block = (dctcoef*)_block;
163  int dc = (block[0] + 32) >> 6;
164  block[0] = 0;
165  stride /= sizeof(pixel);
166  for( j = 0; j < 8; j++ )
167  {
168  for( i = 0; i < 8; i++ )
169  dst[i] = av_clip_pixel( dst[i] + dc );
170  dst += stride;
171  }
172 }
173 
174 void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
175  int i;
176  for(i=0; i<16; i++){
177  int nnz = nnzc[ scan8[i] ];
178  if(nnz){
179  if(nnz==1 && ((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
180  else FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
181  }
182  }
183 }
184 
185 void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
186  int i;
187  for(i=0; i<16; i++){
188  if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
189  else if(((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
190  }
191 }
192 
193 void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
194  int i;
195  for(i=0; i<16; i+=4){
196  int nnz = nnzc[ scan8[i] ];
197  if(nnz){
198  if(nnz==1 && ((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct8_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
199  else FUNCC(ff_h264_idct8_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
200  }
201  }
202 }
203 
204 void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
205  int i, j;
206  for(j=1; j<3; j++){
207  for(i=j*16; i<j*16+4; i++){
208  if(nnzc[ scan8[i] ])
209  FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride);
210  else if(((dctcoef*)block)[i*16])
211  FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride);
212  }
213  }
214 }
215 
216 void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
217  int i, j;
218 
219  for(j=1; j<3; j++){
220  for(i=j*16; i<j*16+4; i++){
221  if(nnzc[ scan8[i] ])
222  FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride);
223  else if(((dctcoef*)block)[i*16])
224  FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride);
225  }
226  }
227 
228  for(j=1; j<3; j++){
229  for(i=j*16+4; i<j*16+8; i++){
230  if(nnzc[ scan8[i+4] ])
231  FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i+4], block + i*16*sizeof(pixel), stride);
232  else if(((dctcoef*)block)[i*16])
233  FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i+4], block + i*16*sizeof(pixel), stride);
234  }
235  }
236 }
237 
238 /**
239  * IDCT transforms the 16 dc values and dequantizes them.
240  * @param qmul quantization parameter
241  */
242 void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul){
243 #define stride 16
244  int i;
245  int temp[16];
246  static const uint8_t x_offset[4]={0, 2*stride, 8*stride, 10*stride};
247  dctcoef *input = (dctcoef*)_input;
248  dctcoef *output = (dctcoef*)_output;
249 
250  for(i=0; i<4; i++){
251  const int z0= input[4*i+0] + input[4*i+1];
252  const int z1= input[4*i+0] - input[4*i+1];
253  const int z2= input[4*i+2] - input[4*i+3];
254  const int z3= input[4*i+2] + input[4*i+3];
255 
256  temp[4*i+0]= z0+z3;
257  temp[4*i+1]= z0-z3;
258  temp[4*i+2]= z1-z2;
259  temp[4*i+3]= z1+z2;
260  }
261 
262  for(i=0; i<4; i++){
263  const int offset= x_offset[i];
264  const SUINT z0= temp[4*0+i] + temp[4*2+i];
265  const SUINT z1= temp[4*0+i] - temp[4*2+i];
266  const SUINT z2= temp[4*1+i] - temp[4*3+i];
267  const SUINT z3= temp[4*1+i] + temp[4*3+i];
268 
269  output[stride* 0+offset]= (int)((z0 + z3)*qmul + 128 ) >> 8;
270  output[stride* 1+offset]= (int)((z1 + z2)*qmul + 128 ) >> 8;
271  output[stride* 4+offset]= (int)((z1 - z2)*qmul + 128 ) >> 8;
272  output[stride* 5+offset]= (int)((z0 - z3)*qmul + 128 ) >> 8;
273  }
274 #undef stride
275 }
276 
277 void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){
278  const int stride= 16*2;
279  const int xStride= 16;
280  int i;
281  unsigned temp[8];
282  static const uint8_t x_offset[2]={0, 16};
283  dctcoef *block = (dctcoef*)_block;
284 
285  for(i=0; i<4; i++){
286  temp[2*i+0] = block[stride*i + xStride*0] + (unsigned)block[stride*i + xStride*1];
287  temp[2*i+1] = block[stride*i + xStride*0] - (unsigned)block[stride*i + xStride*1];
288  }
289 
290  for(i=0; i<2; i++){
291  const int offset= x_offset[i];
292  const SUINT z0= temp[2*0+i] + temp[2*2+i];
293  const SUINT z1= temp[2*0+i] - temp[2*2+i];
294  const SUINT z2= temp[2*1+i] - temp[2*3+i];
295  const SUINT z3= temp[2*1+i] + temp[2*3+i];
296 
297  block[stride*0+offset]= (int)((z0 + z3)*qmul + 128) >> 8;
298  block[stride*1+offset]= (int)((z1 + z2)*qmul + 128) >> 8;
299  block[stride*2+offset]= (int)((z1 - z2)*qmul + 128) >> 8;
300  block[stride*3+offset]= (int)((z0 - z3)*qmul + 128) >> 8;
301  }
302 }
303 
304 void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){
305  const int stride= 16*2;
306  const int xStride= 16;
307  SUINT a,b,c,d,e;
308  dctcoef *block = (dctcoef*)_block;
309 
310  a= block[stride*0 + xStride*0];
311  b= block[stride*0 + xStride*1];
312  c= block[stride*1 + xStride*0];
313  d= block[stride*1 + xStride*1];
314 
315  e= a-b;
316  a= a+b;
317  b= c-d;
318  c= c+d;
319 
320  block[stride*0 + xStride*0]= (int)((a+c)*qmul) >> 7;
321  block[stride*0 + xStride*1]= (int)((e+b)*qmul) >> 7;
322  block[stride*1 + xStride*0]= (int)((a-c)*qmul) >> 7;
323  block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7;
324 }
stride
#define stride
ff_h264_idct_add16intra
void FUNCC() ff_h264_idct_add16intra(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264idct_template.c:185
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
b
#define b
Definition: input.c:41
ff_h264_idct_dc_add
void FUNCC() ff_h264_idct_dc_add(uint8_t *_dst, int16_t *_block, int stride)
Definition: h264idct_template.c:144
b1
static double b1(void *priv, double x, double y)
Definition: vf_xfade.c:1332
dctcoef
#define dctcoef
Definition: bit_depth_template.c:84
ff_h264_idct8_dc_add
void FUNCC() ff_h264_idct8_dc_add(uint8_t *_dst, int16_t *_block, int stride)
Definition: h264idct_template.c:159
a1
#define a1
Definition: regdef.h:47
b3
static double b3(void *priv, double x, double y)
Definition: vf_xfade.c:1334
a4
#define a4
Definition: regdef.h:50
h264idct.h
pixel
uint8_t pixel
Definition: tiny_ssim.c:42
ff_h264_chroma_dc_dequant_idct
void FUNCC() ff_h264_chroma_dc_dequant_idct(int16_t *_block, int qmul)
Definition: h264idct_template.c:304
bit_depth_template.c
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
FUNCC
#define FUNCC(a)
Definition: bit_depth_template.c:105
ff_h264_idct_add8_422
void FUNCC() ff_h264_idct_add8_422(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264idct_template.c:216
dc
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
Definition: snow.txt:400
b2
static double b2(void *priv, double x, double y)
Definition: vf_xfade.c:1333
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
a0
#define a0
Definition: regdef.h:46
input
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
Definition: filter_design.txt:172
h264dec.h
ff_h264_luma_dc_dequant_idct
void FUNCC() ff_h264_luma_dc_dequant_idct(int16_t *_output, int16_t *_input, int qmul)
IDCT transforms the 16 dc values and dequantizes them.
Definition: h264idct_template.c:242
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
ff_h264_idct_add8
void FUNCC() ff_h264_idct_add8(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264idct_template.c:204
a2
#define a2
Definition: regdef.h:48
common.h
SUINT
#define SUINT
Definition: dct32_template.c:30
uint8_t
uint8_t
Definition: audio_convert.c:194
ff_h264_idct8_add4
void FUNCC() ff_h264_idct8_add4(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264idct_template.c:193
av_clip_pixel
#define av_clip_pixel(a)
Definition: bit_depth_template.c:98
a5
#define a5
Definition: regdef.h:51
ff_h264_idct_add
void FUNCC() ff_h264_idct_add(uint8_t *_dst, int16_t *_block, int stride)
Definition: h264idct_template.c:33
scan8
static const uint8_t scan8[16 *3+3]
Definition: h264dec.h:650
temp
else temp
Definition: vf_mcdeint.c:256
ff_h264_idct_add16
void FUNCC() ff_h264_idct_add16(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264idct_template.c:174
ff_h264_chroma422_dc_dequant_idct
void FUNCC() ff_h264_chroma422_dc_dequant_idct(int16_t *_block, int qmul)
Definition: h264idct_template.c:277
ff_h264_idct8_add
void FUNCC() ff_h264_idct8_add(uint8_t *_dst, int16_t *_block, int stride)
Definition: h264idct_template.c:69
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
b0
static double b0(void *priv, double x, double y)
Definition: vf_xfade.c:1331
int
int
Definition: ffmpeg_filter.c:192
a3
#define a3
Definition: regdef.h:49