Hello, Probably you remember my post about a way to speed up the SPP filter. Now I want to add this code to the Mplayer project :) However, during passed time, I've made some improvements: thresholding now uses customizable matrix (1% slower against fixed), and some minor speed improvements. I've found out that normal threshold (as in the current Mplayer code, normal dct->threshold->normal idct) has better quality against my previous variant (aan dct w/o postscale->threshold->aan idct w/o prescale), in terms of ringing artefacts. Now, customizable threshold matrix allows for the same results, as current Mplayer code. (aan dct w/o postscale->threshold[x][y]->aan idct w/o prescale). So, first question - create a new filter or patch existing? If new, then it means code duplication and probably some difficulties (I don't fully understand things like mpi, etc). If I patch existing, then it looses soft_threshold (softthresh_c) ability (I guess, forever). But you can play with threshold matrix coefficients instead. Also it looses non-mmx acceleration (ppc) (I think, not forever). But I guess ppc acceleration gains not more than 4x speedup(?), and my implementation in the C variant is about 4 times faster than current(also C). So, no real speed loss for ppc at first time (and later, someone can optimize it for ppc). And also, my implementation has only 4th and 5th processing levels, but I think this doesn't matter much (4th level can work at 512x272 resolution, 25 fps at Celeron 633). -- Best regards, Nikolaj mailto:nialpof@pisem.net
On Mon, Mar 21, 2005 at 04:19:53AM +0500, Nikolaj Poroshin wrote:
Hello,
Probably you remember my post about a way to speed up the SPP filter. Now I want to add this code to the Mplayer project :) However, during passed time, I've made some improvements: thresholding now uses customizable matrix (1% slower against fixed), and some minor speed improvements. I've found out that normal threshold (as in the current Mplayer code, normal dct->threshold->normal idct) has better quality against my previous variant (aan dct w/o postscale->threshold->aan idct w/o prescale), in terms of ringing artefacts. Now, customizable threshold matrix allows for the same results, as current Mplayer code. (aan dct w/o postscale->threshold[x][y]->aan idct w/o prescale).
So, first question - create a new filter or patch existing? If new, then it means code duplication and probably some difficulties (I don't fully understand things like mpi, etc). If I patch existing, then it looses soft_threshold (softthresh_c) ability (I guess, forever). But you can play with threshold matrix coefficients instead. Also it looses non-mmx acceleration (ppc) (I think, not forever). But I guess ppc acceleration gains not more than 4x speedup(?), and my implementation in the C variant is about 4 times faster than current(also C). So, no real speed loss for ppc at first time (and later, someone can optimize it for ppc). And also, my implementation has only 4th and 5th processing levels, but I think this doesn't matter much (4th level can work at 512x272 resolution, 25 fps at Celeron 633).
Wow. I hope this gets committed in some form or another. Rich
Hello, Sorry for long delay. Included proposed patch to vf_spp. Please review. I know there is still some issues - maybe x86_64 compatibility, or smth else. I plan to correct this file later. And I need your opinions about what to do. PS. diff is quite strange looking - if you need, I can send just a full file. -- Best regards, Nikolaj mailto:nialpof@pisem.net
Nikolaj wrote:
Hello,
Sorry for long delay. Included proposed patch to vf_spp. Please review. I know there is still some issues - maybe x86_64 compatibility, or smth else. I plan to correct this file later. And I need your opinions about what to do.
PS. diff is quite strange looking - if you need, I can send just a full file.
I am very eager to test it. Unfortunately 7 of 10 hunks fail on current CVS. Could you please provide a patch, which applies cleanly? Best regards, -- Jindrich Makovicka
Jindrich Makovicka wrote:
Nikolaj wrote:
Hello,
Sorry for long delay. Included proposed patch to vf_spp. Please review. I know there is still some issues - maybe x86_64 compatibility, or smth else. I plan to correct this file later. And I need your opinions about what to do.
PS. diff is quite strange looking - if you need, I can send just a full file.
I am very eager to test it. Unfortunately 7 of 10 hunks fail on current CVS. Could you please provide a patch, which applies cleanly?
are you sure you sent a right patch? this one applies when using -l, but has no chance to compile: missing parameter for p: +static void mul_thrmat_mmx(int q) +{int adr=(int)(&p->threshold_mtx_noq[0]); + asm volatile( missing semicolon in prototype: +static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) BLOCKSZ is undefined etc etc. -- Jindrich Makovicka
On Sun, 24 Apr 2005 16:37:36 +0200, Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> wrote:
Jindrich Makovicka wrote:
Nikolaj wrote:
Hello,
Sorry for long delay. Included proposed patch to vf_spp. Please review. I know there is still some issues - maybe x86_64 compatibility, or smth else. I plan to correct this file later. And I need your opinions about what to do.
PS. diff is quite strange looking - if you need, I can send just a full file.
I am very eager to test it. Unfortunately 7 of 10 hunks fail on current CVS. Could you please provide a patch, which applies cleanly?
are you sure you sent a right patch? this one applies when using -l, but has no chance to compile: Very big sorry, but I was a bit tired of it today, will correct tomorrow or so. I even hav'nt tried to compile it (but it should be correct _theoretically_ :) ). But I was thinking this form will be sufficent for review, so I decided to post it today.
missing parameter for p:
+static void mul_thrmat_mmx(int q) +{int adr=(int)(&p->threshold_mtx_noq[0]); + asm volatile(
Yeah, will pass context.
BLOCKSZ is undefined #define BLOCKSZ 12 :)
etc etc.
BTW, forgot to say (2 all): webcvs at mplayerhq isn't functioning properly - I wasn't able to get current vf_spp in the plain text format. filter has 3 arguments (level, constant quant, mode) - I changed last one into softness bias, >0 - blurrier. -- Best regards, Nikolaj mailto:nialpof@pisem.net
On Sun, Apr 24, 2005 at 10:19:10PM +0600, Nikolaj wrote:
BTW, forgot to say (2 all): webcvs at mplayerhq isn't functioning properly - I wasn't able to get current vf_spp in the plain text format.
Known. Arpi is unlikely to fix it in the foreseeable future. I even opened a bug report to document it: http://bugzilla.mplayerhq.hu/show_bug.cgi?id=245 Diego
Hello, I'm sending a working variant, please review. The code is not final, I think I'll tune it futher a bit. Attachment is a plain text. Seems funny, but I totally forgot that there is a add-sub trick without an additional register (like a+=b, b+=b, b-=a). The code should be a bit faster with it - will be possible to avoid temp vars, etc. Now I'm thinking, rewrite or not that almost boring asm part ;) -- Best regards, Nikolaj mailto:nialpof@pisem.net
Nikolaj wrote:
Hello,
I'm sending a working variant, please review. The code is not final, I think I'll tune it futher a bit. Attachment is a plain text.
Seems funny, but I totally forgot that there is a add-sub trick without an additional register (like a+=b, b+=b, b-=a). The code should be a bit faster with it - will be possible to avoid temp vars, etc. Now I'm thinking, rewrite or not that almost boring asm part ;)
sorry, doesn't compile under gcc-3.4. after replacing text labels with numerical, and removing const qualifiers from the precomputed fixed point constants (they were optimized out, so linker blew up later due to their usage in assembler), -vf spp crashes with a segfault (I can provide a more detailed report if needed). -- Jindrich Makovicka
On Thu, 02 Jun 2005 21:34:22 +0200, Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> wrote:
Nikolaj wrote:
Hello,
I'm sending a working variant, please review. The code is not final, I think I'll tune it futher a bit. Attachment is a plain text.
Seems funny, but I totally forgot that there is a add-sub trick without an additional register (like a+=b, b+=b, b-=a). The code should be a bit faster with it - will be possible to avoid temp vars, etc. Now I'm thinking, rewrite or not that almost boring asm part ;)
sorry, doesn't compile under gcc-3.4. after replacing text labels with numerical, and removing const qualifiers from the precomputed fixed point constants (they were optimized out, so linker blew up later due to their usage in assembler), -vf spp crashes with a segfault (I can provide a more detailed report if needed).
I'm using gcc 2.95.3 (mingw). Yes, please send both compiler and trace report (also which video, dimensions, etc). -- Best regards, Nikolaj mailto:nialpof@pisem.net
Nikolaj wrote:
I'm using gcc 2.95.3 (mingw). Yes, please send both compiler and trace report (also which video, dimensions, etc).
Here is a complete fix. The problem (besides a silly typo in my previous patch) was wrong i/o parameter list in the asm code, which makes gcc think that the register values don't change. After moving the arguments from input to output and declaring as read/write, it works ok. It's a nice performance improvement indeed, but I didn't check out the image quality much yet :) Regards, -- Jindrich Makovicka --- vf_spp.c.nikola 2005-06-02 20:52:05.000000000 +0200 +++ vf_spp.c 2005-06-03 01:05:32.999744964 +0200 @@ -229,9 +229,9 @@ "cmpl %4, %%edx \n\t" "jl 2b \n\t" + : "+m" (width), "+m" (src_stride), "+g" (od), "+m" (dst_stride), "+g" (height), + "+d" (log2_scale), "+S" (src), "+D" (dst) //input : - : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (height), - "d" (log2_scale), "S" (src), "D" (dst) //input : "%ecx", "%eax" ); } @@ -292,9 +292,9 @@ "cmpl %4, %%edx \n\t" "jl 2b \n\t" + : "+m" (width), "+m" (src_stride), "+g" (od), "+m" (dst_stride), "+g" (height), + "+d" (log2_scale), "+S" (src), "+D" (dst) //input : - : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (height), - "d" (log2_scale), "S" (src), "D" (dst) //input : "%ecx", "%eax" ); } @@ -371,9 +371,8 @@ "movq %%mm0, 14*8+0*8(%%edi) \n\t" "movq %%mm1, 14*8+1*8(%%edi) \n\t" + : "+g" (q), "+S" (adr), "+D" (adr) : - : "g" (q), "S" (adr), "D" (adr) - //: ); } @@ -388,7 +387,7 @@ #define column_fidct_s column_fidct_mmx #define row_idct_s row_idct_mmx #define row_fdct_s row_fdct_mmx -#endif +#endif // HAVE_MMX static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ @@ -401,6 +400,8 @@ DCTELEM *block= (DCTELEM *)block_align; DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ); + memset(block_align1, 0, 4*(4*8*BLOCKSZ+ 4*8*BLOCKSZ+8)); + //p->src=src-src_stride*8-8;//! if (!src || !dst) return; // HACK avoid crash for Y8 colourspace for(y=0; y<height; y++){ @@ -472,7 +473,7 @@ int h= (height+16+15)&(~15); vf->priv->temp_stride= (width+16+15)&(~15); - vf->priv->temp= (int16_t*)av_malloc(vf->priv->temp_stride*3*8*sizeof(int16_t)); + vf->priv->temp= (int16_t*)av_mallocz(vf->priv->temp_stride*3*8*sizeof(int16_t)); //this can also be avoided, see above vf->priv->src = (uint8_t*)av_malloc(vf->priv->temp_stride*h*sizeof(uint8_t)); @@ -669,38 +670,40 @@ #define THRESHOLD(r,x,t) if(((unsigned)((x)+t))>t*2) r=(x);else r=0; #define DESCALE(x,n) ((x) + (1 << ((n)-1)) >> n) -static uint64_t temps[4];//!! +static uint64_t attribute_used __attribute__((aligned(8))) temps[4];//!! -static const uint64_t MM_FIX_0_382683433=FIX64(0.382683433, 14); -static const uint64_t MM_FIX_0_541196100=FIX64(0.541196100, 14); -static const uint64_t MM_FIX_0_707106781=FIX64(0.707106781, 14); -static const uint64_t MM_FIX_1_306562965=FIX64(1.306562965, 14); - -static const uint64_t MM_FIX_1_414213562_A=FIX64(1.414213562, 14); - -static const uint64_t MM_FIX_1_847759065=FIX64(1.847759065, 13); -static const uint64_t MM_FIX_2_613125930=FIX64(-2.613125930, 13); //- -static const uint64_t MM_FIX_1_414213562=FIX64(1.414213562, 13); -static const uint64_t MM_FIX_1_082392200=FIX64(1.082392200, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_382683433=FIX64(0.382683433, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_541196100=FIX64(0.541196100, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_707106781=FIX64(0.707106781, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_306562965=FIX64(1.306562965, 14); + +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_414213562_A=FIX64(1.414213562, 14); + +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_847759065=FIX64(1.847759065, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_2_613125930=FIX64(-2.613125930, 13); //- +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_414213562=FIX64(1.414213562, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_082392200=FIX64(1.082392200, 13); //for t3,t5,t7 == 0 shortcut -static const uint64_t MM_FIX_0_847759065=FIX64(0.847759065, 14); -static const uint64_t MM_FIX_0_566454497=FIX64(0.566454497, 14); -static const uint64_t MM_FIX_0_198912367=FIX64(0.198912367, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_847759065=FIX64(0.847759065, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_566454497=FIX64(0.566454497, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_198912367=FIX64(0.198912367, 14); -static const uint64_t MM_DESCALE_RND=C64(4); -static const uint64_t MM_2=C64(2); +static uint64_t attribute_used __attribute__((aligned(8))) MM_DESCALE_RND=C64(4); +static uint64_t attribute_used __attribute__((aligned(8))) MM_2=C64(2); typedef int32_t int_simd16_t; -static const int16_t FIX_0_382683433=FIX(0.382683433, 14); -static const int16_t FIX_0_541196100=FIX(0.541196100, 14); -static const int16_t FIX_0_707106781=FIX(0.707106781, 14); -static const int16_t FIX_1_306562965=FIX(1.306562965, 14); -static const int16_t FIX_1_414213562_A=FIX(1.414213562, 14); -static const int16_t FIX_1_847759065=FIX(1.847759065, 13); -static const int16_t FIX_2_613125930=FIX(-2.613125930, 13); //- -static const int16_t FIX_1_414213562=FIX(1.414213562, 13); -static const int16_t FIX_1_082392200=FIX(1.082392200, 13); +static int16_t FIX_0_382683433=FIX(0.382683433, 14); +static int16_t FIX_0_541196100=FIX(0.541196100, 14); +static int16_t FIX_0_707106781=FIX(0.707106781, 14); +static int16_t FIX_1_306562965=FIX(1.306562965, 14); +static int16_t FIX_1_414213562_A=FIX(1.414213562, 14); +static int16_t FIX_1_847759065=FIX(1.847759065, 13); +static int16_t FIX_2_613125930=FIX(-2.613125930, 13); //- +static int16_t FIX_1_414213562=FIX(1.414213562, 13); +static int16_t FIX_1_082392200=FIX(1.082392200, 13); + +#ifndef HAVE_MMX static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) {int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; @@ -824,11 +827,13 @@ } } +#else + static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) {//uint64_t temps[4]; asm volatile( ".align 16 \n\t" -"L_COLUMS: \n\t" +"1: \n\t" "movq "DCTSIZE_S"*0*2(%%esi), %%mm1 \n\t" // "movq "DCTSIZE_S"*3*2(%%esi), %%mm7 \n\t" @@ -1020,7 +1025,7 @@ "movd %%mm4, %%eax \n\t" "orl %%eax, %%eax \n\t" - "jnz L_NDC21 \n\t" + "jnz 2f \n\t" //movq [edi+"DCTSIZE_S"*3*2], mm1 //movq [edi+"DCTSIZE_S"*5*2], mm5 //movq [edi+"DCTSIZE_S"*1*2], mm0 @@ -1090,9 +1095,9 @@ "movq %%mm7, "DCTSIZE_S"*4*2(%%edi) \n\t" "addl $8, %%edi \n\t" - "jmp L_END1 \n\t" + "jmp 4f \n\t" -"L_NDC21: \n\t" +"2: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) //psraw mm5, 2 @@ -1185,7 +1190,7 @@ "movq %%mm1, "DCTSIZE_S"*3*2(%%edi) \n\t" "addl $8, %%edi \n\t" -"L_END1: \n\t" +"4: \n\t" //=part 2 (the same)=========================================================== "movq "DCTSIZE_S"*0*2(%%esi), %%mm1 \n\t" // @@ -1378,7 +1383,7 @@ "movd %%mm4, %%eax \n\t" "orl %%eax, %%eax \n\t" - "jnz L_NDC22 \n\t" + "jnz 3f \n\t" //movq [edi+"DCTSIZE_S"*3*2], mm1 //movq [edi+"DCTSIZE_S"*5*2], mm5 //movq [edi+"DCTSIZE_S"*1*2], mm0 @@ -1449,10 +1454,10 @@ "movq %%mm7, "DCTSIZE_S"*4*2(%%edi) \n\t" "addl $24, %%edi \n\t" "subl $2, %%ecx \n\t" - "jnz L_COLUMS \n\t" - "jmp L_END \n\t" + "jnz 1b \n\t" + "jmp 5f \n\t" -"L_NDC22: \n\t" +"3: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) //psraw mm5, 2 @@ -1545,15 +1550,18 @@ "movq %%mm1, "DCTSIZE_S"*3*2(%%edi) \n\t" "addl $24, %%edi \n\t" "subl $2, %%ecx \n\t" - "jnz L_COLUMS \n\t" -"L_END: \n\t" + "jnz 1b \n\t" +"5: \n\t" + : "+S"(data), "+D"(output), "+c"(cnt), "+d"(thr_adr)// input regs : - : "S"(data), "D"(output), "c"(cnt), "d"(thr_adr)// input regs : "%eax" ); } +#endif // HAVE_MMX + +#ifndef HAVE_MMX static void row_idct_c(DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt) @@ -1617,12 +1625,14 @@ } } +#else + static void row_idct_mmx (DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt) {//uint64_t temps[2]; asm volatile( "leal (%%eax,%%eax,2), %%edx \n\t" -"L_ROWSi: \n\t" +"1: \n\t" "movq "DCTSIZE_S"*0*2(%%esi), %%mm0 \n\t" // @@ -1808,14 +1818,17 @@ "subl %%edx, %%edi \n\t" "addl $8, %%edi \n\t" "decl %%ecx \n\t" - "jnz L_ROWSi \n\t" + "jnz 1b \n\t" - : - : "S"(workspace), "D"(output_adr), "a"(output_stride*sizeof(short)), "c"(cnt) //input regs + : "+S"(workspace), "+D"(output_adr), "+c"(cnt) //input regs + : "a"(output_stride*sizeof(short)) : "%edx" ); } +#endif // HAVE_MMX + +#ifndef HAVE_MMX static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; @@ -1877,12 +1890,13 @@ } } +#else static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) -{//uint64_t temps[2]; +{ asm volatile( "leal (%%eax,%%eax,2), %%edx \n\t" -"1: \n\t" +"6: \n\t" "movd (%%esi), %%mm0 \n\t" "pxor %%mm7, %%mm7 \n\t" @@ -2047,11 +2061,13 @@ "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%edi) \n\t" "addl $"DCTSIZE_S"*2*4, %%edi \n\t" //4 rows "decl %%ecx \n\t" - "jnz 1b \n\t" + "jnz 6b \n\t" - : - : "S"(pixels), "D"(data), "a"(line_size), "c"(cnt) //input regs - : "%edx" ); + : "+S"(pixels), "+D"(data), "+a"(line_size), "+c"(cnt) //input regs + : + : "%edx"); } -#endif //USE_LIBAVCODEC \ No newline at end of file +#endif // HAVE_MMX + +#endif //USE_LIBAVCODEC
Jindrich Makovicka wrote:
Nikolaj wrote:
I'm using gcc 2.95.3 (mingw). Yes, please send both compiler and trace report (also which video, dimensions, etc).
Here is a complete fix. The problem (besides a silly typo in my previous patch) was wrong i/o parameter list in the asm code, which makes gcc think that the register values don't change. After moving the arguments from input to output and declaring as read/write, it works ok. It's a nice performance improvement indeed, but I didn't check out the image quality much yet :)
one more update with some cleanups and compiler warnings squished. -- Jindrich Makovicka --- vf_spp.c.nikola 2005-06-02 20:52:05.000000000 +0200 +++ vf_spp.c 2005-06-03 08:55:22.974137452 +0200 @@ -171,7 +171,7 @@ #define row_idct_s row_idct_c #define row_fdct_s row_fdct_c -#else //MMX functions +#else /* HAVE_MMX */ //This func reads from 1 slice, 1 and clears 0 & 1 static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale) @@ -229,9 +229,9 @@ "cmpl %4, %%edx \n\t" "jl 2b \n\t" + : "+m" (width), "+m" (src_stride), "+g" (od), "+m" (dst_stride), "+g" (height), + "+d" (log2_scale), "+S" (src), "+D" (dst) //input : - : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (height), - "d" (log2_scale), "S" (src), "D" (dst) //input : "%ecx", "%eax" ); } @@ -292,9 +292,9 @@ "cmpl %4, %%edx \n\t" "jl 2b \n\t" + : "+m" (width), "+m" (src_stride), "+g" (od), "+m" (dst_stride), "+g" (height), + "+d" (log2_scale), "+S" (src), "+D" (dst) //input : - : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (height), - "d" (log2_scale), "S" (src), "D" (dst) //input : "%ecx", "%eax" ); } @@ -371,9 +371,8 @@ "movq %%mm0, 14*8+0*8(%%edi) \n\t" "movq %%mm1, 14*8+1*8(%%edi) \n\t" + : "+g" (q), "+S" (adr), "+D" (adr) : - : "g" (q), "S" (adr), "D" (adr) - //: ); } @@ -388,7 +387,7 @@ #define column_fidct_s column_fidct_mmx #define row_idct_s row_idct_mmx #define row_fdct_s row_fdct_mmx -#endif +#endif // HAVE_MMX static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ @@ -401,6 +400,8 @@ DCTELEM *block= (DCTELEM *)block_align; DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ); + memset(block3, 0, 4*8*BLOCKSZ); + //p->src=src-src_stride*8-8;//! if (!src || !dst) return; // HACK avoid crash for Y8 colourspace for(y=0; y<height; y++){ @@ -459,9 +460,9 @@ } if (y&7) { // == height & 7 - if (y&8) store_slice_s(dst + (y-8&~7)*dst_stride, p->temp+ 8 +8*stride, + if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride, dst_stride, stride, width, y&7, 5-p->log2_count); - else store_slice2_s(dst + (y-8&~7)*dst_stride, p->temp+ 8 +0*stride, + else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride, dst_stride, stride, width, y&7, 5-p->log2_count); } } @@ -472,7 +473,7 @@ int h= (height+16+15)&(~15); vf->priv->temp_stride= (width+16+15)&(~15); - vf->priv->temp= (int16_t*)av_malloc(vf->priv->temp_stride*3*8*sizeof(int16_t)); + vf->priv->temp= (int16_t*)av_mallocz(vf->priv->temp_stride*3*8*sizeof(int16_t)); //this can also be avoided, see above vf->priv->src = (uint8_t*)av_malloc(vf->priv->temp_stride*h*sizeof(uint8_t)); @@ -564,6 +565,7 @@ return 0; } +/* static unsigned int fmt_list[]={ IMGFMT_YVU9, IMGFMT_IF09, @@ -578,6 +580,7 @@ IMGFMT_411P, 0 }; +*/ static int control(struct vf_instance_s* vf, int request, void* data){ switch(request){ @@ -667,40 +670,47 @@ #define MULTIPLY16H(x,k) (((x)*(k))>>16) #define THRESHOLD(r,x,t) if(((unsigned)((x)+t))>t*2) r=(x);else r=0; -#define DESCALE(x,n) ((x) + (1 << ((n)-1)) >> n) - -static uint64_t temps[4];//!! +#define DESCALE(x,n) (((x) + (1 << ((n)-1))) >> n) -static const uint64_t MM_FIX_0_382683433=FIX64(0.382683433, 14); -static const uint64_t MM_FIX_0_541196100=FIX64(0.541196100, 14); -static const uint64_t MM_FIX_0_707106781=FIX64(0.707106781, 14); -static const uint64_t MM_FIX_1_306562965=FIX64(1.306562965, 14); +#ifdef HAVE_MMX -static const uint64_t MM_FIX_1_414213562_A=FIX64(1.414213562, 14); +static uint64_t attribute_used __attribute__((aligned(8))) temps[4];//!! -static const uint64_t MM_FIX_1_847759065=FIX64(1.847759065, 13); -static const uint64_t MM_FIX_2_613125930=FIX64(-2.613125930, 13); //- -static const uint64_t MM_FIX_1_414213562=FIX64(1.414213562, 13); -static const uint64_t MM_FIX_1_082392200=FIX64(1.082392200, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_382683433=FIX64(0.382683433, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_541196100=FIX64(0.541196100, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_707106781=FIX64(0.707106781, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_306562965=FIX64(1.306562965, 14); + +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_414213562_A=FIX64(1.414213562, 14); + +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_847759065=FIX64(1.847759065, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_2_613125930=FIX64(-2.613125930, 13); //- +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_414213562=FIX64(1.414213562, 13); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_1_082392200=FIX64(1.082392200, 13); //for t3,t5,t7 == 0 shortcut -static const uint64_t MM_FIX_0_847759065=FIX64(0.847759065, 14); -static const uint64_t MM_FIX_0_566454497=FIX64(0.566454497, 14); -static const uint64_t MM_FIX_0_198912367=FIX64(0.198912367, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_847759065=FIX64(0.847759065, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_566454497=FIX64(0.566454497, 14); +static uint64_t attribute_used __attribute__((aligned(8))) MM_FIX_0_198912367=FIX64(0.198912367, 14); -static const uint64_t MM_DESCALE_RND=C64(4); -static const uint64_t MM_2=C64(2); +static uint64_t attribute_used __attribute__((aligned(8))) MM_DESCALE_RND=C64(4); +static uint64_t attribute_used __attribute__((aligned(8))) MM_2=C64(2); +#else /* !HAVE_MMX */ typedef int32_t int_simd16_t; -static const int16_t FIX_0_382683433=FIX(0.382683433, 14); -static const int16_t FIX_0_541196100=FIX(0.541196100, 14); -static const int16_t FIX_0_707106781=FIX(0.707106781, 14); -static const int16_t FIX_1_306562965=FIX(1.306562965, 14); -static const int16_t FIX_1_414213562_A=FIX(1.414213562, 14); -static const int16_t FIX_1_847759065=FIX(1.847759065, 13); -static const int16_t FIX_2_613125930=FIX(-2.613125930, 13); //- -static const int16_t FIX_1_414213562=FIX(1.414213562, 13); -static const int16_t FIX_1_082392200=FIX(1.082392200, 13); +static int16_t FIX_0_382683433=FIX(0.382683433, 14); +static int16_t FIX_0_541196100=FIX(0.541196100, 14); +static int16_t FIX_0_707106781=FIX(0.707106781, 14); +static int16_t FIX_1_306562965=FIX(1.306562965, 14); +static int16_t FIX_1_414213562_A=FIX(1.414213562, 14); +static int16_t FIX_1_847759065=FIX(1.847759065, 13); +static int16_t FIX_2_613125930=FIX(-2.613125930, 13); //- +static int16_t FIX_1_414213562=FIX(1.414213562, 13); +static int16_t FIX_1_082392200=FIX(1.082392200, 13); + +#endif + +#ifndef HAVE_MMX static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) {int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; @@ -824,11 +834,13 @@ } } +#else /* HAVE_MMX */ + static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) {//uint64_t temps[4]; asm volatile( ".align 16 \n\t" -"L_COLUMS: \n\t" +"1: \n\t" "movq "DCTSIZE_S"*0*2(%%esi), %%mm1 \n\t" // "movq "DCTSIZE_S"*3*2(%%esi), %%mm7 \n\t" @@ -1020,7 +1032,7 @@ "movd %%mm4, %%eax \n\t" "orl %%eax, %%eax \n\t" - "jnz L_NDC21 \n\t" + "jnz 2f \n\t" //movq [edi+"DCTSIZE_S"*3*2], mm1 //movq [edi+"DCTSIZE_S"*5*2], mm5 //movq [edi+"DCTSIZE_S"*1*2], mm0 @@ -1090,9 +1102,9 @@ "movq %%mm7, "DCTSIZE_S"*4*2(%%edi) \n\t" "addl $8, %%edi \n\t" - "jmp L_END1 \n\t" + "jmp 4f \n\t" -"L_NDC21: \n\t" +"2: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) //psraw mm5, 2 @@ -1185,7 +1197,7 @@ "movq %%mm1, "DCTSIZE_S"*3*2(%%edi) \n\t" "addl $8, %%edi \n\t" -"L_END1: \n\t" +"4: \n\t" //=part 2 (the same)=========================================================== "movq "DCTSIZE_S"*0*2(%%esi), %%mm1 \n\t" // @@ -1378,7 +1390,7 @@ "movd %%mm4, %%eax \n\t" "orl %%eax, %%eax \n\t" - "jnz L_NDC22 \n\t" + "jnz 3f \n\t" //movq [edi+"DCTSIZE_S"*3*2], mm1 //movq [edi+"DCTSIZE_S"*5*2], mm5 //movq [edi+"DCTSIZE_S"*1*2], mm0 @@ -1449,10 +1461,10 @@ "movq %%mm7, "DCTSIZE_S"*4*2(%%edi) \n\t" "addl $24, %%edi \n\t" "subl $2, %%ecx \n\t" - "jnz L_COLUMS \n\t" - "jmp L_END \n\t" + "jnz 1b \n\t" + "jmp 5f \n\t" -"L_NDC22: \n\t" +"3: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) //psraw mm5, 2 @@ -1545,15 +1557,18 @@ "movq %%mm1, "DCTSIZE_S"*3*2(%%edi) \n\t" "addl $24, %%edi \n\t" "subl $2, %%ecx \n\t" - "jnz L_COLUMS \n\t" -"L_END: \n\t" + "jnz 1b \n\t" +"5: \n\t" + : "+S"(data), "+D"(output), "+c"(cnt), "+d"(thr_adr)// input regs : - : "S"(data), "D"(output), "c"(cnt), "d"(thr_adr)// input regs : "%eax" ); } +#endif // HAVE_MMX + +#ifndef HAVE_MMX static void row_idct_c(DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt) @@ -1617,12 +1632,14 @@ } } +#else /* HAVE_MMX */ + static void row_idct_mmx (DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt) {//uint64_t temps[2]; asm volatile( "leal (%%eax,%%eax,2), %%edx \n\t" -"L_ROWSi: \n\t" +"1: \n\t" "movq "DCTSIZE_S"*0*2(%%esi), %%mm0 \n\t" // @@ -1808,14 +1825,17 @@ "subl %%edx, %%edi \n\t" "addl $8, %%edi \n\t" "decl %%ecx \n\t" - "jnz L_ROWSi \n\t" + "jnz 1b \n\t" - : - : "S"(workspace), "D"(output_adr), "a"(output_stride*sizeof(short)), "c"(cnt) //input regs + : "+S"(workspace), "+D"(output_adr), "+c"(cnt) //input regs + : "a"(output_stride*sizeof(short)) : "%edx" ); } +#endif // HAVE_MMX + +#ifndef HAVE_MMX static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; @@ -1877,12 +1897,13 @@ } } +#else /* HAVE_MMX */ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) -{//uint64_t temps[2]; +{ asm volatile( "leal (%%eax,%%eax,2), %%edx \n\t" -"1: \n\t" +"6: \n\t" "movd (%%esi), %%mm0 \n\t" "pxor %%mm7, %%mm7 \n\t" @@ -2047,11 +2068,13 @@ "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%edi) \n\t" "addl $"DCTSIZE_S"*2*4, %%edi \n\t" //4 rows "decl %%ecx \n\t" - "jnz 1b \n\t" + "jnz 6b \n\t" - : - : "S"(pixels), "D"(data), "a"(line_size), "c"(cnt) //input regs - : "%edx" ); + : "+S"(pixels), "+D"(data), "+a"(line_size), "+c"(cnt) //input regs + : + : "%edx"); } -#endif //USE_LIBAVCODEC \ No newline at end of file +#endif // HAVE_MMX + +#endif //USE_LIBAVCODEC
Jindrich Makovicka wrote:
Nikolaj wrote:
I'm using gcc 2.95.3 (mingw). Yes, please send both compiler and trace report (also which video, dimensions, etc).
Here is a complete fix. The problem (besides a silly typo in my previous patch) was wrong i/o parameter list in the asm code, which makes gcc think that the register values don't change. After moving the arguments from input to output and declaring as read/write, it works ok. It's a nice performance improvement indeed, but I didn't check out the image quality much yet :)
Another nitpick: spp is broken on files with width%8 != 0. store_slice_mmx functions need to align the width first by width = (width+7)&~7 . The positive side: I tried spp doday on various movies and both speed and quality are really amazing! I hope it will get into mainstream soon. -- Jindrich Makovicka
On Fri, Jun 03, 2005 at 10:46:29PM +0200, Jindrich Makovicka wrote:
Jindrich Makovicka wrote:
Nikolaj wrote:
I'm using gcc 2.95.3 (mingw). Yes, please send both compiler and trace report (also which video, dimensions, etc).
Here is a complete fix. The problem (besides a silly typo in my previous patch) was wrong i/o parameter list in the asm code, which makes gcc think that the register values don't change. After moving the arguments from input to output and declaring as read/write, it works ok. It's a nice performance improvement indeed, but I didn't check out the image quality much yet :)
Another nitpick: spp is broken on files with width%8 != 0. store_slice_mmx functions need to align the width first by width = (width+7)&~7 .
The positive side: I tried spp doday on various movies and both speed and quality are really amazing! I hope it will get into mainstream soon.
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :) Rich
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp -- Jindrich Makovicka
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
strange.. looks like fspp doesn't obey quality level <4 (and is unusable on mu P500 ;) VIDEO: [DIV3] 480x260 24bpp 24.000 fps 649.0 kbps (79.2 kbyte/s) spp/fspp 1 spp: VC: 11.478s VO: 43.014s A: 0.000s Sys: 0.793s = 55.285s fspp: VC: 10.818s VO: 93.164s A: 0.000s Sys: 0.609s = 104.591s spp/fspp 2 spp: VC: 11.321s VO: 72.458s A: 0.000s Sys: 0.685s = 84.463s fspp: VC: 10.850s VO: 93.060s A: 0.000s Sys: 0.611s = 104.522s spp/fspp 3 spp: VC: 11.118s VO: 144.001s A: 0.000s Sys: 0.654s = 155.772s fspp: VC: 10.898s VO: 93.362s A: 0.000s Sys: 0.606s = 104.867s spp/fspp 4 spp: VC: 11.015s VO: 268.168s A: 0.000s Sys: 0.629s = 279.812s fspp: VC: 10.855s VO: 93.184s A: 0.000s Sys: 0.644s = 104.684s spp/fspp 5 spp: VC: 10.976s VO: 524.227s A: 0.000s Sys: 0.604s = 535.806s fspp: VC: 10.990s VO: 178.979s A: 0.000s Sys: 0.609s = 190.578s regards -- Bohdan 'Nexus' Horst
On Saturday 04 June 2005 14:13, Bohdan Horst wrote:
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
This doesn't compile on amd64 : gcc-3.4 -c -I../libvo -I../../libvo -I/usr/X11R6/include -O4 -march=athlon64 -mtune=athlon64 -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=gnu99 -I. -Inative -I.. -I../libmpdemux -I../loader -D_GNU_SOURCE -o vf_fspp.o vf_fspp.c vf_fspp.c: In function `store_slice_mmx': vf_fspp.c:191: warning: cast from pointer to integer of different size vf_fspp.c: In function `store_slice2_mmx': vf_fspp.c:259: warning: cast from pointer to integer of different size vf_fspp.c: In function `mul_thrmat_mmx': vf_fspp.c:322: warning: cast from pointer to integer of different size vf_fspp.c: In function `filter': vf_fspp.c:421: warning: cast from pointer to integer of different size vf_fspp.c:421: warning: cast to pointer from integer of different size {standard input}: Assembler messages: {standard input}:435: Error: `(%eax,%eax,2)' is not a valid 64 bit base/index expression {standard input}:437: Error: `(%esi)' is not a valid 64 bit base/index expression {standard input}:439: Error: `(%esi,%eax,)' is not a valid 64 bit base/index expression {standard input}:441: Error: `(%esi,%eax,2)' is not a valid 64 bit base/index expression {standard input}:446: Error: `(%esi,%eax,4)' is not a valid 64 bit base/index expression {standard input}:448: Error: `(%esi,%edx,)' is not a valid 64 bit base/index expression {standard input}:454: Error: `(%esi,%eax,2)' is not a valid 64 bit base/index expression {standard input}:460: Error: `(%esi)' is not a valid 64 bit base/index expression And lots more of same error. ismail -- Animals use pee to mark their territories. Humans use others' girl friends
Ismail Donmez wrote:
On Saturday 04 June 2005 14:13, Bohdan Horst wrote:
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
This doesn't compile on amd64 :
[...] The code would require replacing gp registers with REG_* macros. I will disable the mmx optimizations for now on x86-x64, until someone fixes it. -- Jindrich Makovicka
On Sat, Jun 04, 2005 at 02:42:04PM +0200, Jindrich Makovicka wrote:
Ismail Donmez wrote:
On Saturday 04 June 2005 14:13, Bohdan Horst wrote:
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
This doesn't compile on amd64 :
[...]
The code would require replacing gp registers with REG_* macros. I will disable the mmx optimizations for now on x86-x64, until someone fixes it.
I JUST fixed it, but apperantely I didn't. {standard input}:791: Error: Incorrect register `%rdx' used with `l' suffix {standard input}:800: Error: Incorrect register `%rsi' used with `l' suffix Apperantely using commands like 'addl' on those registers is obviously illegal.. I'm not sure what to do at this point, i've never made 64-bit code... - ods15
Oded Shimon wrote:
On Sat, Jun 04, 2005 at 02:42:04PM +0200, Jindrich Makovicka wrote:
Ismail Donmez wrote:
On Saturday 04 June 2005 14:13, Bohdan Horst wrote:
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
This doesn't compile on amd64 :
[...]
The code would require replacing gp registers with REG_* macros. I will disable the mmx optimizations for now on x86-x64, until someone fixes it.
I JUST fixed it, but apperantely I didn't.
{standard input}:791: Error: Incorrect register `%rdx' used with `l' suffix {standard input}:800: Error: Incorrect register `%rsi' used with `l' suffix
Apperantely using commands like 'addl' on those registers is obviously illegal.. I'm not sure what to do at this point, i've never made 64-bit code...
I think that most of them should be just replaced with the instructions without the suffix (addl->add). But I didn't code any 64bit asm either. -- Jindrich Makovicka
Hi,
I JUST fixed it, but apperantely I didn't.
{standard input}:791: Error: Incorrect register `%rdx' used with `l' suffix {standard input}:800: Error: Incorrect register `%rsi' used with `l' suffix
Apperantely using commands like 'addl' on those registers is obviously illegal.. I'm not sure what to do at this point, i've never made 64-bit code...
I think that most of them should be just replaced with the instructions without the suffix (addl->add). But I didn't code any 64bit asm either.
If that was all... I really though that by now everyone knows that casting a pointer to int is not a good idea. Obviously not. The attached patch fixes it on AMD64, though it isn't a beauty (esp. the int -> long changes). I'm also not 100% percent sure the __attribute__((aligned(32))) for that on-stack variable will be taken into account by all compilers, but it certainly worked for me (and I'm also not sure if 32 isn't overkill)... Greetings, Reimar Döffinger
Hi, On 6/4/05, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> wrote:
Hi,
I JUST fixed it, but apperantely I didn't.
{standard input}:791: Error: Incorrect register `%rdx' used with `l' suffix {standard input}:800: Error: Incorrect register `%rsi' used with `l' suffix
Apperantely using commands like 'addl' on those registers is obviously illegal.. I'm not sure what to do at this point, i've never made 64-bit code...
I think that most of them should be just replaced with the instructions without the suffix (addl->add). But I didn't code any 64bit asm either.
If that was all... I really though that by now everyone knows that casting a pointer to int is not a good idea. Obviously not. The attached patch fixes it on AMD64, though it isn't a beauty (esp. the int -> long changes). I'm also not 100% percent sure the __attribute__((aligned(32))) for that on-stack variable will be taken into account by all compilers, but it certainly worked for me (and I'm also not sure if 32 isn't overkill)...
Applied by Jindrich Makovicka -- Should I have invented the tape recorder too, people would have more quotes of me to put at the bottom of their e-mails -- Benjamin Franklin
On Sat, 04 Jun 2005 15:22:52 +0200, Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> wrote:
This doesn't compile on amd64 :
[...]
The code would require replacing gp registers with REG_* macros. I will disable the mmx optimizations for now on x86-x64, until someone fixes it.
I JUST fixed it, but apperantely I didn't.
{standard input}:791: Error: Incorrect register `%rdx' used with `l' suffix {standard input}:800: Error: Incorrect register `%rsi' used with `l' suffix
Apperantely using commands like 'addl' on those registers is obviously illegal.. I'm not sure what to do at this point, i've never made 64-bit code...
I think that most of them should be just replaced with the instructions without the suffix (addl->add). But I didn't code any 64bit asm either.
Me too... -- Best regards, Nikolaj mailto:nialpof@pisem.net
Hi Bohdan Horst! On 2005.06.04 at 13:13:11 +0200, Bohdan Horst wrote next:
strange.. looks like fspp doesn't obey quality level <4 (and is unusable on mu P500 ;)
It was said some time ago, this optimization requires level 4 or 5 (dunno why it doesn't work on level 6, though). Levels 0-3 and 6 work like 4. -- Vladimir
On Sat, 4 Jun 2005 19:22:33 +0400, Vladimir Mosgalin <mosgalin@VM10124.spb.edu> wrote:
Hi Bohdan Horst!
On 2005.06.04 at 13:13:11 +0200, Bohdan Horst wrote next:
strange.. looks like fspp doesn't obey quality level <4 (and is unusable on mu P500 ;)
It was said some time ago, this optimization requires level 4 or 5 (dunno why it doesn't work on level 6, though). Levels 0-3 and 6 work like 4.
Yes, as it is, it requires level 4 or 5. I have some variants and ideas about level 3 realization: 1. Most trivial one. Perform level 4 for luma and none (memcpy) for chrominance. 2. More rare sample locations. Level 4 uses hor&ver spacing of 2. If level 3 use mostly the same functions, it will be with vert. spacing of 4. I doubt of its quality. 3. Various partial applications of level 4 - only part of frames, only certain blocks, only certain coefficients - we aren't bound by conforming spp :) 4. Since most inner & time consuming part is an overlapping dct/idct8 with step 2 (or two "threads" with 4), it probably can be replaced by simpler mdct transform with only a little worse quality. It just an idea and needs analysis. Or maybe someone is clever enough to simpify this case :). I've tried to investigate here - there are some good sources of ideas, for example dct domain motion compensation, but I had no success... 5. May be it unneeded at all - there can be other PP methods that work better than theese level 3 variants. As for level 6, yes, it can be included quite easy. I've just noted original paper author (Aria Nosratinia) graph that shows that level 6 gives not so big improvement over level 5, while it is around 2 times slower. So, I hadn't seen much sense in it. Don't know why it works as level 4, this code: static int control(struct vf_instance_s* vf, int request, void* data){ switch(request){ case VFCTRL_QUERY_MAX_PP_LEVEL: return 5; ,IMO, should limit max level to 5. Filter itself assumes it will never get level 6 request... -- Best regards, Nikolaj mailto:nialpof@pisem.net
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
Could you add it to the man page, please? Diego
Diego Biurrun wrote:
On Sat, Jun 04, 2005 at 09:50:55AM +0200, Jindrich Makovicka wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
Could you add it to the man page, please?
Committed, except the 3rd filter option, which is unclear to me. From the FIXME comment it looks like it is intended only for development, maybe Nikolaj can give some additional advice. -- Jindrich Makovicka
On Sat, Jun 04, 2005 at 08:42:40PM +0200, Jindrich Makovicka wrote:
Diego Biurrun wrote:
Could you add it to the man page, please?
Committed, except the 3rd filter option, which is unclear to me. From the FIXME comment it looks like it is intended only for development, maybe Nikolaj can give some additional advice.
It's not committed yet... Diego
Diego Biurrun wrote:
On Sat, Jun 04, 2005 at 08:42:40PM +0200, Jindrich Makovicka wrote:
Diego Biurrun wrote:
Could you add it to the man page, please?
Committed, except the 3rd filter option, which is unclear to me. From the FIXME comment it looks like it is intended only for development, maybe Nikolaj can give some additional advice.
It's not committed yet...
my bad... I didn't notice that my checkout is outdated. -- Jindrich Makovicka
On Sun, Jun 05, 2005 at 01:58:28PM +0200, Jindrich Makovicka wrote:
Diego Biurrun wrote:
On Sat, Jun 04, 2005 at 08:42:40PM +0200, Jindrich Makovicka wrote:
Diego Biurrun wrote:
Could you add it to the man page, please?
Committed, except the 3rd filter option, which is unclear to me. From the FIXME comment it looks like it is intended only for development, maybe Nikolaj can give some additional advice.
While we're at it.. What are the different quality levels? Diego
On Sat, 04 Jun 2005 20:42:40 +0200, Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> wrote:
committed as -vf fspp
Could you add it to the man page, please?
Committed, except the 3rd filter option, which is unclear to me. From the FIXME comment it looks like it is intended only for development, maybe Nikolaj can give some additional advice.
Third parameter is a filter strength, its range is -15..32. Value 0 is normal and intended to give best psnr. Values <0 decrease filtering (more details, more artifacts), and values >0 give more blurry image (less details, less artifacts). Default 0. -- Best regards, Nikolaj mailto:nialpof@pisem.net
On Sat, 04 Jun 2005 09:50:55 +0200, Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> wrote:
Rich Felker wrote:
IMO if it behaves differently from current spp, or has different featureset (I seem to remember this being the case) then we should give it a different name and leave both in place. Otherwise, feel free to commit as soon as the code is confirmed to compile (including on gcc 2.95) and basically work. :)
committed as -vf fspp
Big thanks for fixing! This code was half-autoconverted from vc inline asm (Intel/nasm syntax). I'm new to the gcc inline asm-writing and totally don't like it. I just can't read or debug its syntax. Also, gcc turns out to be not so asm-friendly, I'd also trapped on similar errors you fixed. I'm planning to rewrite (i)dct asm parts to remove temps[] mem vars (and probably get some minor speed improvement). In the output exist some flashing artifact, I will try to find out why & fix it. Also, it needs to determine more optimal custom_threshold[] values - I think there will be different sets for various basic options, like mpeg_quant. Btw, flat dither[] table (iirc, with value 38) gives better psnr values (I know, original one often gives better psycho-visual quality). -- Best regards, Nikolaj mailto:nialpof@pisem.net
Hi Jindrich Makovicka! On 2005.06.03 at 22:46:29 +0200, Jindrich Makovicka wrote next:
Another nitpick: spp is broken on files with width%8 != 0. store_slice_mmx functions need to align the width first by width = (width+7)&~7 .
The positive side: I tried spp doday on various movies and both speed and quality are really amazing! I hope it will get into mainstream soon.
Thanks for the fix! I already made example shots to show defects of new spp filter (they were quite noticeable sometimes, even on nice 352x240 resolution), but now fspp filter doesn't have any of them, the picture is completely identical to spp. And, of course, many thanks to Nikolaj! For the record, the filter is 2.9-3.2 times faster than spp for me (with -vo null -nosound). Level 5 is still impossible to use on close to dvd resolution (720x400), level 4 works fine even on 720x576. That's Athlon 64 2Ghz (3000+). Probably fspp parameters should be changed? It's looks strange when filter accepts only levels 4 and 5, and the fact that "level 6" works the same as level 4, not 5 isn't very nice too. -- Vladimir
On Sat, 4 Jun 2005 12:39:12 +0400, Vladimir Mosgalin <mosgalin@VM10124.spb.edu> wrote:
For the record, the filter is 2.9-3.2 times faster than spp for me (with -vo null -nosound). Level 5 is still impossible to use on close to dvd resolution (720x400), level 4 works fine even on 720x576. That's Athlon 64 2Ghz (3000+).
Can you determine best BLOCKSZ parameter value for your case, one which gives best speed? It is integer, with range 2..33, lower values with nearly the same speed have priority. -- Best regards, Nikolaj mailto:nialpof@pisem.net
participants (12)
-
Bohdan Horst -
D Richard Felker III -
Diego Biurrun -
Guillaume POIRIER -
Ismail Donmez -
Jindrich Makovicka -
Nikolaj -
Nikolaj Poroshin -
Oded Shimon -
Reimar Döffinger -
Rich Felker -
Vladimir Mosgalin