summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_spp.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs/vf_spp.c')
-rw-r--r--libmpcodecs/vf_spp.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index 6d478e92ae..5a6ed294e3 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -20,12 +20,12 @@
/*
* This implementation is based on an algorithm described in
- * "Aria Nosratinia Embedded Post-Processing for
+ * "Aria Nosratinia Embedded Post-Processing for
* Enhancement of Compressed Images (1999)"
* (http://citeseer.nj.nec.com/nosratinia99embedded.html)
*/
-
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -69,23 +69,23 @@ static const uint8_t offset[127][2]= {
{0,0},
{0,0}, {4,4},
{0,0}, {2,2}, {6,4}, {4,6},
-{0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7},
-
-{0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3},
-{0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7},
-
-{0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7},
-{2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7},
-{4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7},
-{6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7},
-
-{0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2},
-{0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0},
-{1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3},
-{1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1},
-{0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3},
-{0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1},
-{1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2},
+{0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7},
+
+{0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3},
+{0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7},
+
+{0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7},
+{2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7},
+{4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7},
+{6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7},
+
+{0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2},
+{0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0},
+{1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3},
+{1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1},
+{0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3},
+{0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1},
+{1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2},
{1,2}, {5,6}, {1,6}, {5,2}, {3,0}, {7,4}, {3,4}, {7,0},
};
@@ -105,13 +105,13 @@ struct vf_priv_s {
#define SHIFT 22
static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int i;
+ int i;
int bias= 0; //FIXME
unsigned int threshold1, threshold2;
-
+
threshold1= qp*((1<<4) - bias) - 1;
threshold2= (threshold1<<1);
-
+
memset(dst, 0, 64*sizeof(DCTELEM));
dst[0]= (src[0] + 4)>>3;
@@ -125,13 +125,13 @@ static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *perm
}
static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int i;
+ int i;
int bias= 0; //FIXME
unsigned int threshold1, threshold2;
-
+
threshold1= qp*((1<<4) - bias) - 1;
threshold2= (threshold1<<1);
-
+
memset(dst, 0, 64*sizeof(DCTELEM));
dst[0]= (src[0] + 4)>>3;
@@ -151,9 +151,9 @@ static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *perm
static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
int bias= 0; //FIXME
unsigned int threshold1;
-
+
threshold1= qp*((1<<4) - bias) - 1;
-
+
__asm__ volatile(
#define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \
"movq " #src0 ", %%mm0 \n\t"\
@@ -197,7 +197,7 @@ static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe
"movq %%mm7, " #dst1 " \n\t"\
"movq %%mm3, " #dst2 " \n\t"\
"movq %%mm1, " #dst3 " \n\t"
-
+
"movd %2, %%mm4 \n\t"
"movd %3, %%mm5 \n\t"
"movd %4, %%mm6 \n\t"
@@ -221,7 +221,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe
unsigned int threshold1;
threshold1= qp*((1<<4) - bias) - 1;
-
+
__asm__ volatile(
#undef REQUANT_CORE
#define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \
@@ -275,7 +275,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe
"movq %%mm7, " #dst1 " \n\t"\
"movq %%mm3, " #dst2 " \n\t"\
"movq %%mm1, " #dst3 " \n\t"
-
+
"movd %2, %%mm4 \n\t"
"movd %3, %%mm5 \n\t"
"packssdw %%mm4, %%mm4 \n\t"
@@ -295,7 +295,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe
static inline void add_block(int16_t *dst, int stride, DCTELEM block[64]){
int y;
-
+
for(y=0; y<8; y++){
*(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8];
*(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8];
@@ -385,7 +385,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
for(y=0; y<height; y++){
int index= 8 + 8*stride + y*stride;
fast_memcpy(p->src + index, src + y*src_stride, width);
- for(x=0; x<8; x++){
+ for(x=0; x<8; x++){
p->src[index - x - 1]= p->src[index + x ];
p->src[index + width + x ]= p->src[index + width - x - 1];
}
@@ -401,7 +401,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
for(x=0; x<width+8; x+=8){
const int qps= 3 + is_luma;
int qp;
-
+
if(p->qp)
qp= p->qp;
else{
@@ -443,7 +443,7 @@ static int config(struct vf_instance_s* vf,
vf->priv->temp_stride= (width+16+15)&(~15);
vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t));
vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t));
-
+
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
@@ -521,7 +521,7 @@ static void uninit(struct vf_instance_s* vf){
vf->priv->avctx= NULL;
if(vf->priv->non_b_qp) free(vf->priv->non_b_qp);
vf->priv->non_b_qp= NULL;
-
+
free(vf->priv);
vf->priv=NULL;
}
@@ -559,7 +559,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
static int open(vf_instance_t *vf, char* args){
int log2c=-1;
-
+
vf->config=config;
vf->put_image=put_image;
vf->get_image=get_image;
@@ -568,14 +568,14 @@ static int open(vf_instance_t *vf, char* args){
vf->control= control;
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
+
avcodec_init();
vf->priv->avctx= avcodec_alloc_context();
dsputil_init(&vf->priv->dsp, vf->priv->avctx);
-
+
vf->priv->log2_count= 3;
-
+
if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode);
if( log2c >=0 && log2c <=6 )
@@ -599,7 +599,7 @@ static int open(vf_instance_t *vf, char* args){
}
}
#endif
-
+
return 1;
}