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 2024-07-10 16:57:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libva-utils (Old)
 and      /work/SRC/openSUSE:Factory/.libva-utils.new.2080 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libva-utils"

Wed Jul 10 16:57:51 2024 rev:28 rq:1186590 version:2.22.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libva-utils/libva-utils.changes  2024-01-06 
17:30:36.374751971 +0100
+++ /work/SRC/openSUSE:Factory/.libva-utils.new.2080/libva-utils.changes        
2024-07-10 16:57:53.702056788 +0200
@@ -1,0 +2,9 @@
+Wed Jul  3 11:32:27 UTC 2024 - Stefan Dirsch <sndir...@suse.com>
+
+- update to 2.22.0
+  * ci: correct the permission of workflows
+  * fix: Fixed possible memory leak in h264encode
+  * doc: Fix meson build options in README
+  * test/CheckEntrypointsForProfile: fix for limited profiles 
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ libva-utils.spec ++++++
--- /var/tmp/diff_new_pack.BgOGFG/_old  2024-07-10 16:57:54.150073235 +0200
+++ /var/tmp/diff_new_pack.BgOGFG/_new  2024-07-10 16:57:54.154073382 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libva-utils
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           libva-utils
-Version:        2.20.1
+Version:        2.22.0
 Release:        0
 Summary:        A collection of utilities and examples to exercise VA-API
 License:        EPL-1.0 AND MIT

++++++ libva-utils-2.20.1.tar.gz -> libva-utils-2.22.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/.github/workflows/freebsd.yml 
new/libva-utils-2.22.0/.github/workflows/freebsd.yml
--- old/libva-utils-2.20.1/.github/workflows/freebsd.yml        2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/.github/workflows/freebsd.yml        2024-06-20 
10:05:10.000000000 +0200
@@ -10,34 +10,33 @@
     - '.github/workflows/**'
     - '!.github/workflows/freebsd.yml'
 
+permissions: read-all
+
 jobs:
   freebsd:
-    runs-on: macos-12
+    runs-on: ubuntu-latest
     steps:
     - name: checkout libva
-      uses: actions/checkout@v3
+      uses: actions/checkout@v4
       with:
         repository: intel/libva
         path: libva
     - name: checkout libva-utils
-      uses: actions/checkout@v3
+      uses: actions/checkout@v4
       with:
         path: libva-utils
     - name: test
-      uses: vmactions/freebsd-vm@v0
+      uses: vmactions/freebsd-vm@v1
       with:
         prepare: |
           pkg install -y meson pkgconf libdrm libXext libXfixes wayland
           pkg install -y -x '^mesa($|-libs)'
         run: |
-          set PREFIX="$PWD/_install"
-          set LIBDIR="$PREFIX/lib"
-          setenv PKG_CONFIG_PATH $LIBDIR/pkgconfig:$PREFIX/libdata/pkgconfig
           cd libva
-          meson --prefix=$PREFIX --libdir=$LIBDIR _build
+          meson setup _build --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
           meson compile -C _build
           meson install -C _build
           cd ../libva-utils
-          meson --prefix=$PREFIX --libdir=$LIBDIR _build
+          meson setup _build --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
           meson compile -C _build
           meson install -C _build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/.github/workflows/ubuntu.yml 
new/libva-utils-2.22.0/.github/workflows/ubuntu.yml
--- old/libva-utils-2.20.1/.github/workflows/ubuntu.yml 2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/.github/workflows/ubuntu.yml 2024-06-20 
10:05:10.000000000 +0200
@@ -10,6 +10,8 @@
     - '.github/workflows/**'
     - '!.github/workflows/ubuntu.yml'
 
+permissions: read-all
+
 jobs:
   ubuntu-20-04:
     runs-on: ubuntu-20.04
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/.github/workflows/windows.yml 
new/libva-utils-2.22.0/.github/workflows/windows.yml
--- old/libva-utils-2.20.1/.github/workflows/windows.yml        2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/.github/workflows/windows.yml        2024-06-20 
10:05:10.000000000 +0200
@@ -12,6 +12,8 @@
     - '!.github/workflows/windows.yml'
     - '!.github/workflows/EnterDevShell.ps1'
 
+permissions: read-all
+
 jobs:
   windows-msvc:
     runs-on: windows-2022
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/NEWS new/libva-utils-2.22.0/NEWS
--- old/libva-utils-2.20.1/NEWS 2023-12-05 09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/NEWS 2024-06-20 10:05:10.000000000 +0200
@@ -1,7 +1,28 @@
-libva-utils NEWS -- summary of changes.  2023-09-14
-Copyright (C) 2009-2023 Intel Corporation
+libva-utils NEWS -- summary of changes.  2024-06-20
+Copyright (C) 2009-2024 Intel Corporation
 
-Version 2.2020.0 - 14.Sep.2023
+Version 2.22.0 - 20.Jun.2024
+* ci:  correct the permission of workflows
+* fix: Fixed possible memory leak in h264encode
+* doc: Fix meson build options in README
+* test/CheckEntrypointsForProfile: fix for limited profiles
+
+Version 2.21.0 - 12.Mar.2024
+* vainfo: Print VAConfigAttribEncMaxTileRows and VAConfigAttribEncMaxTileCols
+* test: Add Prime3 memtype support
+* sample: Add back buffer size options for AV1e
+* sample: simplify cbr/vbr interface and refine codes for AV1e
+* fix: clean some unused variables and functions
+* fix: unify the coding style
+* fix: Fix coverity issues exposed in encode/decode/vpp
+* fix: options in AV1 encode sample
+* fix: fix typo of version in NEWS
+* ci: harden permission for freebsd.yml
+* ci: add workflow permission for all jobs
+* ci: update freebsd vm to the v1 version
+* meson: use meson setup instead of meson options
+
+Version 2.20.0 - 14.Sep.2023
 * test: Enable AV1 encode test
 
 Version 2.19.0 - 04.Jul.2023
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/README.md 
new/libva-utils-2.22.0/README.md
--- old/libva-utils-2.20.1/README.md    2023-12-05 09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/README.md    2024-06-20 10:05:10.000000000 +0200
@@ -40,7 +40,7 @@
 ```
 mkdir build
 cd build
-meson .. or meson .. -Denable-tests
+meson .. or meson .. -Dtests=true
 ninja
 sudo ninja install
 ```
@@ -74,4 +74,4 @@
       VAProfileVP9Profile0            : VAEntrypointVLD
       VAProfileVP9Profile2            : VAEntrypointVLD
       ...
-```
\ No newline at end of file
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/common/va_display_win32.cpp 
new/libva-utils-2.22.0/common/va_display_win32.cpp
--- old/libva-utils-2.20.1/common/va_display_win32.cpp  2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/common/va_display_win32.cpp  2024-06-20 
10:05:10.000000000 +0200
@@ -35,7 +35,7 @@
     IDXCoreAdapterFactory *factory = nullptr;
     IDXCoreAdapterList *adapter_list = nullptr;
     IDXCoreAdapter *adapter = nullptr;
-    typedef HRESULT(WINAPI *PFN_CREATE_DXCORE_ADAPTER_FACTORY)(REFIID riid, 
void **ppFactory);
+    typedef HRESULT(WINAPI * PFN_CREATE_DXCORE_ADAPTER_FACTORY)(REFIID riid, 
void **ppFactory);
     PFN_CREATE_DXCORE_ADAPTER_FACTORY DXCoreCreateAdapterFactory;
     HRESULT hr = S_OK;
 
@@ -71,7 +71,7 @@
     }
 
     if (!adapter_string) fprintf(stdout, "Available devices for --display 
win32:\n");
-    for (int i=0; i < adapter_list->GetAdapterCount(); i++) {
+    for (int i = 0; i < adapter_list->GetAdapterCount(); i++) {
         if (SUCCEEDED(adapter_list->GetAdapter(i, IID_IDXCoreAdapter, (void 
**)&adapter))) {
             size_t desc_size = 0;
             if 
(FAILED(adapter->GetPropertySize(DXCoreAdapterProperty::DriverDescription, 
&desc_size))) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/configure.ac 
new/libva-utils-2.22.0/configure.ac
--- old/libva-utils-2.20.1/configure.ac 2023-12-05 09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/configure.ac 2024-06-20 10:05:10.000000000 +0200
@@ -29,8 +29,8 @@
 # - 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], [20])
-m4_define([libva_utils_micro_version], [1])
+m4_define([libva_utils_minor_version], [22])
+m4_define([libva_utils_micro_version], [0])
 m4_define([libva_utils_pre_version],   [0])
 
 m4_define([libva_utils_version],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/encode/av1encode.c 
new/libva-utils-2.22.0/encode/av1encode.c
--- old/libva-utils-2.20.1/encode/av1encode.c   2023-12-05 09:51:11.000000000 
+0100
+++ new/libva-utils-2.22.0/encode/av1encode.c   2024-06-20 10:05:10.000000000 
+0200
@@ -54,8 +54,6 @@
  * 
  * 
  * */
-
-
 #define BITSTREAM_ALLOCATE_STEPPING 1024 // in byte
 
 struct __bitstream {
@@ -65,7 +63,6 @@
 };
 typedef struct __bitstream bitstream;
 
-
 static void
 bitstream_start(bitstream *bs)
 {
@@ -152,7 +149,6 @@
  * 
  * 
  * */
-
 #define PRIMARY_REF_BITS              3
 #define PRIMARY_REF_NONE              7
 
@@ -172,7 +168,6 @@
 
 #define SURFACE_NUM 16 /* 16 surfaces for source YUV */
 
-
 enum {
     SINGLE_REFERENCE      = 0,
     COMPOUND_REFERENCE    = 1,
@@ -235,7 +230,6 @@
     uint32_t TileSizeBytes;
 };
 
-
 struct QuantizationParams
 {
     uint32_t base_q_idx;
@@ -318,7 +312,6 @@
 
 typedef struct FrameHeader
 {
-
     uint32_t show_existing_frame;
     uint32_t frame_to_show_map_idx;
     uint64_t frame_presentation_time;
@@ -481,10 +474,9 @@
     uint32_t base_qindex;
     int bit_depth;
     int target_bitrate;
-    int max_bitrate;
+    int vbr_max_bitrate;
     int buffer_size;
     int initial_buffer_fullness;
-
 };
 
 
@@ -525,6 +517,7 @@
     unsigned long long display_order;
     unsigned long long encode_order;
 };
+
 static  struct storage_task_t *storage_task_header = NULL, *storage_task_tail 
= NULL;
 #define SRC_SURFACE_IN_ENCODING 0
 #define SRC_SURFACE_IN_STORAGE  1
@@ -534,7 +527,6 @@
 static  pthread_cond_t  encode_cond = PTHREAD_COND_INITIALIZER;
 static  pthread_t encode_thread;
 
-static  char *coded_fn = NULL;
 static  FILE *coded_fp = NULL, *srcyuv_fp = NULL, *recyuv_fp = NULL;
 static  unsigned long long srcyuv_frames = 0;
 static  int srcyuv_fourcc = VA_FOURCC_IYUV;
@@ -565,7 +557,6 @@
 static int len_seq_header;
 static int len_pic_header;
 
-
 /*
  * Helper function for profiling purposes
  */
@@ -577,22 +568,6 @@
     return tv.tv_usec / 1000 + tv.tv_sec * 1000;
 }
 
-static char *fourcc_to_string(int fourcc)
-{
-    switch (fourcc) {
-    case VA_FOURCC_NV12:
-        return "NV12";
-    case VA_FOURCC_IYUV:
-        return "IYUV";
-    case VA_FOURCC_YV12:
-        return "YV12";
-    case VA_FOURCC_UYVY:
-        return "UYVY";
-    default:
-        return "Unknown";
-    }
-}
-
 static int string_to_fourcc(char *str)
 {
     CHECK_NULL(str);
@@ -639,9 +614,6 @@
 
 static void print_help()
 {
-
-    //./av1encode -n 8 -f 30 --intra_period 4 --ip_period 1 --rcmode CQP 
--srcyuv ./input.yuv --recyuv ./rec.yuv --fourcc IYUV --level 8  --height 1080 
--width 1920 --base_q_idx 128 -o ./out.av1 -t 3360000  -u 210 -d 420 --LDB
-
     printf("./av1encode <options>\n");
     printf("   -n <frames> -f <frame rate> -o <output>\n");
     printf("   --intra_period <number>\n");
@@ -658,15 +630,15 @@
     printf("   --normal_mode select VAEntrypointEncSlice as entrypoint\n");
     printf("   --low_power_mode select VAEntrypointEncSliceLP as 
entrypoint\n");
 
-    printf(" sample usage");
-    printf("./av1encode -n 8 -f 30 --intra_period 4 --ip_period 1 --rcmode CQP 
--srcyuv ./input.yuv --recyuv ./rec.yuv --fourcc IYUV --level 8  --height 1080 
--width 1920 --base_q_idx 128 -o ./out.av1 -t 3360000  -u 210 -d 420 --LDB 
--low_power_mode");
-
+    printf(" sample usage:\n");
+    printf("./av1encode -n 8 -f 30 --intra_period 4 --ip_period 1 --rcmode CQP 
--srcyuv ./input.yuv --recyuv ./rec.yuv --fourcc IYUV --level 8 --width 1920 
--height 1080 --base_q_idx 128  -o ./out.av1 --LDB --low_power_mode\n"
+           "./av1encode -n 8 -f 30 --intra_period 4 --ip_period 1 --rcmode CBR 
--srcyuv ./input.yuv --recyuv ./rec.yuv --fourcc IYUV --level 8 --width 1920 
--height 1080 --target_bitrate 3360000 -o ./out.av1 --LDB --low_power_mode\n"
+           "./av1encode -n 8 -f 30 --intra_period 4 --ip_period 1 --rcmode VBR 
--srcyuv ./input.yuv --recyuv ./rec.yuv --fourcc IYUV --level 8 --width 1920 
--height 1080 --vbr_max_bitrate 3360000 -o ./out.av1 --LDB --low_power_mode\n");
 
 }
 
 static void process_cmdline(int argc, char *argv[])
 {
-
     int c;
     const struct option long_opts[] = {
         {"help",            no_argument,        NULL, 0 },
@@ -685,12 +657,13 @@
         {"LDB",             no_argument,        NULL, 13},
         {"normal_mode",     no_argument,        NULL, 14},
         {"low_power_mode",  no_argument,        NULL, 15},
+        {"target_bitrate",  required_argument,  NULL, 16},
+        {"vbr_max_bitrate", required_argument,  NULL, 17},
         {NULL,              no_argument,        NULL, 0 }
-
     };
-    int long_index;
 
-    while ((c = getopt_long_only(argc, argv, "n:f:o:t:m:u:d:?", long_opts, 
&long_index)) != EOF) 
+    int long_index;
+    while ((c = getopt_long_only(argc, argv, "n:f:o:t:m:u:d:?", long_opts, 
&long_index)) != EOF)
     {
         switch (c) 
         {
@@ -752,10 +725,12 @@
                 requested_entrypoint = VAEntrypointEncSliceLP;
                 break;
             case 't':
+            case 16:
                 ips.target_bitrate = atoi(optarg);
                 break;
             case 'm':
-                ips.max_bitrate = atoi(optarg);
+            case 17:
+                ips.vbr_max_bitrate = atoi(optarg);
                 break;
             case 'u':
                 ips.buffer_size = atoi(optarg) * 8000;
@@ -776,14 +751,31 @@
     ips.MinBaseQIndex = 1;
     ips.bit_depth = 8;
 
-    if(ips.RateControlMethod == VA_RC_CBR) ips.max_bitrate = 
ips.target_bitrate; //set max = target in CBR case
+    if (ips.frame_rate_extD == 0)
+    {
+        ips.frame_rate_extN = 3000;
+        ips.frame_rate_extD = 100;
+    }
 
-    if(ips.RateControlMethod == VA_RC_VBR) //VBR
+    int default_bitrate = (long long int) ips.height * ips.width * 12 * 
ips.frame_rate_extN / ips.frame_rate_extD / 50;
+    // For CBR, target bitrate should be set
+    if(ips.RateControlMethod == VA_RC_CBR)
     {
-        if(ips.max_bitrate == 0)
+        if (ips.target_bitrate == 0)
         {
-            printf("max bitrate is not provided in VBR mode\n");
-            exit(0);
+            ips.target_bitrate = default_bitrate;
+        }
+    }
+    // For VBR, max bitrate should be set
+    else if (ips.RateControlMethod == VA_RC_VBR)
+    {
+        if (ips.target_bitrate == 0 && ips.vbr_max_bitrate == 0)
+        {
+            ips.vbr_max_bitrate = default_bitrate;
+        }
+        else if (ips.vbr_max_bitrate == 0)
+        {
+            ips.vbr_max_bitrate = ips.target_bitrate;
         }
     }
 
@@ -874,12 +866,10 @@
     printf("frame width: %d \n", ips.width);
     printf("base_q_index: %d \n", ips.base_qindex);
     printf("target_bitrate: %d bps\n", ips.target_bitrate);
-    printf("max_bitrate: %d bps\n", ips.max_bitrate);
+    printf("vbr_max_bitrate: %d bps\n", ips.vbr_max_bitrate);
     return 0;
 }
 
-
-
 static int init_va(void)
 {
     va_dpy = va_open_display();
@@ -1096,7 +1086,6 @@
     return 0;
 }
 
-
 static int release_encode()
 {
     int i;
@@ -1122,7 +1111,6 @@
     return 0;
 }
 
-
 /*
  * Return displaying order with specified periods and encoding order
  * displaying_order: displaying order
@@ -1163,7 +1151,6 @@
 static void
 fill_pps_header(uint64_t displaying_order)
 {
-
     fh.show_existing_frame = 0;
     fh.frame_to_show_map_idx = 0;
     fh.frame_presentation_time = 0;
@@ -1275,10 +1262,8 @@
     fh.skipModeFrame[1] = 0;
     fh.allow_warped_motion = 0;
     fh.reduced_tx_set = 1;
-
 }
 
-
 // brief interface with va, render bitstream
 static void
 va_render_packed_data(bitstream* bs)
@@ -1326,7 +1311,6 @@
         vaDestroyBuffer(va_dpy, packed_data_bufid);
         packed_data_bufid = VA_INVALID_ID;
     }
-
 }
 
 static void
@@ -1388,7 +1372,6 @@
     bitstream_free(&bs);
 }
 
-
 static void
 build_sps_buffer(VAEncSequenceParameterBufferAV1* sps)
 {
@@ -1400,7 +1383,14 @@
     sps->intra_period = ips.intra_period;
     sps->ip_period    = ips.ip_period;
 
-    sps->bits_per_second = ips.target_bitrate;;
+    if (ips.RateControlMethod == VA_RC_CBR)
+    {
+        sps->bits_per_second = ips.target_bitrate;
+    }
+    else if (ips.RateControlMethod == VA_RC_VBR)
+    {
+        sps->bits_per_second = ips.vbr_max_bitrate;
+    }
 
     sps->order_hint_bits_minus_1 = (uint8_t)(sh.order_hint_bits_minus1);
 
@@ -1420,10 +1410,8 @@
     sps->seq_fields.bits.bit_depth_minus8           = ips.bit_depth - 8;
     sps->seq_fields.bits.subsampling_x              = 0;
     sps->seq_fields.bits.subsampling_y              = 0;
-
 }
 
-
 static void
 render_sequence()
 {
@@ -1445,7 +1433,6 @@
         vaDestroyBuffer(va_dpy, seq_param_buf_id);
         seq_param_buf_id = VA_INVALID_ID;
     }
-
 }
 
 static void
@@ -1468,8 +1455,19 @@
     misc_param->type = VAEncMiscParameterTypeRateControl;
     misc_rate_ctrl = (VAEncMiscParameterRateControl *)misc_param->data;
     memset(misc_rate_ctrl, 0, sizeof(*misc_rate_ctrl));
-    misc_rate_ctrl->bits_per_second = ips.max_bitrate;
-    misc_rate_ctrl->target_percentage = (int)(100.0 * 
(double)ips.target_bitrate / (double)ips.max_bitrate);
+    if (ips.RateControlMethod == VA_RC_CBR)
+    {
+        misc_rate_ctrl->bits_per_second = ips.target_bitrate;
+    }
+    else if (ips.RateControlMethod == VA_RC_VBR)
+    {
+        misc_rate_ctrl->bits_per_second = ips.vbr_max_bitrate;
+        if (ips.target_bitrate != 0)
+        {
+            misc_rate_ctrl->target_percentage = MIN(100, (uint32_t) (100.0 * 
ips.target_bitrate / ips.vbr_max_bitrate));
+        }
+    }
+
     vaUnmapBuffer(va_dpy, rc_param_buf);
 
     render_id = rc_param_buf;
@@ -1484,7 +1482,6 @@
     }
 }
 
-
 static void
 render_hrd_buffer()
 {
@@ -1523,7 +1520,6 @@
     }
 }
 
-
 static void
 render_fr_buffer()
 {
@@ -1565,12 +1561,13 @@
 render_misc_buffer()
 {
     render_rc_buffer();
-    render_hrd_buffer();
+    if (ips.buffer_size != 0 || ips.initial_buffer_fullness != 0)
+    {
+        render_hrd_buffer();
+    }
     render_fr_buffer();
 }
 
-
-
 static void
 render_tile_group()
 {
@@ -1590,10 +1587,8 @@
         vaDestroyBuffer(va_dpy, tile_param_buf_id);
         tile_param_buf_id = VA_INVALID_ID;
     }
-
 }
 
-
 static void
 pack_obu_header(bitstream *bs, int obu_type, uint32_t obu_extension_flag)
 {
@@ -1609,8 +1604,6 @@
     }
 }
 
-
-
 static void
 pack_obu_header_size(bitstream *bs, 
                     uint32_t value,
@@ -1685,7 +1678,6 @@
     // end of pack frame size info
 }
 
-
 static void
 pack_seq_data(bitstream *bs)
 {
@@ -1804,7 +1796,6 @@
     return; //only for B frame, not enable by default
 }
 
-
 static void
 pack_show_frame(bitstream* bs)
 {
@@ -1820,14 +1811,10 @@
         put_ui(bs, 0, 1); //error_resilient_mode
 }
 
-
 static void
 pack_ref_frame_flags(bitstream* bs, uint8_t error_resilient_mode, uint8_t isI)
 {
-    uint8_t primary_ref_frame = PRIMARY_REF_NONE;
-    if(isI || error_resilient_mode) 
-        primary_ref_frame = PRIMARY_REF_NONE;
-    else
+    if(!(isI || error_resilient_mode))
         put_ui(bs, 0, 3); //primary_ref_frame
     if (!(fh.frame_type == SWITCH_FRAME || (fh.frame_type == KEY_FRAME && 
fh.show_frame)))
         put_ui(bs, fh.refresh_frame_flags, NUM_REF_FRAMES);
@@ -1852,7 +1839,6 @@
     put_ui(bs, render_and_frame_size_different, 
1);//render_and_frame_size_different
 }
 
-
 static void
 pack_frame_size(bitstream *bs)
 {
@@ -1864,7 +1850,6 @@
 
 }
 
-
 static void
 pack_frame_size_with_refs(bitstream* bs)
 {
@@ -1911,10 +1896,6 @@
         put_ui(bs, 1, 1); //use_ref_frame_mvs
 }
 
-
-
-
-
 static void
 pack_tile_info(bitstream* bs)
 {
@@ -1981,7 +1962,6 @@
     }
 }
 
-
 static void
 pack_loop_filter_params(bitstream* bs)
 {
@@ -2027,7 +2007,6 @@
     }
 }
 
-
 static void
 pack_lr_params(bitstream* bs)
 {
@@ -2066,7 +2045,6 @@
     }
 }
 
-
 static void
 pack_delta_q_params(bitstream* bs)
 {
@@ -2151,18 +2129,15 @@
             put_ui(bs, fh.allow_intrabc, 1);
     }
 
-
     if (!fh.disable_cdf_update)
         put_ui(bs, fh.disable_frame_end_update_cdf, 1); 
//disable_frame_end_update_cdf
 
     pack_tile_info(bs);
 
-
     //quantization_params
     offsets.QIndexBitOffset = bs->bit_offset;
     pack_quantization_params(bs);
 
-
     //segmentation_params
     offsets.SegmentationBitOffset = bs->bit_offset;
     put_ui(bs, 0, 1); //segmentation_enabled
@@ -2210,7 +2185,6 @@
     else
         pack_frame_header(&tmp);
 
-
     offsets.FrameHdrOBUSizeInBits = tmp.bit_offset;
 
     const uint32_t obu_extension_flag = sh.operating_points_cnt_minus_1 ? 1 : 
0;
@@ -2225,7 +2199,6 @@
     const uint32_t obu_size_in_bytes = (tmp.bit_offset + 7) / 8;
     pack_obu_header_size(bs, obu_size_in_bytes, fh.show_existing_frame? 0: 4);
 
-
     if (!fh.show_existing_frame)
     {
         // The offset is related to frame or frame header OBU. IVF, sequence, 
and other headers should not be counted.
@@ -2238,7 +2211,6 @@
         offsets.FrameHdrOBUSizeInBits     += obuPayloadOffset;
     }
 
-
     bitstream_cat(bs, &tmp);
 }
 
@@ -2272,7 +2244,6 @@
         // for Low delay B
         pps->ref_frame_ctrl_l1.fields.search_idx0 = ips.LDB ? BWDREF_FRAME : 
INTRA_FRAME;
     }
-
 }
 
 static void
@@ -2351,8 +2322,6 @@
     for(int k = 0;k < 8;k++)
         pps->ref_deltas[k] = 0;
 
-
-
     //block-level deltas
     pps->mode_control_flags.bits.delta_q_present  = fh.delta_q_present;
     pps->mode_control_flags.bits.delta_q_res  = fh.delta_q_res;
@@ -2430,7 +2399,6 @@
     pps->skip_frames_reduced_size = 0;
 }
 
-
 static void
 render_picture()
 {
@@ -2452,7 +2420,6 @@
         vaDestroyBuffer(va_dpy, pic_param_buf_id);
         pic_param_buf_id = VA_INVALID_ID;
     }
-
 }
 
 static int upload_source_YUV_once_for_all()
@@ -2588,7 +2555,6 @@
         ret = fseek(coded_fp, frame_end, SEEK_SET);
         CHECK_CONDITION(ret == 0);
     }
-    
 
     printf("\n      "); /* return back to startpoint */
     switch (encode_order % 4) {
@@ -2732,7 +2698,6 @@
     pthread_mutex_unlock(&encode_mutex);
 }
 
-
 static void * storage_task_thread(void *t)
 {
     while (1) {
@@ -2826,15 +2791,12 @@
         CHECK_VASTATUS(va_status, "vaBeginPicture");
         BeginPictureTicks += GetTickCount() - tmp;
 
-        
-
         tmp = GetTickCount(); //start of render process
 
         // prepare parameters used for sequence and frame
         fill_sps_header();
         fill_pps_header(current_frame_display);
-        
-        
+
         // init length of packed headers
         len_ivf_header = 0;
         len_seq_header = 0;
@@ -2863,14 +2825,14 @@
         {
             len_seq_header = 0;
         }
-        
+
         if((ips.RateControlMethod == 2 || ips.RateControlMethod == 4) && 
current_frame_encoding == 0)
         {
             // misc buffer are not need in CQP case
             // only needed in first frame
             render_misc_buffer();
         }
-        
+
 
         render_packedpicture(); //render packed frame header 
         render_picture(); //render frame PPS buffer
@@ -2897,7 +2859,6 @@
     return 0;
 }
 
-
 static int calc_PSNR(double *psnr)
 {
     char *srcyuv_ptr = NULL, *recyuv_ptr = NULL, tmp;
@@ -2990,7 +2951,6 @@
     return 0;
 }
 
-
 int main(int argc, char **argv)
 {
     unsigned int start;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/encode/h264encode.c 
new/libva-utils-2.22.0/encode/h264encode.c
--- old/libva-utils-2.20.1/encode/h264encode.c  2023-12-05 09:51:11.000000000 
+0100
+++ new/libva-utils-2.22.0/encode/h264encode.c  2024-06-20 10:05:10.000000000 
+0200
@@ -1165,6 +1165,7 @@
     /* check the interested configattrib */
     if ((attrib[VAConfigAttribRTFormat].value & VA_RT_FORMAT_YUV420) == 0) {
         printf("Not find desired YUV420 RT format\n");
+       free(entrypoints);
         exit(1);
     } else {
         config_attrib[config_attrib_num].type = VAConfigAttribRTFormat;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/encode/vp8enc.c 
new/libva-utils-2.22.0/encode/vp8enc.c
--- old/libva-utils-2.20.1/encode/vp8enc.c      2023-12-05 09:51:11.000000000 
+0100
+++ new/libva-utils-2.22.0/encode/vp8enc.c      2024-06-20 10:05:10.000000000 
+0200
@@ -677,7 +677,6 @@
 {
     VAEntrypoint entrypoints[5];
     int num_entrypoints;
-    int i;
     VAConfigAttrib conf_attrib[2];
     VASurfaceAttrib surface_attrib;
     int major_ver, minor_ver;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/meson.build 
new/libva-utils-2.22.0/meson.build
--- old/libva-utils-2.20.1/meson.build  2023-12-05 09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/meson.build  2024-06-20 10:05:10.000000000 +0200
@@ -1,5 +1,5 @@
 project('libva-utils', 'c', 'cpp',
-        version : '2.20.1',
+        version : '2.22.0',
         default_options : [
           'warning_level=2',
           'c_std=gnu99',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/test/test_data.h 
new/libva-utils-2.22.0/test/test_data.h
--- old/libva-utils-2.20.1/test/test_data.h     2023-12-05 09:51:11.000000000 
+0100
+++ new/libva-utils-2.22.0/test/test_data.h     2024-06-20 10:05:10.000000000 
+0200
@@ -274,6 +274,9 @@
     VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR, VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM,
     VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME,
     VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
+#if VA_CHECK_VERSION(1, 21, 0)
+    VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3,
+#endif
 };
 
 static const std::map<VASurfaceAttribType, const BitMasks&>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/test/test_va_api_createbuffer.cpp 
new/libva-utils-2.22.0/test/test_va_api_createbuffer.cpp
--- old/libva-utils-2.20.1/test/test_va_api_createbuffer.cpp    2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/test/test_va_api_createbuffer.cpp    2024-06-20 
10:05:10.000000000 +0200
@@ -167,19 +167,19 @@
             make_tuple(g_vaH264Profiles, 
sizeof(VAEncSliceParameterBufferH264)),
             make_tuple(g_vaJPEGProfiles, 
sizeof(VAEncSliceParameterBufferJPEG)),
             make_tuple(g_vaHEVCProfiles, 
sizeof(VAEncSliceParameterBufferHEVC)),
-            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),            
+            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),
         }
     },
     {
         VAEncPackedHeaderParameterBufferType, {
             make_tuple(g_vaProfiles, sizeof(VAEncPackedHeaderParameterBuffer)),
-            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),            
+            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),
         }
     },
     {
         VAEncMiscParameterBufferType, {
             make_tuple(g_vaProfiles, sizeof(VAEncMiscParameterBuffer)),
-            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),            
+            make_tuple(g_vaAV1Profiles, 
sizeof(VAEncPictureParameterBufferAV1)),
         }
     },
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libva-utils-2.20.1/test/test_va_api_createsurfaces.cpp 
new/libva-utils-2.22.0/test/test_va_api_createsurfaces.cpp
--- old/libva-utils-2.20.1/test/test_va_api_createsurfaces.cpp  2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/test/test_va_api_createsurfaces.cpp  2024-06-20 
10:05:10.000000000 +0200
@@ -88,6 +88,9 @@
 
         const uint32_t drmMemMask = VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM
                                     | VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME
+#if VA_CHECK_VERSION(1, 21, 0)
+                                    | VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3
+#endif
                                     | VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2;
 
         // create surfaces for each supported attribute
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/test/test_va_api_query_config.cpp 
new/libva-utils-2.22.0/test/test_va_api_query_config.cpp
--- old/libva-utils-2.20.1/test/test_va_api_query_config.cpp    2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/test/test_va_api_query_config.cpp    2024-06-20 
10:05:10.000000000 +0200
@@ -50,6 +50,8 @@
     EXPECT_TRUE(numProfiles > 0)
             << numProfiles << " profiles are supported by driver";
 
+    profiles.resize(numProfiles);
+
     const int maxEntrypoints = vaMaxNumEntrypoints(m_vaDisplay);
     EXPECT_TRUE(maxEntrypoints > 0)
             << maxEntrypoints << " entrypoints are reported";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/vainfo/vainfo.c 
new/libva-utils-2.22.0/vainfo/vainfo.c
--- old/libva-utils-2.20.1/vainfo/vainfo.c      2023-12-05 09:51:11.000000000 
+0100
+++ new/libva-utils-2.22.0/vainfo/vainfo.c      2024-06-20 10:05:10.000000000 
+0200
@@ -283,6 +283,18 @@
         printf("%-*sl1=%d\n", 45, "", 
(attrib_list[VAConfigAttribEncMaxRefFrames].value >> 16) & 0xffff);
     }
 
+ #if VA_CHECK_VERSION(1, 21, 0)
+    if (attrib_list[VAConfigAttribEncMaxTileRows].value & 
(~VA_ATTRIB_NOT_SUPPORTED)) {
+        printf("    %-39s: %d\n", 
vaConfigAttribTypeStr(attrib_list[VAConfigAttribEncMaxTileRows].type),
+               attrib_list[VAConfigAttribEncMaxTileRows].value);
+    }
+
+    if (attrib_list[VAConfigAttribEncMaxTileCols].value & 
(~VA_ATTRIB_NOT_SUPPORTED)) {
+        printf("    %-39s: %d\n", 
vaConfigAttribTypeStr(attrib_list[VAConfigAttribEncMaxTileCols].type),
+               attrib_list[VAConfigAttribEncMaxTileCols].value);
+    }
+#endif
+
     if (attrib_list[VAConfigAttribEncMaxSlices].value & 
(~VA_ATTRIB_NOT_SUPPORTED)) {
         printf("    %-39s: %d\n", 
vaConfigAttribTypeStr(attrib_list[VAConfigAttribEncMaxSlices].type),
                attrib_list[VAConfigAttribEncMaxSlices].value);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/videoprocess/vpp3dlut.cpp 
new/libva-utils-2.22.0/videoprocess/vpp3dlut.cpp
--- old/libva-utils-2.20.1/videoprocess/vpp3dlut.cpp    2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/videoprocess/vpp3dlut.cpp    2024-06-20 
10:05:10.000000000 +0200
@@ -1185,7 +1185,6 @@
     VAProcPipelineParameterBuffer pipeline_param;
     VARectangle surface_region, output_region;
     VABufferID pipeline_param_buf_id = VA_INVALID_ID;
-    VABufferID filter_param_buf_id = VA_INVALID_ID;
 
     /* Fill pipeline buffer */
     surface_region.x = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-utils-2.20.1/videoprocess/vpphdr_tm.cpp 
new/libva-utils-2.22.0/videoprocess/vpphdr_tm.cpp
--- old/libva-utils-2.20.1/videoprocess/vpphdr_tm.cpp   2023-12-05 
09:51:11.000000000 +0100
+++ new/libva-utils-2.22.0/videoprocess/vpphdr_tm.cpp   2024-06-20 
10:05:10.000000000 +0200
@@ -91,7 +91,7 @@
 static uint32_t g_out_colour_primaries = 9;
 static uint32_t g_out_transfer_characteristic = 16;
 
-static uint32_t g_tm_type =1;
+static uint32_t g_tm_type = 1;
 
 static int8_t
 read_value_string(FILE *fp, const char* field_name, char* value)
@@ -129,7 +129,7 @@
         while (*str == ' ')
             str++;
 
-        *(str + strlen(str)-1) = '\0';
+        *(str + strlen(str) - 1) = '\0';
         strcpy(value, str);
 
         return 0;
@@ -143,8 +143,8 @@
     char str[MAX_LEN];
 
     if (read_value_string(fp, field_name, str)) {
-       printf("Failed to find integer field: %s", field_name);
-       return -1;
+        printf("Failed to find integer field: %s", field_name);
+        return -1;
     }
 
     *value = (uint32_t)atoi(str);
@@ -152,20 +152,6 @@
     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,
@@ -180,15 +166,15 @@
 
     va_status = vaCreateSurfaces(va_dpy,
                                  format,
-                                 width ,
+                                 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);
+    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;
 }
@@ -213,12 +199,12 @@
     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; 
+    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);   
+    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);
 
@@ -239,8 +225,7 @@
     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)
-    {
+    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;
@@ -274,7 +259,7 @@
 
 static VAStatus
 video_frame_process(VASurfaceID in_surface_id,
-                            VASurfaceID out_surface_id)
+                    VASurfaceID out_surface_id)
 {
     VAStatus va_status;
     VAProcPipelineParameterBuffer pipeline_param = {};
@@ -290,10 +275,10 @@
     va_status = vaQueryVideoProcFilterCaps(va_dpy, context_id,
                                            
VAProcFilterHighDynamicRangeToneMapping,
                                            (void *)hdrtm_caps, 
&num_hdrtm_caps);
-    CHECK_VASTATUS(va_status,"vaQueryVideoProcFilterCaps");
+    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);
+        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);
@@ -323,8 +308,8 @@
     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; 
- 
+    pipeline_param.output_hdr_metadata = &out_metadata;
+
     va_status = vaCreateBuffer(va_dpy,
                                context_id,
                                VAProcPipelineParameterBufferType,
@@ -349,10 +334,10 @@
     CHECK_VASTATUS(va_status, "vaEndPicture");
 
     if (filter_param_buf_id != VA_INVALID_ID)
-        vaDestroyBuffer(va_dpy,filter_param_buf_id);
+        vaDestroyBuffer(va_dpy, filter_param_buf_id);
 
     if (pipeline_param_buf_id != VA_INVALID_ID)
-        vaDestroyBuffer(va_dpy,pipeline_param_buf_id);
+        vaDestroyBuffer(va_dpy, pipeline_param_buf_id);
 
     return va_status;
 }
@@ -397,20 +382,20 @@
                                       VAProfileNone,
                                       VAEntrypointVideoProc,
                                       &attrib,
-                                     1);
+                                      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);
+        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);
+                               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);
+                               g_out_fourcc, g_out_format);
     CHECK_VASTATUS(va_status, "vaCreateSurfaces for output");
 
     va_status = vaCreateConfig(va_dpy,
@@ -430,7 +415,7 @@
                                 1,
                                 &context_id);
     CHECK_VASTATUS(va_status, "vaCreateContext");
-    
+
     uint32_t supported_filter_num = VAProcFilterCount;
     VAProcFilterType supported_filter_types[VAProcFilterCount];
 
@@ -441,13 +426,13 @@
 
     CHECK_VASTATUS(va_status, "vaQueryVideoProcFilters");
 
-    for (i = 0; i < supported_filter_num; i++){
+    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");        
+        printf("VPP filter type VAProcFilterHighDynamicRangeToneMapping is not 
supported by driver !\n");
     }
     return va_status;
 }
@@ -471,15 +456,15 @@
     uint32_t tfourcc = VA_FOURCC('N', 'V', '1', '2');
     uint32_t tformat = VA_RT_FORMAT_YUV420;
 
-    if (!strcmp(str, "YV12")){
+    if (!strcmp(str, "YV12")) {
         tfourcc = VA_FOURCC('Y', 'V', '1', '2');
-    } else if(!strcmp(str, "I420")){
+    } else if (!strcmp(str, "I420")) {
         tfourcc = VA_FOURCC('I', '4', '2', '0');
-    } else if(!strcmp(str, "NV12")){
+    } else if (!strcmp(str, "NV12")) {
         tfourcc = VA_FOURCC('N', 'V', '1', '2');
-    } else if(!strcmp(str, "YUY2") || !strcmp(str, "YUYV")) {
+    } else if (!strcmp(str, "YUY2") || !strcmp(str, "YUYV")) {
         tfourcc = VA_FOURCC('Y', 'U', 'Y', '2');
-    } else if(!strcmp(str, "UYVY")){
+    } else if (!strcmp(str, "UYVY")) {
         tfourcc = VA_FOURCC('U', 'Y', 'V', 'Y');
     } else if (!strcmp(str, "P010")) {
         tfourcc = VA_FOURCC('P', '0', '1', '0');
@@ -494,14 +479,14 @@
     } 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; 
+        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; 
+        tfourcc = VA_FOURCC_A2R10G10B10;
         printf("parse_fourcc_and_format: ARGB10 format 0x%8x, fourcc 0x%8x\n", 
tformat, tfourcc);
-    } else{
+    } 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);
@@ -525,10 +510,10 @@
 
     int i = 0;
 
-    int frame_size = 0, y_size = 0, u_size = 0;
+    int frame_size = 0, y_size = 0;
 
-    unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
-    unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
+    unsigned char *y_src = NULL, *u_src = NULL;
+    unsigned char *y_dst = NULL, *u_dst = NULL;
 
     int bytes_per_pixel = 2;
     size_t n_items;
@@ -547,22 +532,19 @@
 
     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)
-    {
+    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);
         n_items = fread(src_buffer, 1, frame_size, fp);
-        if (n_items != frame_size)
-        {
+        if (n_items != frame_size) {
             printf("read file failed on VA_FOURCC_P010\n");
         }
         y_src = src_buffer;
@@ -570,7 +552,7 @@
 
         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];
@@ -592,12 +574,11 @@
         src_buffer = (unsigned char*)malloc(frame_size);
         assert(src_buffer);
         n_items = fread(src_buffer, 1, frame_size, fp);
-        if (n_items != frame_size)
-        {
+        if (n_items != frame_size) {
             printf("read file failed on VA_RT_FORMAT_RGB32_10BPP or 
VA_FOURCC_RGBA \n");
         }
         y_src = src_buffer;
-        y_dst = (unsigned char*)out_buf + va_image.offsets[0];         
+        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);
@@ -615,8 +596,7 @@
 
     vaUnmapBuffer(va_dpy, va_image.buf);
     vaDestroyImage(va_dpy, va_image.image_id);
-    if (src_buffer)
-    {
+    if (src_buffer) {
         free(src_buffer);
         src_buffer = NULL;
     }
@@ -634,10 +614,10 @@
 
     int i = 0;
 
-    int frame_size = 0, y_size = 0, u_size = 0;
+    int frame_size = 0, y_size = 0;
 
-    unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
-    unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
+    unsigned char *y_src = NULL, *u_src = NULL;
+    unsigned char *y_dst = NULL, *u_dst = NULL;
 
     int bytes_per_pixel = 2;
 
@@ -656,13 +636,12 @@
 
     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]);    
+
+    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)
-    {
+    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;
@@ -670,11 +649,10 @@
         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                                                        
+        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, static_cast<size_t>(va_image.width * 
bytes_per_pixel));
             y_dst += va_image.width * bytes_per_pixel;
@@ -687,7 +665,7 @@
         }
         printf("read_frame_to_surface: P010 \n");
         break;
-        
+
     case VA_FOURCC_RGBA:
     case VA_FOURCC_ABGR:
     case VA_FOURCC_A2B10G10R10:
@@ -696,14 +674,14 @@
         dst_buffer = (unsigned char*)malloc(frame_size);
         assert(dst_buffer);
         y_dst = dst_buffer;
-        y_src = (unsigned char*)in_buf + va_image.offsets[0];         
+        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");       
+        }
+        printf("read_frame_to_surface: RGBA and A2R10G10B10 \n");
         break;
 
     default: // should not come here
@@ -744,7 +722,7 @@
     /* 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_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);
 
@@ -792,7 +770,7 @@
     VAStatus va_status;
     uint32_t i;
 
-    if (argc != 2 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){
+    if (argc != 2 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
         print_help();
         return -1;
     }
@@ -801,13 +779,13 @@
     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);
+    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()){
+    if (parse_basic_parameters()) {
         printf("Parse parameters in configure file error\n");
         assert(0);
     }
@@ -819,13 +797,13 @@
     }
 
     /* Video frame fetch, process and store */
-    if (NULL == (g_src_file_fd = fopen(g_src_file_name, "r"))){
+    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);
+               g_src_file_name, g_config_file_name);
         assert(0);
     }
 
-    if (NULL == (g_dst_file_fd = fopen(g_dst_file_name, "w"))){
+    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);
@@ -837,9 +815,9 @@
     unsigned int duration = 0;
     clock_gettime(CLOCK_MONOTONIC, &Pre_time);
 
-    for (i = 0; i < g_frame_count; i ++){
+    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);        
+        video_frame_process(g_in_surface_id, g_out_surface_id);
         write_surface_to_frame(g_dst_file_fd, g_out_surface_id);
     }
 
@@ -850,22 +828,22 @@
     } 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);
+    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;
+        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;
+        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;
+        fclose(g_config_file_fd);
+        g_config_file_fd = NULL;
     }
 
     vpp_context_destroy();

Reply via email to