VirtualBox

Ignore:
Timestamp:
Feb 12, 2024 3:57:56 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161613
Message:

libpng-1.6.42: Applied and adjusted our libpng changes to 1.6.42. bugref:8515

Location:
trunk/src/libs/libpng-1.6.42/mips
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/libpng-1.6.42/mips/filter_msa_intrinsics.c

    r96425 r103316  
    22/* filter_msa_intrinsics.c - MSA optimised filter functions
    33 *
    4  * Copyright (c) 2018 Cosmin Truta
     4 * Copyright (c) 2018-2024 Cosmin Truta
    55 * Copyright (c) 2016 Glenn Randers-Pehrson
    6  * Written by Mandar Sahastrabuddhe, August 2016.
     6 * Written by Mandar Sahastrabuddhe, August 2016
    77 *
    88 * This code is released under the libpng license.
     
    1212
    1313#include <stdio.h>
    14 #include <stdint.h>
    1514#include "../pngpriv.h"
    1615
     
    2120
    2221#include <msa.h>
     22#include <stdint.h>
    2323
    2424/* libpng row pointers are not necessarily aligned to any particular boundary,
     
    380380      pp += 64;
    381381
    382           ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
    383                src0, src1, src2, src3);
     382      ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
     383           src0, src1, src2, src3);
    384384
    385385      ST_UB4(src0, src1, src2, src3, rp, 16);
     
    401401
    402402            ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
    403                      src0, src1, src2, src3);
     403                 src0, src1, src2, src3);
    404404
    405405            ST_UB4(src0, src1, src2, src3, rp, 16);
     
    426426            LD_UB2(pp, 16, src4, src5);
    427427
    428                         ADD2(src0, src4, src1, src5, src0, src1);
     428            ADD2(src0, src4, src1, src5, src0, src1);
    429429
    430430            ST_UB2(src0, src1, rp, 16);
  • trunk/src/libs/libpng-1.6.42/mips/mips_init.c

    r96425 r103316  
    22/* mips_init.c - MSA optimised filter functions
    33 *
    4  * Copyright (c) 2018 Cosmin Truta
     4 * Copyright (c) 2018-2024 Cosmin Truta
    55 * Copyright (c) 2016 Glenn Randers-Pehrson
    6  * Written by Mandar Sahastrabuddhe, 2016.
     6 * Written by Mandar Sahastrabuddhe, 2016
     7 * Updated by guxiwei, 2023
    78 *
    89 * This code is released under the libpng license.
     
    2122#ifdef PNG_READ_SUPPORTED
    2223
    23 #if PNG_MIPS_MSA_OPT > 0
    24 #ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do run-time checks */
     24#if PNG_MIPS_MSA_IMPLEMENTATION == 1 || PNG_MIPS_MMI_IMPLEMENTATION > 0
     25
     26#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do MIPS MSA run-time checks */
    2527/* WARNING: it is strongly recommended that you do not build libpng with
    2628 * run-time checks for CPU features if at all possible.  In the case of the MIPS
     
    5254#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
    5355
     56#ifdef PNG_MIPS_MMI_CHECK_SUPPORTED /* Do MIPS MMI run-times checks */
     57#ifndef PNG_MIPS_MMI_FILE
     58#  ifdef __linux__
     59#     define PNG_MIPS_MMI_FILE "contrib/mips-mmi/linux.c"
     60#  endif
     61#endif
     62
     63#ifdef PNG_MIPS_MMI_FILE
     64
     65#include <signal.h> /* for sig_atomic_t */
     66static int png_have_mmi();
     67#include PNG_MIPS_MMI_FILE
     68
     69#else  /* PNG_MIPS_MMI_FILE */
     70#  error "PNG_MIPS_MMI_FILE undefined: no support for run-time MIPS MMI checks"
     71#endif /* PNG_MIPS_MMI_FILE */
     72#endif /* PNG_MIPS_MMI_CHECK_SUPPORTED*/
     73
    5474#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
    5575#  error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
    5676#endif
    5777
     78/* MIPS supports two optimizations: MMI and MSA. The appropriate
     79 * optimization is chosen at runtime
     80 */
    5881void
    59 png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
     82png_init_filter_functions_mips(png_structp pp, unsigned int bpp)
    6083{
     84#if PNG_MIPS_MMI_IMPLEMENTATION  > 0
     85#ifdef PNG_MIPS_MMI_API_SUPPORTED
     86   switch ((pp->options >> PNG_MIPS_MMI) & 3)
     87   {
     88      case PNG_OPTION_UNSET:
     89#endif /* PNG_MIPS_MMI_API_SUPPORTED */
     90#ifdef PNG_MIPS_MMI_CHECK_SUPPORTED
     91         {
     92            static volatile sig_atomic_t no_mmi = -1; /* not checked */
     93
     94            if (no_mmi < 0)
     95               no_mmi = !png_have_mmi();
     96
     97            if (no_mmi)
     98              goto MIPS_MSA_INIT;
     99         }
     100#ifdef PNG_MIPS_MMI_API_SUPPORTED
     101         break;
     102#endif
     103#endif /* PNG_MIPS_MMI_CHECK_SUPPORTED */
     104
     105#ifdef PNG_MIPS_MMI_API_SUPPORTED
     106      default: /* OFF or INVALID */
     107         goto MIPS_MSA_INIT;
     108
     109      case PNG_OPTION_ON:
     110         /* Option turned on */
     111         break;
     112   }
     113#endif
     114   pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_mmi;
     115   if (bpp == 3)
     116   {
     117      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_mmi;
     118      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_mmi;
     119      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
     120         png_read_filter_row_paeth3_mmi;
     121   }
     122   else if (bpp == 4)
     123   {
     124      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_mmi;
     125      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_mmi;
     126      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
     127          png_read_filter_row_paeth4_mmi;
     128   }
     129#endif /* PNG_MIPS_MMI_IMPLEMENTATION > 0 */
     130
     131MIPS_MSA_INIT:
     132#if PNG_MIPS_MSA_IMPLEMENTATION == 1
    61133   /* The switch statement is compiled in for MIPS_MSA_API, the call to
    62134    * png_have_msa is compiled in for MIPS_MSA_CHECK. If both are defined
     
    126198      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa;
    127199   }
     200#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 */
     201   return;
    128202}
    129 #endif /* PNG_MIPS_MSA_OPT > 0 */
     203#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 || PNG_MIPS_MMI_IMPLEMENTATION > 0 */
    130204#endif /* READ */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette