DCT8x8Inv_AANTransposed

DCT8x8Inv_AANTransposed

Hello -

I am looking for some documentation for the DCT8x8Inv_AANTransposed function. The .h file says to pass in a transposition matrix into ReconstructDCTBlock. However, it does not say what form this matrix is supposed to take.

I have tried passing in a tranposition of the MPEG scan matrix, but the output is pretty poor. The non-transposed scan matrix produces garbage output.

Can anyone shed some light on this?

Thanks in advance,
Peter Doege

19 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

could you take a look on the IPP manual (image processing volume), chapter 16 Video Coding, MPEG-1 and MPEG-2

Regards,
Vladimir

Hello Vladimir -

I've looked at the online docs and the IPP book. I am using a transposed matrix, but I am getting really lousy output.

According to pg. 16-30 of the docs, a transposed scan matrix is to be passed in as the 5th arg to ReconstructDCTBlockIntra().

So, I do that and the results are pretty aweful.

The original matrix, the 0th element of scan_1, is
{
0, 1, 8, 16,9, 2, 3, 10,
17,24,32,25,18,11,4, 5,
12,19,26,33,40,48,41,34,
27,20,13, 6, 7,14,21,28,
35,42,49,56,57,50,43,36,
29,22,15,23,30,37,44,51,
58,59,52,45,38,31,39,46,
53,60,61,54,47,55,62,63
}

I transpose it to
}
0,17,12,27,35,29,58,53,
1,24,19,20,42,22,59,60,
8,32,26,13,49,15,52,61,
16,25,33,6,56,23,45,54,
9,18,40, 7,57,30,38,47,
2,11,48,14,50,37,31,55,
3, 4,41,21,43,44,39,62,
10,5,34,28,36,51,46,63
}

and then pass it in. I do the same with the other elements of the arrays.

I will attach a screen shot of the affected video.

Any further ideas?

Peter

Hi Peter,

and sorry for mispoint you. I discussed your question with experts (developers of these function). The answer is there is misprint in documentation, you should not use de-quantization after this function because this operation is implemented inside of this function. We will correct documentation in next release.
Thank you for finding that.

Regards,
Vladimir

Hello -

I am still getting poor video quality using the DCT8x8Inv_AANTransposed functions. Does anyone have any source code that demonstrates the correct use of this function?

Peter

what does it mean "correct"? AAN is not able to met IEEE standard. you can use ippiDCT8x8Inv_16s which does

I wonder that
dq0[64] =
{
-21,-22,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,
}

dq1[64] =
{
-21,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,
}
by use the scanMatrix:
{
0, 1, 8,16, 9, 2, 3,10,
17,24,32,25,18,11, 4, 5,
12,19,26,33,40,48,41,34,
27,20,13, 6, 7,14,21,28,
35,42,49,56,57,50,43,36,
29,22,15,23,30,37,44,51,
58,59,52,45,38,31,39,46,
53,60,61,54,47,55,62,63
}
after execute the following functions:
ippiDCT8x8Inv_16s_C1R(dq1,idct1,16);

ippiDCT8x8Inv_16s_C1R(dq2,idct2,16);
I got the result:
idct1 =
{
-6,-6,-5,-3,-2,0,1,1,

-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1,
-6,-6,-5,-3,-2,0,1,1
}
idct2 =
{
-3,-3,-3,-3,-3,-3,-3,-3,

-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3}

How can I use ippiDCT8x8Inv_AANTransposed_16s_P2C2R() to get the
joined UV_Block as
{
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,

-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3,
-6,-3,-6,-3,-5,-3,-3,-3,-2,-3,0,-3,1,-3,1,-3}
I had tried the Transposed scanMatrix asPeter did but I can't get the result that I wanted.
Could U help me? Thx a lot and best regards.
loca_huang

Hello -

I have solved the problem that I was having and am posting here to help others with the same issue.

The correct scan matrix to use is:

int scanT_1[2][64] =
{
{
0, 8, 1, 2, 9, 16, 24, 17,
10, 3, 4, 11, 18, 25, 32, 40,
33, 26, 19, 12, 5, 6, 13, 20,
27, 34, 41, 48, 56, 49, 42, 35,
28, 21, 14, 7, 15, 22, 29, 36,
43, 50, 57, 58, 51, 44, 37, 30,
23, 31, 38, 45, 52, 59, 60, 53,
46, 39, 47, 54, 61, 62, 55, 63
},
{
0, 1, 2, 3, 8, 9, 16, 17,
10, 11, 4, 5, 6, 7, 15, 14,
13, 12, 19, 18, 24, 25, 32, 33,
26, 27, 20, 21, 22, 23, 28, 29,
30, 31, 34, 35, 40 ,41, 48, 49,
42, 43, 36, 37, 38, 39, 44, 45,
46, 47, 50, 51, 56, 57, 58, 59,
52, 53, 54, 55, 60, 61, 62, 63
}
};

Best of luck,
Peter Doege

Dear Peter:

Amazing......^_^ It works!
but, whythe matrix is the trasnposed matrix.....I've confused.
thanks a lot.

Intel does not mean a transposed matrix in the mathematical sense. They mean a matrix that converts from indices to elements.

So, in the above matrix
element 0 is at index 0
element 1 is at index 8
element 2 is at index 1
etc.

Hope this helps,
Peter

:smileyvery-happy: Got it ! Thank you for kindly helping me to realize.:smileyhappy:

After my implement, I did find out that the performace of ippiDCT8x8Inv_AANTransposed_16s8u_P2C2R() is so slow, even slow than
the total run time of tworuns of ippiDCT8x8InvLSClip_16s8u_C1R() and onerun of joined function which I wrote with SSE2, why?? Could any one tell me why?? Or teach me how to resolve the trick.
best regards.
loca_huang

Hi,

could you say on what platform did you run your test?

Regards,
Vladimir

CPU: P4-1.6GHz
RAM: DDR333 256MB
Mainboard:ASUS P4S533 with SiS 645DX chipset
VGA: NVIDIA GeForce2 MX400 with 64MB video ram
OS: windowXP
Programming: Visual C++
Media platform: Direct Show 9.0b without using Video Acceleration
that's all......
best regards
loca_huang

Hi Loca,

we think the reason can be data alignment. Could you please make sure you have data pointers aligned on 16 bytes boundary?

Hints, the easest way to achieve that is to use ippMalloc function, which takes care about memory alignment inside.

Regards,
Vladimir

Dear Vladimir:
After changing my original allocation function to be ippMalloc(), there is the same result I got. The following is my original allocation function.
#defineAllocMem(ptr, size)
{
void* orig;

orig = malloc(size + sizeof(void*) + 16);
ptr = (unsigned char*)orig + sizeof(void*) + 16 - (((unsigned long)orig +sizeof(void*) + 16)%16);
*(void**)((unsigned char*)ptr-sizeof(void*)) = orig;

}

#defineFreeMem(ptr)
free(*(void**)((unsigned char*)ptr - sizeof(void*)));

Is there any suggestion?
loca_huang

Hi, looks like your original allocation function aligns memory in the similar fashion as ippMalloc does. So, in this case you may not care about alignment. Well, it is interesting result, we will double check the performance of this function.
Thanks,
Vladimir

Deae Vladimir:
After my testing, I had find that this function is faster than the ippiDCT8x8Inv_16s8u_C1R() function when I set the parameter countU and countV to be zero, and is very slow otherwise. By the way, I need to set the parameters to be 64, and please don't forgetinforming me the checking result.
best regards
loca_huang

Hi,

well, I've looked at this function. It contains optimized code but not for the all branches. Internal function idct8x8_block_8u is just C code. I think thebackground for such decision was that in most of the cases number of non-zero DCT coefficients will be less than 8.

The pseudo code of this function looks like that:
ippiDCT8x8Inv_AANTransposed_16s8u_C1R (
const Ipp16s* pSrc,
Ipp8u* pDst,
int dstStep,
int count)
{
switch (count)
{
case 0: idct0x0_block_8u( pDst,dstStep,1); break;
case 1: idct1x1_block_8u(pSrc, pDst,dstStep,1); break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8: idct4x4_block_8u(pSrc, pDst,dstStep,1); break;
default: idct8x8_block_8u(pSrc, pDst,dstStep,1); break;
}
return ippStsOk;
}
You can take a look on performance results we delivered together with IPP. Please find them in IPPia32_itanium oolsperfsys folder.

Regards,
Vladimir

Login to leave a comment.