tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

riscv_init.c (1420B)


      1 /* riscv_init.c - RISC-V Vector optimized filter functions
      2 *
      3 * Copyright (c) 2023 Google LLC
      4 * Written by DragoČ™ Tiselice <dtiselice@google.com>, May 2023.
      5 *            Filip Wasil     <f.wasil@samsung.com>, March 2025.
      6 * This code is released under the libpng license.
      7 * For conditions of distribution and use, see the disclaimer
      8 * and license in png.h
      9 */
     10 
     11 #include "../pngpriv.h"
     12 
     13 #ifdef PNG_READ_SUPPORTED
     14 
     15 #if PNG_RISCV_RVV_IMPLEMENTATION == 1
     16 
     17 #include <riscv_vector.h>
     18 
     19 #ifndef PNG_ALIGNED_MEMORY_SUPPORTED
     20 #  error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
     21 #endif
     22 
     23 void
     24 png_init_filter_functions_rvv(png_structp pp, unsigned int bpp)
     25 {
     26   png_debug(1, "in png_init_filter_functions_rvv");
     27 
     28   pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_rvv;
     29 
     30   if (bpp == 3)
     31   {
     32      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_rvv;
     33      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_rvv;
     34      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_rvv;
     35   }
     36   else if (bpp == 4)
     37   {
     38      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_rvv;
     39      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_rvv;
     40      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_rvv;
     41   }
     42 }
     43 
     44 #endif /* PNG_RISCV_RVV_IMPLEMENTATION == 1 */
     45 #endif /* PNG_READ_SUPPORTED */