Mercurial > libavcodec.hg
comparison intrax8dsp.c @ 5906:595a2f31430e libavcodec
misc spelling/grammar/wording fixes in comments
author | diego |
---|---|
date | Sat, 10 Nov 2007 11:51:56 +0000 |
parents | a070b05fdbd2 |
children | fbd10e6dfbe1 |
comparison
equal
deleted
inserted
replaced
5905:d5790580ed3e | 5906:595a2f31430e |
---|---|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 */ | 17 */ |
18 | 18 |
19 /** | 19 /** |
20 * @file intrax8dsp.c | 20 * @file intrax8dsp.c |
21 *@brief IntraX8 frame sub-decoder image manipulation routines | 21 *@brief IntraX8 frame subdecoder image manipulation routines |
22 * | |
23 */ | 22 */ |
24 | 23 |
25 #include "dsputil.h" | 24 #include "dsputil.h" |
26 | 25 |
27 /* | 26 /* |
46 #define area4 (8+8+1) | 45 #define area4 (8+8+1) |
47 #define area5 (8+8+1+8) | 46 #define area5 (8+8+1+8) |
48 #define area6 (8+8+1+16) | 47 #define area6 (8+8+1+16) |
49 | 48 |
50 /** | 49 /** |
51 Collect statistics and prepare the edge pixels required by the other spacial compensation functions. | 50 Collect statistics and prepare the edge pixels required by the other spatial compensation functions. |
52 | 51 |
53 * @param src pointer to the beginning of the processed block | 52 * @param src pointer to the beginning of the processed block |
54 * @param dst pointer to emu_edge, edge pixels are stored in way other compensation routines use. | 53 * @param dst pointer to emu_edge, edge pixels are stored the way other compensation routines do. |
55 * @param linesize byte offset between 2 vertical pixels in the source image | 54 * @param linesize byte offset between 2 vertical pixels in the source image |
56 * @param range pointer to the variable where the range of edge pixels is to be stored (max-min values) | 55 * @param range pointer to the variable where the edge pixel range is to be stored (max-min values) |
57 * @param psum pointer to the variable where the sum of edge pixels is to be stored | 56 * @param psum pointer to the variable where the edge pixel sum is to be stored |
58 * @param edges informs this routine that the block is on image border, so it have to interpolate the missing edge pixels. | 57 * @param edges Informs this routine that the block is on an image border, so it has to interpolate the missing edge pixels. |
59 and some of the edge pixels should be interpolated, flag have following meaning: | 58 and some of the edge pixels should be interpolated, the flag has the following meaning: |
60 1 - mb_x==0 - first block in the row, interpolate area #1,#2,#3; | 59 1 - mb_x==0 - first block in the row, interpolate area #1,#2,#3; |
61 2 - mb_y==0 - first row, interpolate area #3,#4,#5,#6; | 60 2 - mb_y==0 - first row, interpolate area #3,#4,#5,#6; |
62 note: 1|2 - mb_x==mb_y==0 - first block, use 0x80 value for all areas; | 61 note: 1|2 - mb_x==mb_y==0 - first block, use 0x80 value for all areas; |
63 4 - mb_x>= (mb_width-1) last block on the row, interpolate area #5; | 62 4 - mb_x>= (mb_width-1) last block in the row, interpolate area #5; |
64 */ | 63 */ |
65 static void x8_setup_spacial_compensation(uint8_t *src, uint8_t *dst, int linesize, | 64 static void x8_setup_spacial_compensation(uint8_t *src, uint8_t *dst, int linesize, |
66 int * range, int * psum, int edges){ | 65 int * range, int * psum, int edges){ |
67 uint8_t * ptr; | 66 uint8_t * ptr; |
68 int sum; | 67 int sum; |
114 }else{ | 113 }else{ |
115 memcpy(dst+area4, ptr, 16);//both area4 and 5 | 114 memcpy(dst+area4, ptr, 16);//both area4 and 5 |
116 } | 115 } |
117 memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block | 116 memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block |
118 } | 117 } |
119 //now calc the stuff we need | 118 //now calculate the stuff we need |
120 if(edges&3){//mb_x==0 || mb_y==0){ | 119 if(edges&3){//mb_x==0 || mb_y==0){ |
121 int avg=(sum+4)>>3; | 120 int avg=(sum+4)>>3; |
122 if(edges&1){ //(mb_x==0) {//implies mb_y!=0 | 121 if(edges&1){ //(mb_x==0) {//implies mb_y!=0 |
123 memset(dst+area1,avg,8+8+1);//areas 1,2 and 3 are averaged | 122 memset(dst+area1,avg,8+8+1);//areas 1,2 and 3 are averaged |
124 }else{//implies y==0 x!=0 | 123 }else{//implies y==0 x!=0 |
125 memset(dst+area3,avg, 1+16+8);//areas 3, 4,5,6 | 124 memset(dst+area3,avg, 1+16+8);//areas 3, 4,5,6 |
126 } | 125 } |
127 sum+=avg*9; | 126 sum+=avg*9; |
128 }else{ | 127 }else{ |
129 uint8_t c=*(src-1-linesize);//the edge pixel,in the top line and left column | 128 uint8_t c=*(src-1-linesize);//the edge pixel, in the top line and left column |
130 dst[area3]=c; | 129 dst[area3]=c; |
131 sum+=c; | 130 sum+=c; |
132 //edge pixel is not part of min/max | 131 //edge pixel is not part of min/max |
133 } | 132 } |
134 (*range) = max_pix - min_pix; | 133 (*range) = max_pix - min_pix; |
342 t= | 341 t= |
343 (FFABS(p1-p2) <= ql) + | 342 (FFABS(p1-p2) <= ql) + |
344 (FFABS(p2-p3) <= ql) + | 343 (FFABS(p2-p3) <= ql) + |
345 (FFABS(p3-p4) <= ql) + | 344 (FFABS(p3-p4) <= ql) + |
346 (FFABS(p4-p5) <= ql); | 345 (FFABS(p4-p5) <= ql); |
347 if(t>0){//you need at least 1 to be able to reach total score of 6. | 346 if(t>0){//You need at least 1 to be able to reach a total score of 6. |
348 t+= | 347 t+= |
349 (FFABS(p5-p6) <= ql) + | 348 (FFABS(p5-p6) <= ql) + |
350 (FFABS(p6-p7) <= ql) + | 349 (FFABS(p6-p7) <= ql) + |
351 (FFABS(p7-p8) <= ql) + | 350 (FFABS(p7-p8) <= ql) + |
352 (FFABS(p8-p9) <= ql) + | 351 (FFABS(p8-p9) <= ql) + |