Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libva-utils for openSUSE:Factory 
checked in at 2022-07-09 17:03:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libva-utils (Old)
 and      /work/SRC/openSUSE:Factory/.libva-utils.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libva-utils"

Sat Jul  9 17:03:08 2022 rev:19 rq:987904 version:2.15.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libva-utils/libva-utils.changes  2022-03-02 
18:20:52.796655474 +0100
+++ /work/SRC/openSUSE:Factory/.libva-utils.new.1523/libva-utils.changes        
2022-07-09 17:05:25.268921348 +0200
@@ -1,0 +2,14 @@
+Fri Jul  8 11:35:21 UTC 2022 - Stefan Dirsch <sndir...@suse.com>
+
+- update to 2.15.0
+  * add: Added HDR10 Tone Mapping sample code including H2H and H2S config 
files.
+  *  add: Support lowpower for HEVC Encoding
+  *  fix: Set correct entrypoint for lowpower
+  *  fix: Components exceed the value specified by jpeg spec
+  *  fix: hdr local variable pointer access issue
+  *  fix: Fix issue incorrect color for EU based hevcencode
+  *  fix: exclude vgem node and invalid drm node in vainfo
+  *  ci:Disable travis build
+  *  meson: check the dependency of libdrm
+
+-------------------------------------------------------------------

Old:
----
  libva-utils-2.14.0.tar.gz

New:
----
  libva-utils-2.15.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libva-utils.spec ++++++
--- /var/tmp/diff_new_pack.VZWibj/_old  2022-07-09 17:05:25.640921701 +0200
+++ /var/tmp/diff_new_pack.VZWibj/_new  2022-07-09 17:05:25.644921705 +0200
@@ -17,10 +17,10 @@
 
 
 Name:           libva-utils
-Version:        2.14.0
+Version:        2.15.0
 Release:        0
 Summary:        A collection of utilities and examples to exercise VA-API
-License:        MIT AND EPL-1.0
+License:        EPL-1.0 AND MIT
 Group:          Development/Tools/Other
 URL:            https://github.com/intel/libva-utils
 Source0:        %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz

++++++ libva-utils-2.14.0.tar.gz -> libva-utils-2.15.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/.travis.yml 
new/libva-utils-2.15.0/.travis.yml
--- old/libva-utils-2.14.0/.travis.yml  2022-02-16 16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/.travis.yml  1970-01-01 01:00:00.000000000 +0100
@@ -1,93 +0,0 @@
-dist: xenial
-sudo: required
-
-language: c
-compiler: gcc
-os: linux
-
-env:
-  global:
-    - NUM_THREADS=4
-    # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
-    #   via the "travis encrypt" command using the project repo's public key
-    - secure: 
"le7Tufc7J6vphl/PDiHXhA6I78PCNIC0nnFiSGqn/Fb05ajfsXC1wdVKcSg6Mf86cT0Y2LA/D3djVnPlzYda9Jk0WNuTEojn3fR8zMh8vEwuJuCVVFT2JWMhK4/K5hpLf/obymWUzrez7iMWWkJSmvgHwBRUdPrR125uERfYFB246mfmLZAOSRcwsli3bUmSBVLRmTGSetAffOC8KfNZhyseEeOhzlrc2CPH9Wgze/0L8qoxPmcTwKPQez5sKKuR3IDVH9d2z55E1uJo8orRbGFKmQy/wSidkrhQ7266x+l+x0rtqKtmDuwf+e582E2d8RgphEXGHOWUPZz88fHXMDI1C9/eGNfwZHt1sIM5FrNXQfRlS5oF4L8l+hKqLuLddPWxWqDPOty3p39P302KYTa8dQd5t3TdKkPSz7ssiPitJKqBGkdmABaxRBCzks/RKTBDwP4L4VQm0MqHavZ2T/3Skl/t1YoC/W0cjcQQiwETCcoWZ6NBnQgpQPQOtkmHLElgmpRFaDFJ587wAuTaP8BXTNhqZbh62jxRg+4SRJI1jSmlJjzAbnyUTMQbIYvjbJk5gRDV74raVSS8YG3TJbgbDipglhWTe88Ug3wT8hkBQAOhDlcjXR4+MozD5mskiRcFmbR3VoKVHdPhDaqOjhCWLL52rEv2qJRie4w0Urc="
-
-
-before_install:
-  - test "${TRAVIS_BRANCH}" != 'coverity_scan' -o "${TRAVIS_JOB_NUMBER##*.}" = 
'1' || exit 0
-  - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne 
'/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
-  - |
-     sudo systemctl stop apt-daily.service &&
-     sudo systemctl kill --kill-who=all apt-daily.service &&
-     while ! (systemctl list-units --all apt-daily.service | fgrep -q dead) ; 
do
-       sleep 1
-     done
-  - pip install --user cpp-coveralls
-  - sudo apt-get -qq update
-  - sudo apt-get install -y build-essential
-  - sudo apt-get install -y autoconf
-  - sudo apt-get install -y automake
-  - sudo apt-get install -y libtool
-  - sudo apt-get install -y m4 
-  - sudo apt-get install -y lcov
-  - sudo apt-get install -y perl
-  - sudo apt-get install -y pkg-config
-  - sudo apt-get install -y libdrm-dev
-  - sudo apt-get install -y autoconf
-  - sudo apt-get install -y libegl1-mesa-dev
-  - sudo apt-get install -y libgl1-mesa-dev
-  - sudo apt-get install -y libwayland-dev
-  - sudo apt-get install -y libx11-dev
-  - sudo apt-get install -y libxext-dev
-  - sudo apt-get install -y libxfixes-dev
-
-install:
-  - git clone https://github.com/intel/libva.git
-  - (cd libva && ./autogen.sh && ./configure --prefix=/usr && sudo make 
install)
-
-
-addons:
-  coverity_scan:
-    project:
-      name: "intel/libva-utils"
-      description: "Build submitted via Travis CI"
-    notification_email: intel-media-secur...@lists.01.org 
-    build_command_prepend: "./autogen.sh; ./configure --prefix=/usr"
-    build_command:   "make -j4"
-    branch_pattern: coverity_scan
-
-script:
-  - if [[ "${COVERITY_SCAN_BRANCH}" == 1 ]];
-      then
-        echo "Don't build on coverty_scan branch.";
-        exit 0;
-    fi
-  - ./autogen.sh
-  - ./configure --prefix=/usr
-  - make -j4 ; sudo make install
-  - make check
-
-after_success:
-        - coveralls --exclude lib --exclude tests --gcov-options '\-lp'
-
-notifications:
-# Emails are sent to the committer's git-configured email address by default,
-# but only if they have access to the repository.  To enable Travis on your
-# public project, just go to travis-ci.org and flip the switch on for
-# your project.  To configure your git email address, use:
-#     git config --global user.email m...@example.com
-  email:
-    on_success: always
-    on_failure: always
-
-# Slack notifications
-#
-  slack: intel-media:p0wZO3fWJ1ouSsF0RNKbOl5G
-
-# IRC notifications disabled by default.
-# Uncomment next 5 lines to send notifications to chat.freenode.net#caffe
-#   irc:
-#     channels:
-#       - "chat.freenode.net#intel-media"
-#     template:
-#       - "%{repository}/%{branch} (%{commit} - %{author}): %{message}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/NEWS new/libva-utils-2.15.0/NEWS
--- old/libva-utils-2.14.0/NEWS 2022-02-16 16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/NEWS 2022-07-01 09:52:28.000000000 +0200
@@ -1,6 +1,17 @@
-libva-utils NEWS -- summary of changes.  2022-2-16
+libva-utils NEWS -- summary of changes.  2022-7-1
 Copyright (C) 2009-2022 Intel Corporation
 
+Version 2.15.0 - 1.Jul.2022
+* add: Added HDR10 Tone Mapping sample code including H2H and H2S config files.
+* add: Support lowpower for HEVC Encoding
+* fix: Set correct entrypoint for lowpower
+* fix: Components exceed the value specified by jpeg spec
+* fix: hdr local variable pointer access issue
+* fix: Fix issue incorrect color for EU based hevcencode
+* fix: exclude vgem node and invalid drm node in vainfo
+* ci:Disable travis build
+* meson: check the dependency of libdrm
+
 Version 2.14.0 - 16.Feb.2022
 * test: Use test suite setup/teardown to reduce test overhead
 * ci: fix freebsd build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/common/Makefile.am 
new/libva-utils-2.15.0/common/Makefile.am
--- old/libva-utils-2.14.0/common/Makefile.am   2022-02-16 16:47:48.000000000 
+0100
+++ new/libva-utils-2.15.0/common/Makefile.am   2022-07-01 09:52:28.000000000 
+0200
@@ -41,7 +41,7 @@
 
 if USE_DRM
 source_c               += va_display_drm.c
