Merge branch 'upstream' into tizen_base 91/302891/2 accepted/tizen_base accepted/tizen_base_asan accepted/tizen_base_riscv accepted/tizen_base_toolchain tizen_base accepted/tizen/base/20240104.002451 accepted/tizen/base/asan/20240422.015010 accepted/tizen/base/riscv/20240105.012223 accepted/tizen/base/toolchain/20240124.003911
authorJiyong <jiyong.min@samsung.com>
Fri, 15 Dec 2023 05:09:13 +0000 (14:09 +0900)
committerJiyong <jiyong.min@samsung.com>
Fri, 15 Dec 2023 06:49:44 +0000 (15:49 +0900)
Change-Id: I0338ad087c7e5edf795c6f10b325424af8d7e240

1  2 
CMakeLists.txt
jconfig.h.in
jdcoefct.c
jdmerge.c
jpeglib.h
jquant2.c
packaging/libjpeg-turbo.spec
simd/arm/aarch32/jsimd.c
simd/jsimd.h
tjbench.c
tjunittest.c

diff --cc CMakeLists.txt
Simple merge
diff --cc jconfig.h.in
@@@ -9,13 -9,10 +9,13 @@@
  /* libjpeg-turbo version in integer form */
  #define LIBJPEG_TURBO_VERSION_NUMBER  @LIBJPEG_TURBO_VERSION_NUMBER@
  
- /* Support arithmetic encoding */
 +/* for product VD */
 +#define COLOR_PICKER_ENABLE @COLOR_PICKER_ENABLE@
 +
+ /* Support arithmetic encoding when using 8-bit samples */
  #cmakedefine C_ARITH_CODING_SUPPORTED 1
  
- /* Support arithmetic decoding */
+ /* Support arithmetic decoding when using 8-bit samples */
  #cmakedefine D_ARITH_CODING_SUPPORTED 1
  
  /* Support in-memory source/destination managers */
diff --cc jdcoefct.c
@@@ -89,40 -90,10 +90,40 @@@ decompress_onepass(j_decompress_ptr cin
    JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
    JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
    int blkn, ci, xindex, yindex, yoffset, useful_width;
-   JSAMPARRAY output_ptr;
+   _JSAMPARRAY output_ptr;
    JDIMENSION start_col, output_col;
    jpeg_component_info *compptr;
-   inverse_DCT_method_ptr inverse_DCT;
+   _inverse_DCT_method_ptr inverse_DCT;
 +#if _USE_PRODUCT_TV
 +  /* region decoding. this limits decode to the set of blocks +- 1 outside
 +   * bounding blocks around the desired region to decode */
 +  int blk1 = 0, blk2 = 0, skip = 0;
 +
 +  if ((cinfo->region_w > 0) && (cinfo->region_h > 0)) {
 +    int bsz_w = 0, bsz_h = 0;
 +
 +    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
 +      compptr = cinfo->cur_comp_info[ci];
 +      if (compptr->MCU_sample_width > bsz_w)
 +        bsz_w = compptr->MCU_sample_width;
 +      if ((compptr->MCU_height * 8) > bsz_h)
 +        bsz_h = compptr->MCU_height * 8;
 +    }
 +    int _region_y = (int)cinfo->region_y;
 +    _region_y = (_region_y>>1)<<1;
 +    if (((int)cinfo->output_scanline < (_region_y - bsz_h - 1)) ||
 +        ((int)cinfo->output_scanline > (_region_y + cinfo->region_h + bsz_h)))
 +      skip = 1;
 +    if (bsz_w != 0)
 +      blk1 = (cinfo->region_x / bsz_w) - 1;
 +    if (blk1 < 0)
 +      blk1 = 0;
 +    if (bsz_w != 0)
 +      blk2 = ((cinfo->region_x + cinfo->region_w + bsz_w - 1) / bsz_w) + 1;
 +    if (blk2 < 0)
 +      blk2 = 0;
 +  }
 +#endif
  
    /* Loop to process as much as one whole iMCU row */
    for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
diff --cc jdmerge.c
+++ b/jdmerge.c
@@@ -227,24 -226,16 +226,24 @@@ merged_2v_upsample(j_decompress_ptr cin
  /* 2:1 vertical sampling case: may need a spare row. */
  {
    my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
-   JSAMPROW work_ptrs[2];
+   _JSAMPROW work_ptrs[2];
    JDIMENSION num_rows;          /* number of rows returned to caller */
 +#if _USE_PRODUCT_TV
 +  int skip = 0;
 +#endif
  
    if (upsample->spare_full) {
      /* If we have a spare row saved from a previous cycle, just return it. */
      JDIMENSION size = upsample->out_row_width;
      if (cinfo->out_color_space == JCS_RGB565)
        size = cinfo->output_width * 2;
-     jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1,
-                       upsample->out_row_width);
 +#if _USE_PRODUCT_TV
-     jcopy_sample_rows(&upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1,
-                       size);
++    _jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
++                       1, upsample->out_row_width);
 +#else
+     _jcopy_sample_rows(&upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
+                        1, size);
 +#endif
      num_rows = 1;
      upsample->spare_full = FALSE;
    } else {
diff --cc jpeglib.h
Simple merge
diff --cc jquant2.c
+++ b/jquant2.c
@@@ -508,17 -509,12 +509,18 @@@ compute_color(j_decompress_ptr cinfo, b
        }
      }
  
 -  ((_JSAMPARRAY)cinfo->colormap)[0][icolor] =
 -    (_JSAMPLE)((c0total + (total >> 1)) / total);
 -  ((_JSAMPARRAY)cinfo->colormap)[1][icolor] =
 -    (_JSAMPLE)((c1total + (total >> 1)) / total);
 -  ((_JSAMPARRAY)cinfo->colormap)[2][icolor] =
 -    (_JSAMPLE)((c2total + (total >> 1)) / total);
 +#if _USE_PRODUCT_TV
 +  if(total != 0) {
-     cinfo->colormap[0][icolor] = (JSAMPLE)((c0total + (total>>1)) / total);
-     cinfo->colormap[1][icolor] = (JSAMPLE)((c1total + (total>>1)) / total);
-     cinfo->colormap[2][icolor] = (JSAMPLE)((c2total + (total>>1)) / total);
++#endif
++    ((_JSAMPARRAY)cinfo->colormap)[0][icolor] =
++      (_JSAMPLE)((c0total + (total >> 1)) / total);
++    ((_JSAMPARRAY)cinfo->colormap)[1][icolor] =
++      (_JSAMPLE)((c1total + (total >> 1)) / total);
++    ((_JSAMPARRAY)cinfo->colormap)[2][icolor] =
++      (_JSAMPLE)((c2total + (total >> 1)) / total);
++#if _USE_PRODUCT_TV
 +  }
- #else
-   cinfo->colormap[0][icolor] = (JSAMPLE)((c0total + (total >> 1)) / total);
-   cinfo->colormap[1][icolor] = (JSAMPLE)((c1total + (total >> 1)) / total);
-   cinfo->colormap[2][icolor] = (JSAMPLE)((c2total + (total >> 1)) / total);
 +#endif
  }
  
  
index 491533e,0000000..0f2920e
mode 100644,000000..100644
--- /dev/null
@@@ -1,108 -1,0 +1,108 @@@
- Version:        2.1.4
 +%define libver  8.2.2
 +
 +Name:           libjpeg-turbo
