⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnggccrd.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
                 // png.c:  png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};               register int stride = 2 * png_pass_inc[png_ptr->pass];                 // png.c:  png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};               register int rep_bytes = 2 * png_pass_width[png_ptr->pass];                 // png.c:  png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};               register png_uint_32 final_val = 2 * png_ptr->width;               srcptr = png_ptr->row_buf + 1 + initial_val;               dstptr = row + initial_val;               for (i = initial_val; i < final_val; i += stride)               {                  png_memcpy(dstptr, srcptr, rep_bytes);                  srcptr += stride;                  dstptr += stride;               }             } /* end of else */            break;         }       // end 16 bpp         case 24:       // png_ptr->row_info.pixel_depth         {            png_bytep srcptr;            png_bytep dstptr;            if (mmx_supported)            {               png_uint_32 len;               int diff;#ifndef __PIC__               int unmask = ~mask;#else               _unmask = ~mask;            // global variable for -fPIC version#endif               srcptr = png_ptr->row_buf + 1;               dstptr = row;               len  = png_ptr->width &~7;  // reduce to multiple of 8               diff = png_ptr->width & 7;  // amount lost               __asm__ (#ifdef __PIC__                  "movd      _unmask, %%mm7   \n\t" // load bit pattern#else// preload        "movd      unmask, %%mm7    \n\t" // (unmask is in ebx)                  "movd      %%ebx, %%mm7     \n\t" // load bit pattern (unmask)#endif                  "psubb     %%mm6, %%mm6     \n\t" // zero mm6                  "punpcklbw %%mm7, %%mm7     \n\t"                  "punpcklwd %%mm7, %%mm7     \n\t"                  "punpckldq %%mm7, %%mm7     \n\t" // fill reg with 8 masks                  "movq      _mask24_0, %%mm0 \n\t"                  "movq      _mask24_1, %%mm1 \n\t"                  "movq      _mask24_2, %%mm2 \n\t"                  "pand      %%mm7, %%mm0     \n\t"                  "pand      %%mm7, %%mm1     \n\t"                  "pand      %%mm7, %%mm2     \n\t"                  "pcmpeqb   %%mm6, %%mm0     \n\t"                  "pcmpeqb   %%mm6, %%mm1     \n\t"                  "pcmpeqb   %%mm6, %%mm2     \n\t"// preload        "movl      len, %%ecx       \n\t" // load length of line// preload        "movl      srcptr, %%esi    \n\t" // load source// preload        "movl      dstptr, %%edi    \n\t" // load dest                  "cmpl      $0, %%ecx        \n\t"                  "jz        mainloop24end    \n\t"                "mainloop24:                  \n\t"                  "movq      (%%esi), %%mm4   \n\t"                  "pand      %%mm0, %%mm4     \n\t"                  "movq      %%mm0, %%mm6     \n\t"                  "movq      (%%edi), %%mm7   \n\t"                  "pandn     %%mm7, %%mm6     \n\t"                  "por       %%mm6, %%mm4     \n\t"                  "movq      %%mm4, (%%edi)   \n\t"                  "movq      8(%%esi), %%mm5  \n\t"                  "pand      %%mm1, %%mm5     \n\t"                  "movq      %%mm1, %%mm7     \n\t"                  "movq      8(%%edi), %%mm6  \n\t"                  "pandn     %%mm6, %%mm7     \n\t"                  "por       %%mm7, %%mm5     \n\t"                  "movq      %%mm5, 8(%%edi)  \n\t"                  "movq      16(%%esi), %%mm6 \n\t"                  "pand      %%mm2, %%mm6     \n\t"                  "movq      %%mm2, %%mm4     \n\t"                  "movq      16(%%edi), %%mm7 \n\t"                  "pandn     %%mm7, %%mm4     \n\t"                  "por       %%mm4, %%mm6     \n\t"                  "movq      %%mm6, 16(%%edi) \n\t"                  "addl      $24, %%esi       \n\t" // inc by 24 bytes processed                  "addl      $24, %%edi       \n\t"                  "subl      $8, %%ecx        \n\t" // dec by 8 pixels processed                  "ja        mainloop24       \n\t"                "mainloop24end:               \n\t"// preload        "movl      diff, %%ecx      \n\t" // (diff is in eax)                  "movl      %%eax, %%ecx     \n\t"                  "cmpl      $0, %%ecx        \n\t"                  "jz        end24            \n\t"// preload        "movl      mask, %%edx      \n\t"                  "sall      $24, %%edx       \n\t" // make low byte, high byte                "secondloop24:                \n\t"                  "sall      %%edx            \n\t" // move high bit to CF                  "jnc       skip24           \n\t" // if CF = 0                  "movw      (%%esi), %%ax    \n\t"                  "movw      %%ax, (%%edi)    \n\t"                  "xorl      %%eax, %%eax     \n\t"                  "movb      2(%%esi), %%al   \n\t"                  "movb      %%al, 2(%%edi)   \n\t"                "skip24:                      \n\t"                  "addl      $3, %%esi        \n\t"                  "addl      $3, %%edi        \n\t"                  "decl      %%ecx            \n\t"                  "jnz       secondloop24     \n\t"                "end24:                       \n\t"                  "EMMS                       \n\t" // DONE                  :                                 // output regs (none)                  : "S" (srcptr),      // esi       // input regs                    "D" (dstptr),      // edi                    "a" (diff),        // eax#ifndef __PIC__                    "b" (unmask),      // ebx       // Global Offset Table idx#endif                    "c" (len),         // ecx                    "d" (mask)         // edx                  : "%esi", "%edi", "%eax",         // clobber list                    "%ecx", "%edx"#if 0  /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */                  , "%mm0", "%mm1", "%mm2",                    "%mm4", "%mm5", "%mm6", "%mm7"#endif               );            }            else /* mmx _not supported - Use modified C routine */            {               register png_uint_32 i;               png_uint_32 initial_val = 3 * png_pass_start[png_ptr->pass];                 // png.c:  png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};               register int stride = 3 * png_pass_inc[png_ptr->pass];                 // png.c:  png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};               register int rep_bytes = 3 * png_pass_width[png_ptr->pass];                 // png.c:  png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};               register png_uint_32 final_val = 3 * png_ptr->width;               srcptr = png_ptr->row_buf + 1 + initial_val;               dstptr = row + initial_val;               for (i = initial_val; i < final_val; i += stride)               {                  png_memcpy(dstptr, srcptr, rep_bytes);                  srcptr += stride;                  dstptr += stride;               }             } /* end of else */            break;         }       // end 24 bpp         case 32:       // png_ptr->row_info.pixel_depth         {            png_bytep srcptr;            png_bytep dstptr;            if (mmx_supported)            {               png_uint_32 len;               int diff;#ifndef __PIC__               int unmask = ~mask;#else               _unmask = ~mask;            // global variable for -fPIC version#endif               srcptr = png_ptr->row_buf + 1;               dstptr = row;               len  = png_ptr->width &~7;  // reduce to multiple of 8               diff = png_ptr->width & 7;  // amount lost               __asm__ (#ifdef __PIC__                  "movd      _unmask, %%mm7   \n\t" // load bit pattern#else// preload        "movd      unmask, %%mm7    \n\t" // (unmask is in ebx)                  "movd      %%ebx, %%mm7     \n\t" // load bit pattern (unmask)#endif                  "psubb     %%mm6, %%mm6     \n\t" // zero mm6                  "punpcklbw %%mm7, %%mm7     \n\t"                  "punpcklwd %%mm7, %%mm7     \n\t"                  "punpckldq %%mm7, %%mm7     \n\t" // fill reg with 8 masks                  "movq      _mask32_0, %%mm0 \n\t"                  "movq      _mask32_1, %%mm1 \n\t"                  "movq      _mask32_2, %%mm2 \n\t"                  "movq      _mask32_3, %%mm3 \n\t"                  "pand      %%mm7, %%mm0     \n\t"                  "pand      %%mm7, %%mm1     \n\t"                  "pand      %%mm7, %%mm2     \n\t"                  "pand      %%mm7, %%mm3     \n\t"                  "pcmpeqb   %%mm6, %%mm0     \n\t"                  "pcmpeqb   %%mm6, %%mm1     \n\t"                  "pcmpeqb   %%mm6, %%mm2     \n\t"                  "pcmpeqb   %%mm6, %%mm3     \n\t"// preload        "movl      len, %%ecx       \n\t" // load length of line// preload        "movl      srcptr, %%esi    \n\t" // load source// preload        "movl      dstptr, %%edi    \n\t" // load dest                  "cmpl      $0, %%ecx        \n\t" // lcr                  "jz        mainloop32end    \n\t"                "mainloop32:                  \n\t"                  "movq      (%%esi), %%mm4   \n\t"                  "pand      %%mm0, %%mm4     \n\t"                  "movq      %%mm0, %%mm6     \n\t"                  "movq      (%%edi), %%mm7   \n\t"                  "pandn     %%mm7, %%mm6     \n\t"                  "por       %%mm6, %%mm4     \n\t"                  "movq      %%mm4, (%%edi)   \n\t"                  "movq      8(%%esi), %%mm5  \n\t"                  "pand      %%mm1, %%mm5     \n\t"                  "movq      %%mm1, %%mm7     \n\t"                  "movq      8(%%edi), %%mm6  \n\t"                  "pandn     %%mm6, %%mm7     \n\t"                  "por       %%mm7, %%mm5     \n\t"                  "movq      %%mm5, 8(%%edi)  \n\t"                  "movq      16(%%esi), %%mm6 \n\t"                  "pand      %%mm2, %%mm6     \n\t"                  "movq      %%mm2, %%mm4     \n\t"                  "movq      16(%%edi), %%mm7 \n\t"                  "pandn     %%mm7, %%mm4     \n\t"                  "por       %%mm4, %%mm6     \n\t"                  "movq      %%mm6, 16(%%edi) \n\t"                  "movq      24(%%esi), %%mm7 \n\t"                  "pand      %%mm3, %%mm7     \n\t"                  "movq      %%mm3, %%mm5     \n\t"                  "movq      24(%%edi), %%mm4 \n\t"                  "pandn     %%mm4, %%mm5     \n\t"                  "por       %%mm5, %%mm7     \n\t"                  "movq      %%mm7, 24(%%edi) \n\t"                  "addl      $32, %%esi       \n\t" // inc by 32 bytes processed                  "addl      $32, %%edi       \n\t"                  "subl      $8, %%ecx        \n\t" // dec by 8 pixels processed                  "ja        mainloop32       \n\t"                "mainloop32end:               \n\t"// preload        "movl      diff, %%ecx      \n\t" // (diff is in eax)                  "movl      %%eax, %%ecx     \n\t"                  "cmpl      $0, %%ecx        \n\t"                  "jz        end32            \n\t"// preload        "movl      mask, %%edx      \n\t"                  "sall      $24, %%edx       \n\t" // low byte => high byte                "secondloop32:                \n\t"                  "sall      %%edx            \n\t" // move high bit to CF                  "jnc       skip32           \n\t" // if CF = 0                  "movl      (%%esi), %%eax   \n\t"                  "movl      %%eax, (%%edi)   \n\t"                "skip32:                      \n\t"                  "addl      $4, %%esi        \n\t"                  "addl      $4, %%edi        \n\t"                  "decl      %%ecx            \n\t"                  "jnz       secondloop32     \n\t"                "end32:                       \n\t"                  "EMMS                       \n\t" // DONE                  :                                 // output regs (none)                  : "S" (srcptr),      // esi       // input regs                    "D" (dstptr),      // edi                    "a" (diff),        // eax#ifndef __PIC__                    "b" (unmask),      // ebx       // Global Offset Table idx#endif                    "c" (len),         // ecx                    "d" (mask)         // edx                  : "%esi", "%edi", "%eax",         // clobber list                    "%ecx", "%edx"#if 0  /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */                  , "%mm0", "%mm1", "%mm2", "%mm3",                    "%mm4", "%mm5", "%mm6", "%mm7"#endif               );            }            else /* mmx _not supported - Use modified C routine */            {               register png_uint_32 i;               png_uint_32 initial_val = 4 * png_pass_start[png_ptr->pass];                 // png.c:  png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};               register int stride = 4 * png_pass_inc[png_ptr->pass];                 // png.c:  png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};               register int rep_bytes = 4 * png_pass_width[png_ptr->pass];                 // png.c:  png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};               register png_uint_32 final_val = 4 * png_ptr->width;               srcptr = png_ptr->row_buf + 1 + initial_val;               dstptr = row + initial_val;               for (i = initial_val; i < final_val; i += stride)               {                  png_memcpy(dstptr, srcptr, rep_bytes);                  srcptr += stride;                  dstptr += stride;               }            } /* end of else */            break;         }       // end 32 bpp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -