Hello,
    I finally discovered the answer to my previous question:

"what modifications libmpeg2 does in a block before it enter in the IDCT
functions?"

So, the 64 values of a block are multiplied by 16 and reordered. And the
IDCT
functions of libmpeg2 know this and its output are the same of a "default"
IDCT
(DCT type-3), of course. I would like to thank Dmitriy Startsev that tell me
about the scaled by 16. And the reordering I discovered by myself. And only
after this I saw a email of Matthew Fullerton that answering a question of
Uros damnjanovic
(Re: [mpeg2-dev] Extracting DCT coefficients for each frame - coefficient
order)
and brought the inverse reorder that I was looking for... ;p
    Below are the mapping to reorder libmpeg2 IDCT input to the "default"
IDCT
input, and the inverse reorder mapping ("default" IDCT input to libmpeg2
IDCT input).

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

    A function that maps a libmpeg2 IDCT input to the "default" IDCT input
can
be:

// Hard-coded way:
void libmpeg2ToNormal(short * block) {
    short aux[64];

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

    int i;
    for (i = 0; i < 64; ++ i) {
        block[i] = aux[i] / 16;
    }
}

2007/11/30, Mateus Krepsky Ludwich < [EMAIL PROTECTED]>:
>
> Hi,
>     I see in pratice and in emails of the past
> ([mpeg2-dev] Re: mpeg2-dev Scan order - 2004-02-19, and
> Re: [mpeg2-dev] about the idct! - 2004-04-30)
> that the IDCT of two dimensions performed by idct_row and idct_col
> operating
> together (how we can see in mpeg2_idct_copy_c and mpeg2_idct_copy_add), in
>
> libmpeg2 are different of a "default" IDCT (DCT type-3). But in a
> experiment
> that I have to do, I would like to use the "default" IDCT. So I need
> by pass the modifications done in a block before do the IDCT or apply a
> function that remove this modifications. But I don't know what
> modifications
> exist, strictly speaking. I see that mpeg2_idct_init changes the order of
> mpeg2_scan_norm and mpeg2_scan_alt, and functions that "reconstructs" the
> block, like get_intra_block_B14 use this vectors. So I can see a
> reordering of
> block in here. Where are and who are the others modifications?
>     Another question, the values of block parameter in mpeg2_idct_copy_c
> and
> mpeg2_idct_add_c functions, after the loop that do the IDCT:
> " for (i = 0; i < 8; i++)
>     idct_row (block + 8 * i);
>     for (i = 0; i < 8; i++)
>     idct_col (block + i); "
> are the same if I use a "default" IDCT, right? Because the IDCTs "at the
> end"
> must be the same, right?
>
> Thanks!
>
> Mateus Krepsky Ludwich.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Libmpeg2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel

Reply via email to