~ubuntu-branches/ubuntu/raring/perl-tk/raring

« back to all changes in this revision

Viewing changes to PNG/libpng/pngvcrd.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Tuckley
  • Date: 2008-02-15 13:56:59 UTC
  • mfrom: (1.1.3 upstream) (4.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080215135659-ru2oqlykuju20fav
Tags: 1:804.028-1
* New Upstream Release (Closes: #463080).
* Update to Debhelper v5.
* Build with XFT=1 (Closes: #411129).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
1
2
/* pngvcrd.c - mixed C/assembler version of utilities to read a PNG file
2
3
 *
3
4
 * For Intel x86 CPU and Microsoft Visual C++ compiler
4
5
 *
5
 
 * libpng version 1.2.5 - October 3, 2002
 
6
 * Last changed in libpng 1.2.6 - August 15, 2004
6
7
 * For conditions of distribution and use, see copyright notice in png.h
7
 
 * Copyright (c) 1998-2002 Glenn Randers-Pehrson
 
8
 * Copyright (c) 1998-2004 Glenn Randers-Pehrson
8
9
 * Copyright (c) 1998, Intel Corporation
9
10
 *
10
11
 * Contributed by Nirav Chhatrapati, Intel Corporation, 1998
115
116
   png_debug(1,"in png_combine_row_asm\n");
116
117
 
117
118
   if (mmx_supported == 2) {
 
119
#if !defined(PNG_1_0_X)
118
120
       /* this should have happened in png_init_mmx_flags() already */
119
121
       png_warning(png_ptr, "asm_flags may not have been initialized");
 
122
#endif
120
123
       png_mmx_support();
121
124
   }
122
125
 
123
126
   if (mask == 0xff)
124
127
   {
125
128
      png_memcpy(row, png_ptr->row_buf + 1,
126
 
       (png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
 
129
       (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
 
130
       png_ptr->width));
127
131
   }
128
132
   /* GRR:  add "else if (mask == 0)" case?
129
133
    *       or does png_combine_row() not even get called in that case? */
307
311
 
308
312
            __int64 mask0=0x0102040810204080;
309
313
 
 
314
#if !defined(PNG_1_0_X)
310
315
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
311
316
                /* && mmx_supported */ )
 
317
#else
 
318
            if (mmx_supported)
 
319
#endif
312
320
            {
313
321
               srcptr = png_ptr->row_buf + 1;
314
322
               dstptr = row;
408
416
            __int64 mask1=0x0101020204040808,
409
417
                    mask0=0x1010202040408080;
410
418
 
 
419
#if !defined(PNG_1_0_X)
411
420
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
412
421
                /* && mmx_supported */ )
 
422
#else
 
423
            if (mmx_supported)
 
424
#endif
413
425
            {
414
426
               srcptr = png_ptr->row_buf + 1;
415
427
               dstptr = row;
529
541
            len     = (png_ptr->width)&~7;
530
542
            diff = (png_ptr->width)&7;
531
543
 
 
544
#if !defined(PNG_1_0_X)
532
545
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
533
546
                /* && mmx_supported */ )
 
547
#else
 
548
            if (mmx_supported)
 
549
#endif
534
550
            {
535
551
               _asm
536
552
               {
661
677
            len     = (png_ptr->width)&~7;
662
678
            diff = (png_ptr->width)&7;
663
679
 
 
680
#if !defined(PNG_1_0_X)
664
681
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
665
682
                /* && mmx_supported */ )
 
683
#else
 
684
            if (mmx_supported)
 
685
#endif
666
686
            {
667
687
               _asm
668
688
               {
796
816
                    mask1=0x2020202040404040,
797
817
                    mask0=0x4040808080808080;
798
818
 
 
819
#if !defined(PNG_1_0_X)
799
820
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
800
821
                /* && mmx_supported */ )
 
822
#else
 
823
            if (mmx_supported)
 
824
#endif
801
825
            {
802
826
               srcptr = png_ptr->row_buf + 1;
803
827
               dstptr = row;
987
1011
   png_debug(1,"in png_do_read_interlace\n");
988
1012
 
989
1013
   if (mmx_supported == 2) {
 
1014
#if !defined(PNG_1_0_X)
990
1015
       /* this should have happened in png_init_mmx_flags() already */
991
1016
       png_warning(png_ptr, "asm_flags may not have been initialized");
 
1017
#endif
992
1018
       png_mmx_support();
993
1019
   }
994
1020
 
1189
1215
            // NOTE:  there is NO MMX code for 48-bit and 64-bit images
1190
1216
 
1191
1217
            // use MMX routine if machine supports it
 
1218
#if !defined(PNG_1_0_X)
1192
1219
            if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
1193
1220
                /* && mmx_supported */ )
 
1221
#else
 
1222
            if (mmx_supported)
 
1223
#endif
1194
1224
            {
1195
1225
               if (pixel_bytes == 3)
1196
1226
               {
1874
1904
      } /* end switch (row_info->pixel_depth) */
1875
1905
 
1876
1906
      row_info->width = final_width;
1877
 
      row_info->rowbytes = ((final_width *
1878
 
         (png_uint_32)row_info->pixel_depth + 7) >> 3);
 
1907
 
 
1908
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
1879
1909
   }
1880
1910
 
1881
1911
}
3603
3633
      jz dupend
3604
3634
 
3605
3635
 
3606
 
      // 2 lines added by lcreeve@netins.net
 
3636
      // 2 lines added by lcreeve at netins.net
3607
3637
      // (mail 11 Jul 98 in png-implement list)
3608
3638
      cmp edx, 8 //test for less than 8 bytes
3609
3639
      jb duplt8
3652
3682
#endif
3653
3683
 
3654
3684
   if (mmx_supported == 2) {
 
3685
#if !defined(PNG_1_0_X)
3655
3686
       /* this should have happened in png_init_mmx_flags() already */
3656
3687
       png_warning(png_ptr, "asm_flags may not have been initialized");
 
3688
#endif
3657
3689
       png_mmx_support();
3658
3690
   }
3659
3691
 
3663
3695
   {
3664
3696
      case 0: sprintf(filnm, "none");
3665
3697
         break;
 
3698
#if !defined(PNG_1_0_X)
3666
3699
      case 1: sprintf(filnm, "sub-%s",
3667
3700
        (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86");
3668
3701
         break;
3675
3708
      case 4: sprintf(filnm, "Paeth-%s",
3676
3709
        (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86");
3677
3710
         break;
 
3711
#else
 
3712
      case 1: sprintf(filnm, "sub");
 
3713
         break;
 
3714
      case 2: sprintf(filnm, "up");
 
3715
         break;
 
3716
      case 3: sprintf(filnm, "avg");
 
3717
         break;
 
3718
      case 4: sprintf(filnm, "Paeth");
 
3719
         break;
 
3720
#endif
3678
3721
      default: sprintf(filnm, "unknw");
3679
3722
         break;
3680
3723
   }
3691
3734
 
3692
3735
      case PNG_FILTER_VALUE_SUB:
3693
3736
      {
 
3737
#if !defined(PNG_1_0_X)
3694
3738
         if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
3695
3739
             (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
3696
3740
             (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
 
3741
#else
 
3742
         if (mmx_supported)
 
3743
#endif
3697
3744
         {
3698
3745
            png_read_filter_row_mmx_sub(row_info, row);
3699
3746
         }
3716
3763
 
3717
3764
      case PNG_FILTER_VALUE_UP:
3718
3765
      {
 
3766
#if !defined(PNG_1_0_X)
3719
3767
         if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
3720
3768
             (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
3721
3769
             (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
 
3770
#else
 
3771
         if (mmx_supported)
 
3772
#endif
3722
3773
         {
3723
3774
            png_read_filter_row_mmx_up(row_info, row, prev_row);
3724
3775
         }
3740
3791
 
3741
3792
      case PNG_FILTER_VALUE_AVG:
3742
3793
      {
 
3794
#if !defined(PNG_1_0_X)
3743
3795
         if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
3744
3796
             (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
3745
3797
             (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
 
3798
#else
 
3799
         if (mmx_supported)
 
3800
#endif
3746
3801
         {
3747
3802
            png_read_filter_row_mmx_avg(row_info, row, prev_row);
3748
3803
         }
3774
3829
 
3775
3830
      case PNG_FILTER_VALUE_PAETH:
3776
3831
      {
 
3832
#if !defined(PNG_1_0_X)
3777
3833
         if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
3778
3834
             (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
3779
3835
             (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
 
3836
#else
 
3837
         if (mmx_supported)
 
3838
#endif
3780
3839
         {
3781
3840
            png_read_filter_row_mmx_paeth(row_info, row, prev_row);
3782
3841
         }