Mercurial > libavcodec.hg
comparison libpostproc/postprocess.c @ 1157:57fe9c4e0c6e libavcodec
fixing cliping of c deinterlacers
5 tap lowpass deinterlacer
| author | michaelni |
|---|---|
| date | Sat, 29 Mar 2003 13:31:12 +0000 |
| parents | 3644e555a20a |
| children | 2e06398e4647 |
comparison
equal
deleted
inserted
replaced
| 1156:48efa413ac81 | 1157:57fe9c4e0c6e |
|---|---|
| 111 static uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL; | 111 static uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL; |
| 112 static uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL; | 112 static uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL; |
| 113 static uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL; | 113 static uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL; |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 | |
| 117 static uint8_t clip_table[3*256]; | |
| 118 static uint8_t * const clip_tab= clip_table + 256; | |
| 119 | |
| 116 static int verbose= 0; | 120 static int verbose= 0; |
| 117 | 121 |
| 118 static const int deringThreshold= 20; | 122 static const int deringThreshold= 20; |
| 119 | 123 |
| 120 | 124 |
| 131 {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER}, | 135 {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER}, |
| 132 {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER}, | 136 {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER}, |
| 133 {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER}, | 137 {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER}, |
| 134 {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER}, | 138 {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER}, |
| 135 {"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER}, | 139 {"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER}, |
| 140 {"l5", "lowpass5", 1, 1, 4, LOWPASS5_DEINT_FILTER}, | |
| 136 {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER}, | 141 {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER}, |
| 137 {"fq", "forcequant", 1, 0, 0, FORCE_QUANT}, | 142 {"fq", "forcequant", 1, 0, 0, FORCE_QUANT}, |
| 138 {NULL, NULL,0,0,0,0} //End Marker | 143 {NULL, NULL,0,0,0,0} //End Marker |
| 139 }; | 144 }; |
| 140 | 145 |
| 749 //Note:the +17*1024 is just there so i dont have to worry about r/w over te end | 754 //Note:the +17*1024 is just there so i dont have to worry about r/w over te end |
| 750 reallocAlign((void **)&c->tempBlured[i], 8, stride*mbHeight*16 + 17*1024); | 755 reallocAlign((void **)&c->tempBlured[i], 8, stride*mbHeight*16 + 17*1024); |
| 751 reallocAlign((void **)&c->tempBluredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024);//FIXME size | 756 reallocAlign((void **)&c->tempBluredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024);//FIXME size |
| 752 } | 757 } |
| 753 | 758 |
| 754 reallocAlign((void **)&c->deintTemp, 8, width+16); | 759 reallocAlign((void **)&c->deintTemp, 8, 2*width+32); |
| 755 reallocAlign((void **)&c->nonBQPTable, 8, mbWidth*mbHeight*sizeof(QP_STORE_T)); | 760 reallocAlign((void **)&c->nonBQPTable, 8, mbWidth*mbHeight*sizeof(QP_STORE_T)); |
| 756 reallocAlign((void **)&c->forcedQPTable, 8, mbWidth*sizeof(QP_STORE_T)); | 761 reallocAlign((void **)&c->forcedQPTable, 8, mbWidth*sizeof(QP_STORE_T)); |
| 762 } | |
| 763 | |
| 764 static void global_init(){ | |
| 765 int i; | |
| 766 memset(clip_table, 0, 256); | |
| 767 for(i=256; i<512; i++) | |
| 768 clip_table[i]= i; | |
| 769 memset(clip_table+512, 0, 256); | |
| 757 } | 770 } |
| 758 | 771 |
| 759 pp_context_t *pp_get_context(int width, int height, int cpuCaps){ | 772 pp_context_t *pp_get_context(int width, int height, int cpuCaps){ |
| 760 PPContext *c= memalign(32, sizeof(PPContext)); | 773 PPContext *c= memalign(32, sizeof(PPContext)); |
| 761 int stride= (width+15)&(~15); //assumed / will realloc if needed | 774 int stride= (width+15)&(~15); //assumed / will realloc if needed |
| 762 | 775 |
| 776 global_init(); | |
| 777 | |
| 763 memset(c, 0, sizeof(PPContext)); | 778 memset(c, 0, sizeof(PPContext)); |
| 764 c->cpuCaps= cpuCaps; | 779 c->cpuCaps= cpuCaps; |
| 765 if(cpuCaps&PP_FORMAT){ | 780 if(cpuCaps&PP_FORMAT){ |
| 766 c->hChromaSubSample= cpuCaps&0x3; | 781 c->hChromaSubSample= cpuCaps&0x3; |
| 767 c->vChromaSubSample= (cpuCaps>>4)&0x3; | 782 c->vChromaSubSample= (cpuCaps>>4)&0x3; |