-libva_display_cflags   += $(DRM_CFLAGS) $(LIBVA_DRM_CFLAGS)
+libva_display_cflags   += $(DRM_CFLAGS) $(LIBVA_DRM_CFLAGS) $(DRM_CFLAGS)
 libva_display_libs     += $(DRM_LIBS) $(LIBVA_DRM_LIBS)
 endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/common/va_display_drm.c 
new/libva-utils-2.15.0/common/va_display_drm.c
--- old/libva-utils-2.14.0/common/va_display_drm.c      2022-02-16 
16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/common/va_display_drm.c      2022-07-01 
09:52:28.000000000 +0200
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #ifdef IN_LIBVA
@@ -31,6 +32,7 @@
 #else
 # include <va/va_drm.h>
 #endif
+#include <xf86drm.h>
 #include "va_display.h"
 
 static int drm_fd = -1;
@@ -41,10 +43,12 @@
 {
     VADisplay va_dpy;
     int i;
-
+    drmVersionPtr version;
     static const char *drm_device_paths[] = {
         "/dev/dri/renderD128",
         "/dev/dri/card0",
+        "/dev/dri/renderD129",
+        "/dev/dri/card1",
         NULL
     };
 
@@ -72,6 +76,18 @@
         if (drm_fd < 0)
             continue;
 
+        version = drmGetVersion(drm_fd);
+        if (!version) {
+            close(drm_fd);
+            continue;
+        }
+        if (!strncmp(version->name, "vgem", 4)) {
+            drmFreeVersion(version);
+            close(drm_fd);
+            continue;
+        }
+        drmFreeVersion(version);
+
         va_dpy = vaGetDisplayDRM(drm_fd);
         if (va_dpy)
             return va_dpy;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/configure.ac 
new/libva-utils-2.15.0/configure.ac
--- old/libva-utils-2.14.0/configure.ac 2022-02-16 16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/configure.ac 2022-07-01 09:52:28.000000000 +0200
@@ -29,7 +29,7 @@
 # - micro version is libva_micro_version
 # - pre version is libva_pre_version, usually development version
 m4_define([libva_utils_major_version], [2])
-m4_define([libva_utils_minor_version], [14])
+m4_define([libva_utils_minor_version], [15])
 m4_define([libva_utils_micro_version], [0])
 m4_define([libva_utils_pre_version],   [0])
 
@@ -144,6 +144,7 @@
 
 # Check for DRM (mandatory)
 PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm])
+PKG_CHECK_MODULES([DRM], [libdrm])
 
 # Check for libva (for dynamic linking)
 LIBVA_API_MIN_VERSION=libva_api_min_version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/decode/tinyjpeg-internal.h 
new/libva-utils-2.15.0/decode/tinyjpeg-internal.h
--- old/libva-utils-2.14.0/decode/tinyjpeg-internal.h   2022-02-16 
16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/decode/tinyjpeg-internal.h   2022-07-01 
09:52:28.000000000 +0200
@@ -87,7 +87,7 @@
         unsigned int component_id;
         unsigned int dc_selector;
         unsigned int ac_selector;
-    } components[4];
+    } components[COMPONENTS];
 };
 
 struct jdec_private {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/decode/tinyjpeg.c 
new/libva-utils-2.15.0/decode/tinyjpeg.c
--- old/libva-utils-2.14.0/decode/tinyjpeg.c    2022-02-16 16:47:48.000000000 
+0100
+++ new/libva-utils-2.15.0/decode/tinyjpeg.c    2022-07-01 09:52:28.000000000 
+0200
@@ -236,6 +236,8 @@
     height = be16_to_cpu(stream + 3);
     width  = be16_to_cpu(stream + 5);
     nr_components = stream[7];
+    if(nr_components > COMPONENTS-1)
+        error("Components exceed the value specified by the Jpeg spec\n");
     priv->nf_components = nr_components;
 #if SANITY_CHECK
     if (stream[2] != 8)
@@ -277,7 +279,8 @@
 {
     unsigned int i, cid, table;
     unsigned int nr_components = stream[2];
-
+    if(nr_components > COMPONENTS-1)
+        error("Components exceed the value specified by the Jpeg spec\n");
     trace("> SOS marker\n");
 
     priv->cur_sos.nr_components = nr_components;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/encode/hevcencode.c 
new/libva-utils-2.15.0/encode/hevcencode.c
--- old/libva-utils-2.14.0/encode/hevcencode.c  2022-02-16 16:47:48.000000000 
+0100
+++ new/libva-utils-2.15.0/encode/hevcencode.c  2022-07-01 09:52:28.000000000 
+0200
@@ -78,7 +78,7 @@
 #define PROFILE_IDC_MAIN10      2
 
 #define BITSTREAM_ALLOCATE_STEPPING     4096
-#define LCU_SIZE 32
+static  int LCU_SIZE = 32;
 
 #define SURFACE_NUM 16 /* 16 surfaces for source YUV */
 #define SURFACE_NUM 16 /* 16 surfaces for reference */
@@ -374,7 +374,9 @@
 static  VADisplay va_dpy;
 static  VAProfile hevc_profile = ~0;
 static  int real_hevc_profile = 0;
+static  VAEntrypoint entryPoint = VAEntrypointEncSlice;
 static  int p2b = 1;
+static  int lowpower = 0;
 static  VAConfigAttrib attrib[VAConfigAttribTypeMax];
 static  VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
 static  int config_attrib_num = 0, enc_packed_header_idx;
@@ -662,7 +664,7 @@
     ptps->general_frame_only_constraint_flag = 1;
 
     ptps->general_level_idc = 30;
-    ptps->general_level_idc = ptps->general_level_idc * 3;
+    ptps->general_level_idc = ptps->general_level_idc * 4;
 
 }
 static void fill_vps_header(struct VideoParamSet *vps)
@@ -798,7 +800,7 @@
     sps->scaling_list_enabled_flag = 0;
     //sps->sps_scaling_list_data_present_flag; // ignore since 
scaling_list_enabled_flag equal to 0
     sps->amp_enabled_flag = 1;
-    sps->sample_adaptive_offset_enabled_flag = 0;
+    sps->sample_adaptive_offset_enabled_flag = 1;
     sps->pcm_enabled_flag = 0;
     /* ignore below parameters seting since pcm_enabled_flag equal to 0
     pcm_sample_bit_depth_luma_minus1;
@@ -853,9 +855,9 @@
     pps->init_qp_minus26 = initial_qp - 26;
     pps->constrained_intra_pred_flag = 0;
     pps->transform_skip_enabled_flag = 0;
-    pps->cu_qp_delta_enabled_flag = 0;
+    pps->cu_qp_delta_enabled_flag = 1;
     if (pps->cu_qp_delta_enabled_flag)
-        pps->diff_cu_qp_delta_depth = 0;
+        pps->diff_cu_qp_delta_depth = 2;
     pps->pps_cb_qp_offset = 0;
     pps->pps_cr_qp_offset = 0;
     pps->pps_slice_chroma_qp_offsets_present_flag = 0;
@@ -1746,7 +1748,7 @@
     printf("   --intra_period <number>\n");
     printf("   --idr_period <number>\n");
     printf("   --ip_period <number>\n");
-    printf("   --bitrate <bitrate>\n");
+    printf("   --bitrate <bitrate> Kbits per second\n");
     printf("   --initialqp <number>\n");
     printf("   --minqp <number>\n");
     printf("   --rcmode <NONE|CBR|VBR|VCM|CQP|VBR_CONTRAINED>\n");
@@ -1757,6 +1759,7 @@
     printf("   --enablePSNR calculate PSNR of recyuv vs. srcyuv\n");
     printf("   --profile 1: main 2 : main10\n");
     printf("   --p2b 1: enable 0 : disalbe(defalut)\n");
+    printf("   --lowpower 1: enable 0 : disalbe(defalut)\n");
     return 0;
 }
 
@@ -1782,6 +1785,7 @@
         {"framecount", required_argument, NULL, 16 },
         {"profile", required_argument, NULL, 17 },
         {"p2b", required_argument, NULL, 18 },
+        {"lowpower", required_argument, NULL, 19 },
         {NULL, no_argument, NULL, 0 }
     };
     int long_index;
@@ -1808,7 +1812,7 @@
             print_help();
             exit(0);
         case 1:
-            frame_bitrate = atoi(optarg);
+            frame_bitrate = atoi(optarg)*1000;
             break;
         case 2:
             minimal_qp = atoi(optarg);
@@ -1870,6 +1874,9 @@
         case 18:
             p2b = atoi(optarg);
             break;
+        case 19:
+            lowpower = atoi(optarg);
+            break;
 
         case ':':
         case '?':
@@ -1987,7 +1994,8 @@
         hevc_profile = profile_list[i];
         vaQueryConfigEntrypoints(va_dpy, hevc_profile, entrypoints, 
&num_entrypoints);
         for (slice_entrypoint = 0; slice_entrypoint < num_entrypoints; 
slice_entrypoint++) {
-            if (entrypoints[slice_entrypoint] == VAEntrypointEncSlice) {
+            if (entrypoints[slice_entrypoint] == VAEntrypointEncSlice ||
+                entrypoints[slice_entrypoint] == VAEntrypointEncSliceLP ) {
                 support_encode = 1;
                 break;
             }
@@ -2023,7 +2031,13 @@
     for (i = 0; i < VAConfigAttribTypeMax; i++)
         attrib[i].type = i;
 
-    va_status = vaGetConfigAttributes(va_dpy, hevc_profile, 
VAEntrypointEncSlice,
+    if (lowpower)
+    {
+        entryPoint = VAEntrypointEncSliceLP;
+        LCU_SIZE = 64;
+    }
+
+    va_status = vaGetConfigAttributes(va_dpy, hevc_profile, entryPoint,
                                       &attrib[0], VAConfigAttribTypeMax);
     CHECK_VASTATUS(va_status, "vaGetConfigAttributes");
     /* check the interested configattrib */
@@ -2165,7 +2179,7 @@
     VASurfaceID *tmp_surfaceid;
     int codedbuf_size, i;
 
-    va_status = vaCreateConfig(va_dpy, hevc_profile, VAEntrypointEncSlice,
+    va_status = vaCreateConfig(va_dpy, hevc_profile, entryPoint,
                                &config_attrib[0], config_attrib_num, 
&config_id);
     CHECK_VASTATUS(va_status, "vaCreateConfig");
 
@@ -2325,7 +2339,7 @@
     seq_param.intra_idr_period = intra_idr_period;
     seq_param.ip_period = ip_period;
 
-    seq_param.bits_per_second = 400000;
+    seq_param.bits_per_second = frame_bitrate;
     seq_param.pic_width_in_luma_samples = sps->pic_width_in_luma_samples;
     seq_param.pic_height_in_luma_samples = sps->pic_height_in_luma_samples;
 
@@ -3171,6 +3185,7 @@
     printf("INPUT: Initial QP   : %d\n", initial_qp);
     printf("INPUT: Min QP       : %d\n", minimal_qp);
     printf("INPUT: P As B       : %d\n", p2b);
+    printf("INPUT: lowpower     : %d\n", lowpower);
     printf("INPUT: Source YUV   : %s", srcyuv_fp ? "FILE" : "AUTO generated");
     if (srcyuv_fp)
         printf(":%s (fourcc %s)\n", srcyuv_fn, 
fourcc_to_string(srcyuv_fourcc));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/meson.build 
new/libva-utils-2.15.0/meson.build
--- old/libva-utils-2.14.0/meson.build  2022-02-16 16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/meson.build  2022-07-01 09:52:28.000000000 +0200
@@ -1,5 +1,5 @@
 project('libva-utils', 'c', 'cpp',
-        version : '2.14.0',
+        version : '2.15.0',
         default_options : [
           'warning_level=2',
           'c_std=gnu99',
@@ -21,6 +21,7 @@
   require_drm = get_option('drm') == 'true'
   drm_deps = [
     dependency('libva-drm', required: require_drm),
+    dependency('libdrm', required: require_drm),
   ]
   use_drm = true
   foreach d : drm_deps
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/vainfo/vainfo.c 
new/libva-utils-2.15.0/vainfo/vainfo.c
--- old/libva-utils-2.14.0/vainfo/vainfo.c      2022-02-16 16:47:48.000000000 
+0100
+++ new/libva-utils-2.15.0/vainfo/vainfo.c      2022-07-01 09:52:28.000000000 
+0200
@@ -320,7 +320,7 @@
     if (attrib_list[VAConfigAttribEncJPEG].value & (~VA_ATTRIB_NOT_SUPPORTED)) 
{
         VAConfigAttribValEncJPEG *config = 
(VAConfigAttribValEncJPEG*)&attrib_list[VAConfigAttribEncJPEG].value;
         printf("    %-39s: ", 
vaConfigAttribTypeStr(attrib_list[VAConfigAttribEncJPEG].type));
-        printf("rithmatic_coding_mode=%d\n", 
config->bits.arithmatic_coding_mode);
+        printf("arithmatic_coding_mode=%d\n", 
config->bits.arithmatic_coding_mode);
         printf("%-*sprogressive_dct_mode=%d\n", 45, "", 
config->bits.progressive_dct_mode);
         printf("%-*snon_interleaved_mode=%d\n", 45, "", 
config->bits.non_interleaved_mode);
         printf("%-*sdifferential_mode=%d\n", 45, "", 
config->bits.differential_mode);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/videoprocess/Makefile.am 
new/libva-utils-2.15.0/videoprocess/Makefile.am
--- old/libva-utils-2.14.0/videoprocess/Makefile.am     2022-02-16 
16:47:48.000000000 +0100
+++ new/libva-utils-2.15.0/videoprocess/Makefile.am     2022-07-01 
09:52:28.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Intel Corporation. All Rights Reserved.
+# Copyright (c) 2022 Intel Corporation. All Rights Reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the
@@ -20,7 +20,7 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-bin_PROGRAMS = vavpp vppscaling_csc vppdenoise vppsharpness vppchromasitting 
vppblending vppscaling_n_out_usrptr vacopy vpp3dlut
+bin_PROGRAMS = vavpp vppscaling_csc vppdenoise vppsharpness vppchromasitting 
vppblending vppscaling_n_out_usrptr vacopy vpp3dlut vpphdr_tm
 
 AM_CPPFLAGS = \
        -Wall                                   \
@@ -64,6 +64,9 @@
 vpp3dlut_SOURCES = vpp3dlut.cpp
 vpp3dlut_LDADD   = $(TEST_LIBS)
 
+vpphdr_tm_SOURCES = vpphdr_tm.cpp
+vpphdr_tm_LDADD   = $(TEST_LIBS)
+
 valgrind:(bin_PROGRAMS)
        for a in(bin_PROGRAMS); do \
                valgrind --leak-check=full --show-reachable=yes .libs/$$a; \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libva-utils-2.14.0/videoprocess/process_hdr_tm_h2h.cfg.template 
new/libva-utils-2.15.0/videoprocess/process_hdr_tm_h2h.cfg.template
--- old/libva-utils-2.14.0/videoprocess/process_hdr_tm_h2h.cfg.template 
1970-01-01 01:00:00.000000000 +0100
+++ new/libva-utils-2.15.0/videoprocess/process_hdr_tm_h2h.cfg.template 
2022-07-01 09:52:28.000000000 +0200
@@ -0,0 +1,56 @@
+# Configuration information for video process test case.
+#    This application will firstly load yuv frames to one type of 
surface(NV12/YV12/I420/P010)
+#  you require. After video processing, the processed content (ARGB10 surface)
+#  will be stored to frames(ARGB10 format in file).
+#    Supported features include: HDR Tone Mapping, implicit format 
conversion(P010->A2RGB10). Each
+# time only one kind of processing will be executed in test application. 
Although libva supports
+# multiple filters execution in one time. you can modify this configuration 
file to set the
+# filter and the corresponding parameters.
+
+#To simplify this test app, we use the default gamut for both source and 
destination.
+#Please set correct gamut according to the real value.
+#BT2020    Gammut        Multiplier            Output  
+#G     0.17      0.797            50000                    8500        39850
+#R     0.708     0.292            50000                    35400       14600
+#B     0.131     0.046            50000                    6550        2300
+#w     0.3127  0.329              50000                    15635       16450
+#BT709    Gammut         Multiplier            Output  
+#G     0.3     0.6             50000           15000   30000
+#R     0.64    0.33            50000           32000   16500
+#B     0.15    0.06            50000           7500    3000
+#w     0.3127  0.329           50000           15635   16450
+
+#0. Tone Map Type: 0-H2H, 1-H2E, 2-H2S
+TM_TYPE: 0
+
+#1.Source YUV(RGB) file information
+SRC_FILE_NAME: ShowGirl2Teaser_1920x1080_4000nits.p010
+SRC_FRAME_WIDTH: 1920 
+SRC_FRAME_HEIGHT: 1080
+SRC_FRAME_FORMAT: P010
+SRC_FRAME_COLOUR_PRIMARIES: 9
+SRC_FRAME_TRANSFER_CHARACTERISTICS: 16
+SRC_MAX_DISPLAY_MASTERING_LUMINANCE: 1000
+SRC_MIN_DISPLAY_MASTERING_LUMINANCE: 100
+SRC_MAX_CONTENT_LIGHT_LEVEL: 4000
+SRC_MAX_PICTURE_AVERAGE_LIGHT_LEVEL: 100
+
+#2.Destination YUV(RGB) file information
+DST_FILE_NAME:    ShowGirl2Teaser_1920x1080_1000nits_writer.a2rgb10
+DST_FRAME_WIDTH:  1920
+DST_FRAME_HEIGHT: 1080
+DST_FRAME_FORMAT: A2RGB10
+DST_FRAME_COLOUR_PRIMARIES: 9
+DST_FRAME_TRANSFER_CHARACTERISTICS: 16
+DST_MAX_DISPLAY_MASTERING_LUMINANCE: 1000
+DST_MIN_DISPLAY_MASTERING_LUMINANCE: 100
+DST_MAX_CONTENT_LIGHT_LEVEL: 1000
+DST_MAX_PICTURE_AVERAGE_LIGHT_LEVEL: 100
+
+#3.How many frames to be processed
+FRAME_SUM: 1
+
+#4.VPP filter specific parameters. If they are not specified here,
+#default value will be applied then.
+FILTER_TYPE: VAProcFilterHighDynamicRangeToneMapping
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libva-utils-2.14.0/videoprocess/process_hdr_tm_h2s.cfg.template 
new/libva-utils-2.15.0/videoprocess/process_hdr_tm_h2s.cfg.template
--- old/libva-utils-2.14.0/videoprocess/process_hdr_tm_h2s.cfg.template 
1970-01-01 01:00:00.000000000 +0100
+++ new/libva-utils-2.15.0/videoprocess/process_hdr_tm_h2s.cfg.template 
2022-07-01 09:52:28.000000000 +0200
@@ -0,0 +1,56 @@
+# Configuration information for video process test case.
+#    This application will firstly load yuv frames to one type of 
surface(NV12/YV12/I420/P010)
+#  you require. After video processing, the processed content (ARGB10 surface)
+#  will be stored to frames(ARGB10 format in file).
+#    Supported features include: HDR Tone Mapping, implicit format 
conversion(P010->A2RGB10). Each
+# time only one kind of processing will be executed in test application. 
Although libva supports
+# multiple filters execution in one time. you can modify this configuration 
file to set the
+# filter and the corresponding parameters.
+
+#To simplify this test app, we use the default gamut for both source and 
destination.
+#Please set correct gamut according to the real value.
+#BT2020    Gammut        Multiplier            Output  
+#G     0.17      0.797            50000                    8500        39850
+#R     0.708     0.292            50000                    35400       14600
+#B     0.131     0.046            50000                    6550        2300
+#w     0.3127  0.329              50000                    15635       16450
+#BT709    Gammut         Multiplier            Output  
+#G     0.3     0.6             50000           15000   30000
+#R     0.64    0.33            50000           32000   16500
+#B     0.15    0.06            50000           7500    3000
+#w     0.3127  0.329           50000           15635   16450
+
+#0. Tone Map Type: 0-H2H, 1-H2E, 2-H2S
+TM_TYPE: 2
+
+#1.Source YUV(RGB) file information
+SRC_FILE_NAME: ShowGirl2Teaser_1920x1080_4000nits.p010
+SRC_FRAME_WIDTH: 1920
+SRC_FRAME_HEIGHT: 1080
+SRC_FRAME_FORMAT: P010
+SRC_FRAME_COLOUR_PRIMARIES: 9
+SRC_FRAME_TRANSFER_CHARACTERISTICS: 16
+SRC_MAX_DISPLAY_MASTERING_LUMINANCE: 1000
+SRC_MIN_DISPLAY_MASTERING_LUMINANCE: 100
+SRC_MAX_CONTENT_LIGHT_LEVEL: 4000
+SRC_MAX_PICTURE_AVERAGE_LIGHT_LEVEL: 100
+
+#2.Destination YUV(RGB) file information
+DST_FILE_NAME:    ShowGirl2Teaser_1920x1080_4000nits_writer.argb
+DST_FRAME_WIDTH:  1920
+DST_FRAME_HEIGHT: 1080
+DST_FRAME_FORMAT: RGBA
+DST_FRAME_COLOUR_PRIMARIES: 9
+DST_FRAME_TRANSFER_CHARACTERISTICS: 1
+DST_MAX_DISPLAY_MASTERING_LUMINANCE: 1000
+DST_MIN_DISPLAY_MASTERING_LUMINANCE: 100
+DST_MAX_CONTENT_LIGHT_LEVEL: 1000
+DST_MAX_PICTURE_AVERAGE_LIGHT_LEVEL: 100
+
+#3.How many frames to be processed
+FRAME_SUM: 1
+
+#4.VPP filter specific parameters. If they are not specified here,
+#default value will be applied then.
+FILTER_TYPE: VAProcFilterHighDynamicRangeToneMapping
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.14.0/videoprocess/vpphdr_tm.cpp 
new/libva-utils-2.15.0/videoprocess/vpphdr_tm.cpp
--- old/libva-utils-2.14.0/videoprocess/vpphdr_tm.cpp   1970-01-01 
01:00:00.000000000 +0100
+++ new/libva-utils-2.15.0/videoprocess/vpphdr_tm.cpp   2022-07-01 
09:52:28.000000000 +0200
@@ -0,0 +1,865 @@
+/*
+* Copyright (c) 2009-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+/*
+ * Video process test case based on LibVA.
+ * This test covers high dynamic range tone mapping feature.
+ * Usage: ./vpphdr_tm process_hdr_tm.cfg
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <time.h>
+#include <assert.h>
+#include <va/va.h>
+#include <va/va_vpp.h>
+#include "va_display.h"
+
+#ifndef VA_FOURCC_I420
+#define VA_FOURCC_I420 0x30323449
+#endif
+
+#define MAX_LEN   1024
+
+#define CHECK_VASTATUS(va_status,func)                                      \
+  if (va_status != VA_STATUS_SUCCESS) {                                     \
+      printf("%s:%s (%d) failed,exit\n", __func__, func, __LINE__);         \
+      exit(1);                                                              \
+  }
+
+static VADisplay va_dpy = NULL;
+static VAContextID context_id = 0;
+static VAConfigID  config_id = 0;
+static VASurfaceID g_in_surface_id = VA_INVALID_ID;
+static VASurfaceID g_out_surface_id = VA_INVALID_ID;
+
+static FILE* g_config_file_fd = NULL;
+static FILE* g_src_file_fd = NULL;
+static FILE* g_dst_file_fd = NULL;
+
+static char g_config_file_name[MAX_LEN];
+static char g_src_file_name[MAX_LEN];
+static char g_dst_file_name[MAX_LEN];
+
+static uint32_t g_in_pic_width = 1920;
+static uint32_t g_in_pic_height = 1080;
+static uint32_t g_out_pic_width = 1920;
+static uint32_t g_out_pic_height = 1080;
+
+static uint32_t g_in_fourcc  = VA_FOURCC('N', 'V', '1', '2');
+static uint32_t g_in_format  = VA_FOURCC_P010;
+static uint32_t g_out_fourcc = VA_FOURCC('N', 'V', '1', '2');
+static uint32_t g_out_format = VA_RT_FORMAT_YUV420;
+static uint32_t g_src_file_fourcc = VA_FOURCC('I', '4', '2', '0');
+static uint32_t g_dst_file_fourcc = VA_FOURCC('Y', 'V', '1', '2');
+
+static uint32_t g_frame_count = 1;
+static uint32_t g_in_max_display_luminance = 1000;
+static uint32_t g_in_min_display_luminance = 1;
+static uint32_t g_in_max_content_luminance = 4000;
+static uint32_t g_in_pic_average_luminance = 1000;
+static uint32_t g_out_max_display_luminance = 1000;
+static uint32_t g_out_min_display_luminance = 1;
+static uint32_t g_out_max_content_luminance = 4000;
+static uint32_t g_out_pic_average_luminance = 1000;
+
+static uint32_t g_in_colour_primaries = 9;
+static uint32_t g_in_transfer_characteristic = 16;
+
+static uint32_t g_out_colour_primaries = 9;
+static uint32_t g_out_transfer_characteristic = 16;
+
+static uint32_t g_tm_type =1;
+
+static int8_t
+read_value_string(FILE *fp, const char* field_name, char* value)
+{
+    char strLine[MAX_LEN];
+    char* field = NULL;
+    char* str = NULL;
+    uint16_t i;
+
+    if (!fp || !field_name || !value)  {
+        printf("Invalid fuction parameters\n");
+        return -1;
+    }
+
+    rewind(fp);
+
+    while (!feof(fp)) {
+        if (!fgets(strLine, MAX_LEN, fp))
+            continue;
+
+        for (i = 0; i < MAX_LEN && strLine[i]; i++)
+            if (strLine[i] != ' ') break;
+
+        if (i == MAX_LEN || strLine[i] == '#' || strLine[i] == '\n')
+            continue;
+
+        field = strtok(&strLine[i], ":");
+        if (strncmp(field, field_name, strlen(field_name)))
+            continue;
+
+        if (!(str = strtok(NULL, ":")))
+            continue;
+
+        /* skip blank space in string */
+        while (*str == ' ')
+            str++;
+
+        *(str + strlen(str)-1) = '\0';
+        strcpy(value, str);
+
+        return 0;
+    }
+    return -1;
+}
+
+static int8_t
+read_value_uint32(FILE* fp, const char* field_name, uint32_t* value)
+{
+    char str[MAX_LEN];
+
+    if (read_value_string(fp, field_name, str)) {
+       printf("Failed to find integer field: %s", field_name);
+       return -1;
+    }
+
+    *value = (uint32_t)atoi(str);
+
+    return 0;
+}
+
+static int8_t
+read_value_float(FILE *fp, const char* field_name, float* value)
+{
+    char str[MAX_LEN];
+    if (read_value_string(fp, field_name, str)) {
+       printf("Failed to find float field: %s \n",field_name);
+       return -1;
+    }
+
+    *value = atof(str);
+
+    return 0;
+}
+
+static VAStatus
+create_surface(VASurfaceID * p_surface_id,
+               uint32_t width, uint32_t height,
+               uint32_t fourCC, uint32_t format)
+{
+    VAStatus va_status;
+    VASurfaceAttrib    surface_attrib;
+    surface_attrib.type =  VASurfaceAttribPixelFormat;
+    surface_attrib.flags = VA_SURFACE_ATTRIB_SETTABLE;
+    surface_attrib.value.type = VAGenericValueTypeInteger;
+    surface_attrib.value.value.i = fourCC;
+
+    va_status = vaCreateSurfaces(va_dpy,
+                                 format,
+                                 width ,
+                                 height,
+                                 p_surface_id,
+                                 1,
+                                 &surface_attrib,
+                                 1);
+
+    printf("create_surface: p_surface_id %d, width %d, height %d, fourCC 0x%x, 
format 0x%x\n", 
+        *p_surface_id, width, height, fourCC, format);
+
+    return va_status;
+}
+
+static VAStatus
+hdrtm_filter_init(VABufferID *filter_param_buf_id, uint32_t tm_type)
+{
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    VAProcFilterParameterBufferHDRToneMapping hdrtm_param;
+
+    VAHdrMetaDataHDR10 in_hdr10_metadata = {};
+
+    // The input is HDR content
+    in_hdr10_metadata.max_display_mastering_luminance = 
g_in_max_display_luminance;
+    in_hdr10_metadata.min_display_mastering_luminance = 
g_in_min_display_luminance;
+    in_hdr10_metadata.max_content_light_level         = 
g_in_max_content_luminance;
+    in_hdr10_metadata.max_pic_average_light_level     = 
g_in_pic_average_luminance;
+    in_hdr10_metadata.display_primaries_x[0] = 8500;
+    in_hdr10_metadata.display_primaries_y[0] = 39850;
+    in_hdr10_metadata.display_primaries_x[1] = 35400;
+    in_hdr10_metadata.display_primaries_y[1] = 14600;
+    in_hdr10_metadata.display_primaries_x[2] = 6550;
+    in_hdr10_metadata.display_primaries_y[2] = 2300;
+    in_hdr10_metadata.white_point_x = 15635;
+    in_hdr10_metadata.white_point_y = 16450; 
+
+    hdrtm_param.type = VAProcFilterHighDynamicRangeToneMapping;
+    hdrtm_param.data.metadata_type = VAProcHighDynamicRangeMetadataHDR10;
+    hdrtm_param.data.metadata= &in_hdr10_metadata;
+    hdrtm_param.data.metadata_size = sizeof(VAHdrMetaDataHDR10);   
+
+    va_status = vaCreateBuffer(va_dpy, context_id, 
VAProcFilterParameterBufferType, sizeof(hdrtm_param), 1, (void *)&hdrtm_param, 
filter_param_buf_id);
+
+    return va_status;
+}
+
+static VAStatus
+hdrtm_metadata_init(VAHdrMetaData &out_metadata, uint32_t tm_type, 
VAHdrMetaDataHDR10 &out_hdr10_metadata)
+{
+    VAStatus va_status = VA_STATUS_SUCCESS;
+
+
+    out_hdr10_metadata.max_display_mastering_luminance = 
g_out_max_display_luminance;
+    out_hdr10_metadata.min_display_mastering_luminance = 
g_out_min_display_luminance;
+    out_hdr10_metadata.max_content_light_level         = 
g_out_max_content_luminance;
+    out_hdr10_metadata.max_pic_average_light_level     = 
g_out_pic_average_luminance;
+    printf("hdrtm_metadata_init g_out_max_display_luminance %d, 
g_out_min_display_luminance %d\n", g_out_max_display_luminance, 
g_out_min_display_luminance);
+    printf("hdrtm_metadata_init g_out_max_content_luminance %d, 
g_out_pic_average_luminance %d\n", g_out_max_content_luminance, 
g_out_pic_average_luminance);
+
+    // HDR display or SDR display
+    switch (tm_type)
+    {
+    case VA_TONE_MAPPING_HDR_TO_HDR:
+        out_hdr10_metadata.display_primaries_x[0] = 8500;
+        out_hdr10_metadata.display_primaries_y[0] = 39850;
+        out_hdr10_metadata.display_primaries_x[1] = 35400;
+        out_hdr10_metadata.display_primaries_y[1] = 14600;
+        out_hdr10_metadata.display_primaries_x[2] = 6550;
+        out_hdr10_metadata.display_primaries_y[2] = 2300;
+        out_hdr10_metadata.white_point_x = 15635;
+        out_hdr10_metadata.white_point_y = 16450;
+        break;
+    case VA_TONE_MAPPING_HDR_TO_SDR:
+        out_hdr10_metadata.display_primaries_x[0] = 15000;
+        out_hdr10_metadata.display_primaries_y[0] = 30000;
+        out_hdr10_metadata.display_primaries_x[1] = 32000;
+        out_hdr10_metadata.display_primaries_y[1] = 16500;
+        out_hdr10_metadata.display_primaries_x[2] = 7500;
+        out_hdr10_metadata.display_primaries_y[2] = 3000;
+        out_hdr10_metadata.white_point_x = 15635;
+        out_hdr10_metadata.white_point_y = 16450;
+        break;
+    default:
+        break;
+    }
+
+    out_metadata.metadata_type = VAProcHighDynamicRangeMetadataHDR10;
+    out_metadata.metadata = &out_hdr10_metadata;
+    out_metadata.metadata_size = sizeof(VAHdrMetaDataHDR10);
+
+    return va_status;
+}
+
+static VAStatus
+video_frame_process(VASurfaceID in_surface_id,
+                            VASurfaceID out_surface_id)
+{
+    VAStatus va_status;
+    VAProcPipelineParameterBuffer pipeline_param = {};
+    VARectangle surface_region = {}, output_region = {};
+    VABufferID pipeline_param_buf_id = VA_INVALID_ID;
+    VABufferID filter_param_buf_id = VA_INVALID_ID;
+    VAHdrMetaData out_metadata = {};
+
+    /*Query Filter's Caps: The return value will be HDR10 and H2S, H2H, H2E. */
+    VAProcFilterCapHighDynamicRange 
hdrtm_caps[VAProcHighDynamicRangeMetadataTypeCount];
+    uint32_t num_hdrtm_caps = VAProcHighDynamicRangeMetadataTypeCount;
+    memset(&hdrtm_caps, 0, 
sizeof(VAProcFilterCapHighDynamicRange)*num_hdrtm_caps);
+    va_status = vaQueryVideoProcFilterCaps(va_dpy, context_id,
+                                           
VAProcFilterHighDynamicRangeToneMapping,
+                                           (void *)hdrtm_caps, 
&num_hdrtm_caps);
+    CHECK_VASTATUS(va_status,"vaQueryVideoProcFilterCaps");
+    printf("vaQueryVideoProcFilterCaps num_hdrtm_caps %d\n", num_hdrtm_caps);
+    for (int i = 0; i < num_hdrtm_caps; ++i)    {
+       printf("vaQueryVideoProcFilterCaps hdrtm_caps[%d]: metadata type %d, 
flag %d\n", i, hdrtm_caps[i].metadata_type, hdrtm_caps[i].caps_flag);
+    }
+
+    hdrtm_filter_init(&filter_param_buf_id, g_tm_type);
+    VAHdrMetaDataHDR10 out_hdr10_metadata = {};
+    hdrtm_metadata_init(out_metadata, g_tm_type, out_hdr10_metadata);
+
+    /* Fill pipeline buffer */
+    surface_region.x = 0;
+    surface_region.y = 0;
+    surface_region.width = g_in_pic_width;
+    surface_region.height = g_in_pic_height;
+    output_region.x = 0;
+    output_region.y = 0;
+    output_region.width = g_out_pic_width;
+    output_region.height = g_out_pic_height;
+
+    memset(&pipeline_param, 0, sizeof(pipeline_param));
+    pipeline_param.surface = in_surface_id;
+    pipeline_param.surface_region = &surface_region;
+    pipeline_param.output_region = &output_region;
+    pipeline_param.filter_flags = 0;
+    pipeline_param.filters      = &filter_param_buf_id;
+    pipeline_param.num_filters  = 1;
+    pipeline_param.surface_color_standard = VAProcColorStandardExplicit;
+    pipeline_param.input_color_properties.colour_primaries = 
g_in_colour_primaries;
+    pipeline_param.input_color_properties.transfer_characteristics = 
g_in_transfer_characteristic;
+    pipeline_param.output_color_standard = VAProcColorStandardExplicit;
+    pipeline_param.output_color_properties.colour_primaries = 
g_out_colour_primaries;
+    pipeline_param.output_color_properties.transfer_characteristics = 
g_out_transfer_characteristic;
+    pipeline_param.output_hdr_metadata = &out_metadata; 
+ 
+    va_status = vaCreateBuffer(va_dpy,
+                               context_id,
+                               VAProcPipelineParameterBufferType,
+                               sizeof(pipeline_param),
+                               1,
+                               &pipeline_param,
+                               &pipeline_param_buf_id);
+    CHECK_VASTATUS(va_status, "vaCreateBuffer");
+
+    va_status = vaBeginPicture(va_dpy,
+                               context_id,
+                               out_surface_id);
+    CHECK_VASTATUS(va_status, "vaBeginPicture");
+
+    va_status = vaRenderPicture(va_dpy,
+                                context_id,
+                                &pipeline_param_buf_id,
+                                1);
+    CHECK_VASTATUS(va_status, "vaRenderPicture");
+
+    va_status = vaEndPicture(va_dpy, context_id);
+    CHECK_VASTATUS(va_status, "vaEndPicture");
+
+    if (filter_param_buf_id != VA_INVALID_ID)
+        vaDestroyBuffer(va_dpy,filter_param_buf_id);
+
+    if (pipeline_param_buf_id != VA_INVALID_ID)
+        vaDestroyBuffer(va_dpy,pipeline_param_buf_id);
+
+    return va_status;
+}
+
+static VAStatus
+vpp_context_create()
+{
+    VAStatus va_status = VA_STATUS_SUCCESS;
+    uint32_t i;
+    int32_t j;
+
+    /* VA driver initialization */
+    va_dpy = va_open_display();
+    int32_t major_ver, minor_ver;
+    va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
+    assert(va_status == VA_STATUS_SUCCESS);
+
+    /* Check whether VPP is supported by driver */
+    VAEntrypoint entrypoints[5];
+    int32_t num_entrypoints;
+    num_entrypoints = vaMaxNumEntrypoints(va_dpy);
+    va_status = vaQueryConfigEntrypoints(va_dpy,
+                                         VAProfileNone,
+                                         entrypoints,
+                                         &num_entrypoints);
+    CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints");
+
+    for (j = 0; j < num_entrypoints; j++) {
+        if (entrypoints[j] == VAEntrypointVideoProc)
+            break;
+    }
+
+    if (j == num_entrypoints) {
+        printf("VPP is not supported by driver\n");
+        assert(0);
+    }
+
+    /* Render target surface format check */
+    VAConfigAttrib attrib;
+    attrib.type = VAConfigAttribRTFormat;
+    va_status = vaGetConfigAttributes(va_dpy,
+                                      VAProfileNone,
+                                      VAEntrypointVideoProc,
+                                      &attrib,
+                                     1);
+    CHECK_VASTATUS(va_status, "vaGetConfigAttributes");
+    if (!(attrib.value & g_out_format)) {
+        printf("RT format %d is not supported by VPP !\n",g_out_format);
+        //assert(0);
+    }
+
+    /* Create surface/config/context for VPP pipeline */
+    va_status = create_surface(&g_in_surface_id, g_in_pic_width, 
g_in_pic_height,
+                                g_in_fourcc, g_in_format);
+    CHECK_VASTATUS(va_status, "vaCreateSurfaces for input");
+
+    va_status = create_surface(&g_out_surface_id, g_out_pic_width, 
g_out_pic_height,
+                                g_out_fourcc, g_out_format);
+    CHECK_VASTATUS(va_status, "vaCreateSurfaces for output");
+
+    va_status = vaCreateConfig(va_dpy,
+                               VAProfileNone,
+                               VAEntrypointVideoProc,
+                               &attrib,
+                               1,
+                               &config_id);
+    CHECK_VASTATUS(va_status, "vaCreateConfig");
+
+    va_status = vaCreateContext(va_dpy,
+                                config_id,
+                                g_out_pic_width,
+                                g_out_pic_height,
+                                VA_PROGRESSIVE,
+                                &g_out_surface_id,
+                                1,
+                                &context_id);
+    CHECK_VASTATUS(va_status, "vaCreateContext");
+    
+    uint32_t supported_filter_num = VAProcFilterCount;
+    VAProcFilterType supported_filter_types[VAProcFilterCount];
+
+    va_status = vaQueryVideoProcFilters(va_dpy,
+                                        context_id,
+                                        supported_filter_types,
+                                        &supported_filter_num);
+
+    CHECK_VASTATUS(va_status, "vaQueryVideoProcFilters");
+
+    for (i = 0; i < supported_filter_num; i++){
+        if (supported_filter_types[i] == 
VAProcFilterHighDynamicRangeToneMapping)
+            break;
+    }
+
+    if (i == supported_filter_num) {
+        printf("VPP filter type VAProcFilterHighDynamicRangeToneMapping is not 
supported by driver !\n");        
+    }
+    return va_status;
+}
+
+static void
+vpp_context_destroy()
+{
+    /* Release resource */
+    vaDestroySurfaces(va_dpy, &g_in_surface_id, 1);
+    vaDestroySurfaces(va_dpy, &g_out_surface_id, 1);
+    vaDestroyContext(va_dpy, context_id);
+    vaDestroyConfig(va_dpy, config_id);
+
+    vaTerminate(va_dpy);
+    va_close_display(va_dpy);
+}
+
+static int8_t
+parse_fourcc_and_format(char *str, uint32_t *fourcc, uint32_t *format)
+{
+    uint32_t tfourcc = VA_FOURCC('N', 'V', '1', '2');
+    uint32_t tformat = VA_RT_FORMAT_YUV420;
+
+    if (!strcmp(str, "YV12")){
+        tfourcc = VA_FOURCC('Y', 'V', '1', '2');
+    } else if(!strcmp(str, "I420")){
+        tfourcc = VA_FOURCC('I', '4', '2', '0');
+    } else if(!strcmp(str, "NV12")){
+        tfourcc = VA_FOURCC('N', 'V', '1', '2');
+    } else if(!strcmp(str, "YUY2") || !strcmp(str, "YUYV")) {
+        tfourcc = VA_FOURCC('Y', 'U', 'Y', '2');
+    } else if(!strcmp(str, "UYVY")){
+        tfourcc = VA_FOURCC('U', 'Y', 'V', 'Y');
+    } else if (!strcmp(str, "P010")) {
+        tfourcc = VA_FOURCC('P', '0', '1', '0');
+    } else if (!strcmp(str, "I010")) {
+        tfourcc = VA_FOURCC('I', '0', '1', '0');
+    } else if (!strcmp(str, "RGBA")) {
+        tformat = VA_RT_FORMAT_RGB32;
+        tfourcc = VA_FOURCC_RGBA;
+        printf("parse_fourcc_and_format: RGBA format 0x%8x, fourcc 0x%8x\n", 
tformat, tfourcc);
+    } else if (!strcmp(str, "RGBX")) {
+        tfourcc = VA_FOURCC_RGBX;
+    } else if (!strcmp(str, "BGRA")) {
+        tfourcc = VA_FOURCC_BGRA;
+    } else if (!strcmp(str, "BGRX")) {
+        tfourcc = VA_FOURCC_BGRX;    
+    } else if (!strcmp(str, "P010")) {        
+        tfourcc = VA_FOURCC_P010; 
+        printf("parse_fourcc_and_format: P010\n");
+    } else if (!strcmp(str, "A2RGB10")) {  //A2R10G10B10
+        tfourcc = VA_FOURCC_A2R10G10B10; 
+        printf("parse_fourcc_and_format: ARGB10 format 0x%8x, fourcc 0x%8x\n", 
tformat, tfourcc);
+    } else{
+        printf("Not supported format: %s! Currently only support following 
format: %s\n",
+               str, "YV12, I420, NV12, YUY2(YUYV), UYVY, I010, RGBA, RGBX, 
BGRA or BGRX");
+        assert(0);
+    }
+
+    printf("parse_fourcc_and_format: format 0x%x, fourcc 0x%x\n", tformat, 
tfourcc);
+
+    if (fourcc)
+        *fourcc = tfourcc;
+
+    if (format)
+        *format = tformat;
+
+    return 0;
+}
+
+bool read_frame_to_surface(FILE *fp, VASurfaceID surface_id)
+{
+    VAStatus va_status;
+    VAImage  va_image;
+
+    int i = 0;
+
+    int frame_size = 0, y_size = 0, u_size = 0;
+
+    unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
+    unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
+
+    int bytes_per_pixel = 2;
+
+    void *out_buf = NULL;
+    unsigned char *src_buffer = NULL;
+
+    if (fp == NULL)
+        return false;
+
+    // This function blocks until all pending operations on the surface have 
been completed.
+    va_status = vaSyncSurface(va_dpy, surface_id);
+    CHECK_VASTATUS(va_status, "vaSyncSurface");
+
+    va_status = vaDeriveImage(va_dpy, surface_id, &va_image);
+    CHECK_VASTATUS(va_status, "vaDeriveImage");
+
+    va_status = vaMapBuffer(va_dpy, va_image.buf, &out_buf);
+    CHECK_VASTATUS(va_status, "vaMapBuffer");
+ 
+    printf("read_frame_to_surface: va_image.width %d, va_image.height %d, 
va_image.pitches[0]: %d, va_image.pitches[1] %d, va_image.pitches[2] %d\n", 
+        va_image.width, va_image.height, va_image.pitches[0], 
va_image.pitches[1], va_image.pitches[1]);    
+
+    switch (va_image.format.fourcc)
+    {
+    case VA_FOURCC_P010:
+        frame_size = va_image.width * va_image.height * bytes_per_pixel * 3 / 
2;
+        y_size = va_image.width * va_image.height * bytes_per_pixel;
+        u_size = (va_image.width / 2 * bytes_per_pixel) * (va_image.height >> 
1);
+
+        src_buffer = (unsigned char*)malloc(frame_size);
+        assert(src_buffer);
+        fread(src_buffer, 1, frame_size, fp);
+
+        y_src = src_buffer;
+        u_src = src_buffer + y_size; // UV offset for P010
+
+        y_dst = (unsigned char*)out_buf + va_image.offsets[0]; // Y plane
+        u_dst = (unsigned char*)out_buf + va_image.offsets[1]; // U offset for 
P010
+                                                          
+        for (i = 0; i < va_image.height; i++) {
+            memcpy(y_dst, y_src, va_image.width * 2);
+            y_dst += va_image.pitches[0];
+            y_src += va_image.width * 2;
+        }
+        for (i = 0; i < va_image.height >> 1; i++)  {
+            memcpy(u_dst, u_src, va_image.width * 2);
+            u_dst += va_image.pitches[1];
+            u_src += va_image.width * 2;
+        }
+        printf("read_frame_to_surface: P010 \n");
+        break;
+
+    case VA_RT_FORMAT_RGB32_10BPP:
+    case VA_FOURCC_RGBA:
+    case VA_FOURCC_A2R10G10B10:
+    case VA_FOURCC_A2B10G10R10:
+        frame_size = va_image.width * va_image.height * 4;
+        src_buffer = (unsigned char*)malloc(frame_size);
+        assert(src_buffer);
+        fread(src_buffer, 1, frame_size, fp);
+        y_src = src_buffer;
+        y_dst = (unsigned char*)out_buf + va_image.offsets[0];         
+
+        for (i = 0; i < va_image.height; i++)  {
+            memcpy(y_dst, y_src, va_image.width * 4);
+            y_dst += va_image.pitches[0];
+            y_src += va_image.width * 4;
+        }
+        printf("read_frame_to_surface: RGBA or A2RGB10 \n");
+        break;
+
+    default: // should not come here
+        printf("VA_STATUS_ERROR_INVALID_IMAGE_FORMAT \n");
+        va_status = VA_STATUS_ERROR_INVALID_IMAGE_FORMAT;
+        break;
+    }
+
+    vaUnmapBuffer(va_dpy, va_image.buf);
+    vaDestroyImage(va_dpy, va_image.image_id);
+    if (src_buffer)
+    {
+        free(src_buffer);
+        src_buffer = NULL;
+    }
+
+    if (va_status != VA_STATUS_SUCCESS)
+        return false;
+    else
+        return true;
+}
+
+bool write_surface_to_frame(FILE *fp, VASurfaceID surface_id)
+{
+    VAStatus va_status;
+    VAImage  va_image;
+
+    int i = 0;
+
+    int frame_size = 0, y_size = 0, u_size = 0;
+
+    unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
+    unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
+
+    int bytes_per_pixel = 2;
+
+    void *in_buf = NULL;
+    unsigned char *dst_buffer = NULL;
+
+    if (fp == NULL)
+        return false;
+
+    // This function blocks until all pending operations on the surface have 
been completed.
+    va_status = vaSyncSurface(va_dpy, surface_id);
+    CHECK_VASTATUS(va_status, "vaSyncSurface");
+
+    va_status = vaDeriveImage(va_dpy, surface_id, &va_image);
+    CHECK_VASTATUS(va_status, "vaDeriveImage");
+
+    va_status = vaMapBuffer(va_dpy, va_image.buf, &in_buf);
+    CHECK_VASTATUS(va_status, "vaMapBuffer");
+   
+    printf("write_surface_to_frame: va_image.width %d, va_image.height %d, 
va_image.pitches[0]: %d, va_image.pitches[1] %d, va_image.pitches[2] %d\n", 
+        va_image.width, va_image.height, va_image.pitches[0], 
va_image.pitches[1], va_image.pitches[1]);    
+
+
+    switch (va_image.format.fourcc)
+    {
+    case VA_FOURCC_P010:
+    case VA_FOURCC_NV12:
+        bytes_per_pixel = (va_image.format.fourcc == VA_FOURCC_P010) ? 2 : 1;
+        frame_size = va_image.width * va_image.height * bytes_per_pixel * 3 / 
2;
+        dst_buffer = (unsigned char*)malloc(frame_size);
+        assert(dst_buffer);
+        y_size = va_image.width * va_image.height * bytes_per_pixel;
+        u_size = (va_image.width / 2 * bytes_per_pixel) * (va_image.height >> 
1);
+        y_dst = dst_buffer;
+        u_dst = dst_buffer + y_size; // UV offset for P010
+        y_src = (unsigned char*)in_buf + va_image.offsets[0];
+        u_src = (unsigned char*)in_buf + va_image.offsets[1]; // U offset for 
P010                                                        
+        for (i = 0; i < va_image.height; i++)  {
+            memcpy(y_dst, y_src, va_image.width * 2);
+            y_dst += va_image.width * 2;
+            y_src += va_image.pitches[0];
+        }
+        for (i = 0; i < va_image.height >> 1; i++)  {
+            memcpy(u_dst, u_src, va_image.width * 2);
+            u_dst += va_image.width * 2;
+            u_src += va_image.pitches[1];
+        }
+        printf("read_frame_to_surface: P010 \n");
+        break;
+        
+    case VA_FOURCC_RGBA:
+    case VA_FOURCC_ABGR:
+    case VA_FOURCC_A2B10G10R10:
+    case VA_FOURCC_A2R10G10B10:
+        frame_size = va_image.width * va_image.height * 4;
+        dst_buffer = (unsigned char*)malloc(frame_size);
+        assert(dst_buffer);
+        y_dst = dst_buffer;
+        y_src = (unsigned char*)in_buf + va_image.offsets[0];         
+
+        for (i = 0; i < va_image.height; i++) {
+            memcpy(y_dst, y_src, va_image.width * 4);
+            y_dst += va_image.pitches[0];
+            y_src += va_image.width * 4;
+        } 
+        printf("read_frame_to_surface: RGBA and A2R10G10B10 \n");       
+        break;
+
+    default: // should not come here
+        printf("VA_STATUS_ERROR_INVALID_IMAGE_FORMAT %x\n", 
va_image.format.fourcc);
+        va_status = VA_STATUS_ERROR_INVALID_IMAGE_FORMAT;
+        break;
+    }
+    assert(dst_buffer);
+    fwrite(dst_buffer, 1, frame_size, fp);
+
+    if (dst_buffer)  {
+        free(dst_buffer);
+        dst_buffer = NULL;
+    }
+
+    vaUnmapBuffer(va_dpy, va_image.buf);
+    vaDestroyImage(va_dpy, va_image.image_id);
+    if (va_status != VA_STATUS_SUCCESS)
+        return false;
+    else
+        return true;
+}
+
+static int8_t
+parse_basic_parameters()
+{
+    char str[MAX_LEN];
+
+    /* Read src frame file information */
+    read_value_string(g_config_file_fd, "SRC_FILE_NAME", g_src_file_name);
+    read_value_uint32(g_config_file_fd, "SRC_FRAME_WIDTH", &g_in_pic_width);
+    read_value_uint32(g_config_file_fd, "SRC_FRAME_HEIGHT", &g_in_pic_height);
+    read_value_string(g_config_file_fd, "SRC_FRAME_FORMAT", str);
+    parse_fourcc_and_format(str, &g_in_fourcc, &g_in_format);
+
+    printf("Input file: %s, width: %d, height: %d, fourcc 0x%x, format 
0x%x\n", g_src_file_name, g_in_pic_width, g_in_pic_height, g_in_fourcc, 
g_in_format);
+
+    /* Read dst frame file information */
+    read_value_string(g_config_file_fd, "DST_FILE_NAME", g_dst_file_name);
+    read_value_uint32(g_config_file_fd, "DST_FRAME_WIDTH", &g_out_pic_width);
+    read_value_uint32(g_config_file_fd, "DST_FRAME_HEIGHT",&g_out_pic_height);
+    read_value_string(g_config_file_fd, "DST_FRAME_FORMAT", str);
+    parse_fourcc_and_format(str, &g_out_fourcc, &g_out_format);
+
+    printf("Output file: %s, width: %d, height: %d, fourcc 0x%x, format 
0x%x\n", g_dst_file_name, g_out_pic_width, g_out_pic_height, g_out_fourcc, 
g_out_format);
+
+    read_value_string(g_config_file_fd, "SRC_FILE_FORMAT", str);
+    parse_fourcc_and_format(str, &g_src_file_fourcc, NULL);
+
+    read_value_string(g_config_file_fd, "DST_FILE_FORMAT", str);
+    parse_fourcc_and_format(str, &g_dst_file_fourcc, NULL);
+
+    read_value_uint32(g_config_file_fd, "FRAME_SUM", &g_frame_count);
+
+    read_value_uint32(g_config_file_fd, "SRC_MAX_DISPLAY_MASTERING_LUMINANCE", 
&g_in_max_display_luminance);
+    read_value_uint32(g_config_file_fd, "SRC_MIN_DISPLAY_MASTERING_LUMINANCE", 
&g_in_min_display_luminance);
+    read_value_uint32(g_config_file_fd, "SRC_MAX_CONTENT_LIGHT_LEVEL",         
&g_in_max_content_luminance);
+    read_value_uint32(g_config_file_fd, "SRC_MAX_PICTURE_AVERAGE_LIGHT_LEVEL", 
&g_in_pic_average_luminance);
+
+    read_value_uint32(g_config_file_fd, "DST_MAX_DISPLAY_MASTERING_LUMINANCE", 
&g_out_max_display_luminance);
+    read_value_uint32(g_config_file_fd, "DST_MIN_DISPLAY_MASTERING_LUMINANCE", 
&g_out_min_display_luminance);
+    read_value_uint32(g_config_file_fd, "DST_MAX_CONTENT_LIGHT_LEVEL",         
&g_out_max_content_luminance);
+    read_value_uint32(g_config_file_fd, "DST_MAX_PICTURE_AVERAGE_LIGHT_LEVEL", 
&g_out_pic_average_luminance);
+
+    read_value_uint32(g_config_file_fd, "SRC_FRAME_COLOUR_PRIMARIES",         
&g_in_colour_primaries);
+    read_value_uint32(g_config_file_fd, "SRC_FRAME_TRANSFER_CHARACTERISTICS", 
&g_in_transfer_characteristic);
+    read_value_uint32(g_config_file_fd, "DST_FRAME_COLOUR_PRIMARIES",         
&g_out_colour_primaries);
+    read_value_uint32(g_config_file_fd, "DST_FRAME_TRANSFER_CHARACTERISTICS", 
&g_out_transfer_characteristic);
+
+    read_value_uint32(g_config_file_fd, "TM_TYPE", &g_tm_type);
+
+    return 0;
+}
+
+static void
+print_help()
+{
+    printf("The app is used to test the hdr tm feature.\n");
+    printf("Cmd Usage: ./process_hdr_tm.cfg process_hdr_tm.cfg.cfg\n");
+    printf("The configure file process_hdr_tm.cfg is used to configure the 
para.\n");
+    printf("You can refer process_hdr_tm.cfg.template for each para meaning 
and create the configure file.\n");
+}
+
+int32_t main(int32_t argc, char *argv[])
+{
+    VAStatus va_status;
+    uint32_t i;
+
+    if (argc != 2 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){
+        print_help();
+        return -1;
+    }
+
+    /* Parse the configure file for video process*/
+    strncpy(g_config_file_name, argv[1], MAX_LEN);
+    g_config_file_name[MAX_LEN - 1] = '\0';
+
+    if (NULL == (g_config_file_fd = fopen(g_config_file_name, "r"))){
+        printf("Open configure file %s failed!\n",g_config_file_name);
+        assert(0);
+    }
+
+    /* Parse basic parameters */
+    if (parse_basic_parameters()){
+        printf("Parse parameters in configure file error\n");
+        assert(0);
+    }
+
+    va_status = vpp_context_create();
+    if (va_status != VA_STATUS_SUCCESS) {
+        printf("vpp context create failed \n");
+        assert(0);
+    }
+
+    /* Video frame fetch, process and store */
+    if (NULL == (g_src_file_fd = fopen(g_src_file_name, "r"))){
+        printf("Open SRC_FILE_NAME: %s failed, please specify it in config 
file: %s !\n",
+                g_src_file_name, g_config_file_name);
+        assert(0);
+    }
+
+    if (NULL == (g_dst_file_fd = fopen(g_dst_file_name, "w"))){
+        printf("Open DST_FILE_NAME: %s failed, please specify it in config 
file: %s !\n",
+               g_dst_file_name, g_config_file_name);
+        assert(0);
+    }
+
+    printf("\nStart to process, ...\n");
+    struct timespec Pre_time;
+    struct timespec Cur_time;
+    unsigned int duration = 0;
+    clock_gettime(CLOCK_MONOTONIC, &Pre_time);
+
+    for (i = 0; i < g_frame_count; i ++){
+        read_frame_to_surface(g_src_file_fd, g_in_surface_id);
+        video_frame_process(g_in_surface_id, g_out_surface_id);        
+        write_surface_to_frame(g_dst_file_fd, g_out_surface_id);
+    }
+
+    clock_gettime(CLOCK_MONOTONIC, &Cur_time);
+    duration = (Cur_time.tv_sec - Pre_time.tv_sec) * 1000;
+    if (Cur_time.tv_nsec > Pre_time.tv_nsec) {
+        duration += (Cur_time.tv_nsec - Pre_time.tv_nsec) / 1000000;
+    } else {
+        duration += (Cur_time.tv_nsec + 1000000000 - Pre_time.tv_nsec) / 
1000000 - 1000;
+    }
+    printf("Finish processing, performance: \n" );
+    printf("%d frames processed in: %d ms, ave time = %d ms\n",g_frame_count, 
duration, duration/g_frame_count);
+
+    if (g_src_file_fd) {
+       fclose(g_src_file_fd);
+       g_src_file_fd = NULL;
+    }
+
+    if (g_dst_file_fd) {
+       fclose(g_dst_file_fd);
+       g_dst_file_fd = NULL;
+    }
+
+    if (g_config_file_fd) {
+       fclose(g_config_file_fd);
+       g_config_file_fd = NULL;
+    }
+
+    vpp_context_destroy();
+
+    return 0;
+}

Reply via email to