Revision be449fca libpostproc/postprocess_template.c

View differences:

libpostproc/postprocess_template.c
63 63
static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
64 64
    int numEq= 0, dcOk;
65 65
    src+= stride*4; // src points to begin of the 8x8 Block
66
    asm volatile(
66
    __asm__ volatile(
67 67
        "movq %0, %%mm7                         \n\t"
68 68
        "movq %1, %%mm6                         \n\t"
69 69
        : : "m" (c->mmxDcOffset[c->nonBQP]),  "m" (c->mmxDcThreshold[c->nonBQP])
70 70
        );
71 71

  
72
    asm volatile(
72
    __asm__ volatile(
73 73
        "lea (%2, %3), %%"REG_a"                \n\t"
74 74
//      0       1       2       3       4       5       6       7       8       9
75 75
//      %1      eax     eax+%2  eax+2%2 %1+4%2  ecx     ecx+%2  ecx+2%2 %1+8%2  ecx+4%2
......
181 181
{
182 182
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
183 183
    src+= stride*3;
184
    asm volatile(        //"movv %0 %1 %2\n\t"
184
    __asm__ volatile(        //"movv %0 %1 %2\n\t"
185 185
        "movq %2, %%mm0                         \n\t"  // QP,..., QP
186 186
        "pxor %%mm4, %%mm4                      \n\t"
187 187

  
......
367 367
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
368 368
    src+= stride*3;
369 369
// FIXME rounding
370
    asm volatile(
370
    __asm__ volatile(
371 371
        "pxor %%mm7, %%mm7                      \n\t" // 0
372 372
        "movq "MANGLE(b80)", %%mm6              \n\t" // MIN_SIGNED_BYTE
373 373
        "leal (%0, %1), %%"REG_a"               \n\t"
......
465 465
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
466 466
    src+= stride*3;
467 467

  
468
    asm volatile(
468
    __asm__ volatile(
469 469
        "pxor %%mm7, %%mm7                      \n\t" // 0
470 470
        "lea (%0, %1), %%"REG_a"                \n\t"
471 471
        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
......
604 604
    memcpy(tmp+8, src+stride*8, 8);
605 605
*/
606 606
    src+= stride*4;
607
    asm volatile(
607
    __asm__ volatile(
608 608

  
609 609
#if 0 //slightly more accurate and slightly slower
610 610
        "pxor %%mm7, %%mm7                      \n\t" // 0
......
871 871
*/
872 872
#elif defined (HAVE_MMX)
873 873
    src+= stride*4;
874
    asm volatile(
874
    __asm__ volatile(
875 875
        "pxor %%mm7, %%mm7                      \n\t"
876 876
        "lea -40(%%"REG_SP"), %%"REG_c"         \n\t" // make space for 4 8-byte vars
877 877
        "and "ALIGN_MASK", %%"REG_c"            \n\t" // align
......
1147 1147
static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
1148 1148
{
1149 1149
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1150
    asm volatile(
1150
    __asm__ volatile(
1151 1151
        "pxor %%mm6, %%mm6                      \n\t"
1152 1152
        "pcmpeqb %%mm7, %%mm7                   \n\t"
1153 1153
        "movq %2, %%mm0                         \n\t"
......
1431 1431
                f= (f + 8)>>4;
1432 1432

  
1433 1433
#ifdef DEBUG_DERING_THRESHOLD
1434
                    asm volatile("emms\n\t":);
1434
                    __asm__ volatile("emms\n\t":);
1435 1435
                    {
1436 1436
                    static long long numPixels=0;
1437 1437
                    if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
......
1501 1501
{
1502 1502
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1503 1503
    src+= 4*stride;
1504
    asm volatile(
1504
    __asm__ volatile(
1505 1505
        "lea (%0, %1), %%"REG_a"                \n\t"
1506 1506
        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
1507 1507
//      0       1       2       3       4       5       6       7       8       9
......
1554 1554
{
1555 1555
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1556 1556
    src+= stride*3;
1557
    asm volatile(
1557
    __asm__ volatile(
1558 1558
        "lea (%0, %1), %%"REG_a"                \n\t"
1559 1559
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1560 1560
        "lea (%%"REG_d", %1, 4), %%"REG_c"      \n\t"
......
1618 1618
{
1619 1619
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1620 1620
    src+= stride*4;
1621
    asm volatile(
1621
    __asm__ volatile(
1622 1622
        "lea (%0, %1), %%"REG_a"                \n\t"
1623 1623
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1624 1624
        "pxor %%mm7, %%mm7                      \n\t"
......
1697 1697
{
1698 1698
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1699 1699
    src+= stride*4;
1700
    asm volatile(
1700
    __asm__ volatile(
1701 1701
        "lea (%0, %1), %%"REG_a"                \n\t"
1702 1702
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1703 1703
        "pxor %%mm7, %%mm7                      \n\t"
......
1798 1798
{
1799 1799
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1800 1800
    src+= 4*stride;
1801
    asm volatile(
1801
    __asm__ volatile(
1802 1802
        "lea (%0, %1), %%"REG_a"                \n\t"
1803 1803
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1804 1804
//      0       1       2       3       4       5       6       7       8       9
......
1900 1900
#ifdef HAVE_MMX
1901 1901
    src+= 4*stride;
1902 1902
#ifdef HAVE_MMX2
1903
    asm volatile(
1903
    __asm__ volatile(
1904 1904
        "lea (%0, %1), %%"REG_a"                \n\t"
1905 1905
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1906 1906
//      0       1       2       3       4       5       6       7       8       9
......
1949 1949
    );
1950 1950

  
1951 1951
#else // MMX without MMX2
1952
    asm volatile(
1952
    __asm__ volatile(
1953 1953
        "lea (%0, %1), %%"REG_a"                \n\t"
1954 1954
        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
1955 1955
//      0       1       2       3       4       5       6       7       8       9
......
2018 2018
 */
2019 2019
static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
2020 2020
{
2021
    asm(
2021
    __asm__(
2022 2022
        "lea (%0, %1), %%"REG_a"                \n\t"
2023 2023
//      0       1       2       3       4       5       6       7       8       9
2024 2024
//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
......
2103 2103
 */
2104 2104
static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
2105 2105
{
2106
    asm(
2106
    __asm__(
2107 2107
        "lea (%0, %1), %%"REG_a"                \n\t"
2108 2108
        "lea (%%"REG_a",%1,4), %%"REG_d"        \n\t"
2109 2109
//      0       1       2       3       4       5       6       7       8       9
......
2192 2192
#define FAST_L2_DIFF
2193 2193
//#define L1_DIFF //u should change the thresholds too if u try that one
2194 2194
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
2195
    asm volatile(
2195
    __asm__ volatile(
2196 2196
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
2197 2197
        "lea (%2, %2, 4), %%"REG_d"             \n\t" // 5*stride
2198 2198
        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
......
2575 2575
    int64_t sums[10*8*2];
2576 2576
    src+= step*3; // src points to begin of the 8x8 Block
2577 2577
//START_TIMER
2578
    asm volatile(
2578
    __asm__ volatile(
2579 2579
        "movq %0, %%mm7                         \n\t"
2580 2580
        "movq %1, %%mm6                         \n\t"
2581 2581
        : : "m" (c->mmxDcOffset[c->nonBQP]),  "m" (c->mmxDcThreshold[c->nonBQP])
2582 2582
        );
2583 2583

  
2584
    asm volatile(
2584
    __asm__ volatile(
2585 2585
        "lea (%2, %3), %%"REG_a"                \n\t"
2586 2586
//      0       1       2       3       4       5       6       7       8       9
2587 2587
//      %1      eax     eax+%2  eax+2%2 %1+4%2  ecx     ecx+%2  ecx+2%2 %1+8%2  ecx+4%2
......
2686 2686
        long offset= -8*step;
2687 2687
        int64_t *temp_sums= sums;
2688 2688

  
2689
        asm volatile(
2689
        __asm__ volatile(
2690 2690
            "movq %2, %%mm0                         \n\t"  // QP,..., QP
2691 2691
            "pxor %%mm4, %%mm4                      \n\t"
2692 2692

  
......
2825 2825

  
2826 2826
        src+= step; // src points to begin of the 8x8 Block
2827 2827

  
2828
        asm volatile(
2828
        __asm__ volatile(
2829 2829
            "movq %4, %%mm6                         \n\t"
2830 2830
            "pcmpeqb %%mm5, %%mm5                   \n\t"
2831 2831
            "pxor %%mm6, %%mm5                      \n\t"
......
2864 2864

  
2865 2865
    if(eq_mask != -1LL){
2866 2866
        uint8_t *temp_src= src;
2867
        asm volatile(
2867
        __asm__ volatile(
2868 2868
            "pxor %%mm7, %%mm7                      \n\t"
2869 2869
            "lea -40(%%"REG_SP"), %%"REG_c"         \n\t" // make space for 4 8-byte vars
2870 2870
            "and "ALIGN_MASK", %%"REG_c"            \n\t" // align
......
3121 3121
#endif
3122 3122
    if(levelFix){
3123 3123
#ifdef HAVE_MMX
3124
    asm volatile(
3124
    __asm__ volatile(
3125 3125
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
3126 3126
        "movq 8(%%"REG_a"), %%mm3       \n\t" // packedYScale
3127 3127
        "lea (%2,%4), %%"REG_a"         \n\t"
......
3204 3204
#endif //HAVE_MMX
3205 3205
    }else{
3206 3206
#ifdef HAVE_MMX
3207
    asm volatile(
3207
    __asm__ volatile(
3208 3208
        "lea (%0,%2), %%"REG_a"                 \n\t"
3209 3209
        "lea (%1,%3), %%"REG_d"                 \n\t"
3210 3210

  
......
3244 3244
static inline void RENAME(duplicate)(uint8_t src[], int stride)
3245 3245
{
3246 3246
#ifdef HAVE_MMX
3247
    asm volatile(
3247
    __asm__ volatile(
3248 3248
        "movq (%0), %%mm0               \n\t"
3249 3249
        "add %1, %0                     \n\t"
3250 3250
        "movq %%mm0, (%0)               \n\t"
......
3392 3392
            prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
3393 3393
*/
3394 3394

  
3395
            asm(
3395
            __asm__(
3396 3396
                "mov %4, %%"REG_a"              \n\t"
3397 3397
                "shr $2, %%"REG_a"              \n\t"
3398 3398
                "and $6, %%"REG_a"              \n\t"
......
3508 3508
            }
3509 3509
            c.QP= QP;
3510 3510
#ifdef HAVE_MMX
3511
            asm volatile(
3511
            __asm__ volatile(
3512 3512
                "movd %1, %%mm7         \n\t"
3513 3513
                "packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
3514 3514
                "packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
......
3528 3528
            prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
3529 3529
*/
3530 3530

  
3531
            asm(
3531
            __asm__(
3532 3532
                "mov %4, %%"REG_a"              \n\t"
3533 3533
                "shr $2, %%"REG_a"              \n\t"
3534 3534
                "and $6, %%"REG_a"              \n\t"
......
3700 3700
        }*/
3701 3701
    }
3702 3702
#ifdef HAVE_3DNOW
3703
    asm volatile("femms");
3703
    __asm__ volatile("femms");
3704 3704
#elif defined (HAVE_MMX)
3705
    asm volatile("emms");
3705
    __asm__ volatile("emms");
3706 3706
#endif
3707 3707

  
3708 3708
#ifdef DEBUG_BRIGHTNESS

Also available in: Unified diff