- %doc coderules.txt jconfig.txt libjpeg.txt structure.txt example.txt
++Version:        3.0.1
 +Release:        1
 +Summary:        A MMX/SSE2 accelerated library for manipulating JPEG image files
 +License:        BSD License (BSD 3-clause, Historic Permission Notice and Disclaimer, libjpeg License)
 +Group:          Graphics & UI Framework/Libraries
 +Url:            http://sourceforge.net/projects/libjpeg-turbo
 +Source0:        %{name}-%{version}.tar.gz
 +Source1001:   libjpeg-turbo.manifest
 +BuildRequires:  cmake
 +BuildRequires:  gcc-c++
 +BuildRequires:  libtool
 +BuildRequires:  yasm
 +
 +%description
 +The libjpeg-turbo package contains a library of functions for manipulating
 +JPEG images.
 +
 +%package -n libjpeg
 +
 +Version:        %{libver}
 +Release:        0
 +Summary:        The MMX/SSE accelerated JPEG compression/decompression library
 +Group:          Graphics & UI Framework/Libraries
 +
 +Provides:       libjpeg = %{version}
 +Provides:       libjpeg8
 +Obsoletes:      libjpeg < %{version}
 +
 +%description -n libjpeg
 +This library contains MMX/SSE accelerated functions for manipulating
 +JPEG images.
 +
 +%package -n libjpeg-devel
 +Version:        %{libver}
 +Release:        0
 +Summary:        Development Tools for applications which will use the Libjpeg Library
 +Group:          Graphics & UI Framework/Development
 +
 +Provides:       libjpeg-turbo-devel
 +Requires:       libjpeg = %{version}
 +Provides:       libjpeg-devel = %{version}
 +Obsoletes:      libjpeg-devel < %{version}
 +
 +%description -n libjpeg-devel
 +The libjpeg-devel package includes the header files and libraries
 +necessary for compiling and linking programs which will manipulate JPEG
 +files using the libjpeg library.
 +
 +%prep
 +%setup -q
 +cp %{SOURCE1001} .
 +
 +%build
 +%if "%{tizen_profile_name}" == "tv"
 +echo "tizen_product_tv"
 +export CFLAGS="$CFLAGS -D_TIZEN_PRODUCT_TV -D_USE_PRODUCT_TV"
 +%endif
 +%cmake . -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=TRUE -DENABLE_STATIC=FALSE \
 +%if "%{tizen_profile_name}" == "tv"
 +       -DENABLE_COLOR_PICKER=TRUE \
 +%endif
 +      -DWITH_JPEG8=TRUE
 +%__make %{?jobs:-j%jobs}
 +
 +%install
 +rm -rf %{buildroot}
 +
 +%make_install
 +
 +# Remove unwanted files
 +rm %{buildroot}%{_bindir}/*
 +
 +# Remove docs, we'll select docs manually
 +rm -rf %{buildroot}%{_datadir}/doc/
 +rm -rf %{buildroot}%{_mandir}/man1/
 +
 +%post -n libjpeg -p /sbin/ldconfig
 +
 +%postun -n libjpeg -p /sbin/ldconfig
 +
 +%files
 +%manifest %{name}.manifest
 +%defattr(-,root,root)
 +%license README.ijg
 +%license COPYING
 +
 +%files -n libjpeg
 +%manifest %{name}.manifest
 +%defattr(-,root,root)
 +%{_libdir}/libturbojpeg.so.*
 +%{_libdir}/libjpeg.so.*
 +%license README.ijg
 +%license COPYING
 +
 +%files -n libjpeg-devel
 +%defattr(-,root,root)
 +%{_includedir}/*.h
 +%{_libdir}/pkgconfig/libturbojpeg.pc
 +%{_libdir}/pkgconfig/libjpeg.pc
 +%{_libdir}/libturbojpeg.so
 +%{_libdir}/libjpeg.so
 +%{_libdir}/cmake/%{name}/*.cmake
++%doc coderules.txt jconfig.txt libjpeg.txt structure.txt
 +
 +%changelog
  
  #include <ctype.h>
  
- static unsigned int simd_support = ~0;
- static unsigned int simd_huffman = 1;
 +#if _USE_PRODUCT_TV
 +//Changes for JPEG GAMMA enhancement in thumbnail
 +#include <unistd.h>
 +#endif
 +
+ static THREAD_LOCAL unsigned int simd_support = ~0;
+ static THREAD_LOCAL unsigned int simd_huffman = 1;
  
  #if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
  
diff --cc simd/jsimd.h
@@@ -1255,14 -1255,4 +1255,14 @@@ EXTERN(int) jsimd_encode_mcu_AC_refine_
  
  EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_neon
    (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
-    JCOEF *absvalues, size_t *bits);
+    UJCOEF *absvalues, size_t *bits);
 +
 +/* TIZEN_PRODUCT_TV */
 +EXTERN(void) jsimd_pick_color
 +  JPP((JSAMPARRAY output_buf,
 +   void *pickColor,
 +   JDIMENSION out_width));
 +
 +EXTERN(void) jsimd_h2v1_fancy_upsample_neon
 +  JPP((int max_v_samp_factor, JDIMENSION downsampled_width,
 +   JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr));
diff --cc tjbench.c
+++ b/tjbench.c
    printf("ERROR in line %d while %s:\n%s\n", __LINE__, op, err); \
    retval = -1;  goto bailout; \
  }
 +
 +#if _USE_PRODUCT_TV
 +#define THROW_UNIX(m) { \
 +      char err_str[256]; \
 +      strerror_r(errno, err_str, 256); \
 +      THROW(m, err_str) \
 +}
 +#else
  #define THROW_UNIX(m)  THROW(m, strerror(errno))
 +#endif
  
- char tjErrorStr[JMSG_LENGTH_MAX] = "\0", tjErrorMsg[JMSG_LENGTH_MAX] = "\0";
+ char tjErrorStr[JMSG_LENGTH_MAX] = "\0";
  int tjErrorLine = -1, tjErrorCode = -1;
  
- #define THROW_TJG(m) { \
-   printf("ERROR in line %d while %s:\n%s\n", __LINE__, m, \
-          tjGetErrorStr2(NULL)); \
+ #define THROW_TJG() { \
+   printf("ERROR in line %d\n%s\n", __LINE__, tj3GetErrorStr(NULL)); \
    retval = -1;  goto bailout; \
  }
  
diff --cc tjunittest.c
Simple merge