Browse Source

wave511: fix building issue for gcc 12.2.0

Signed-off-by: Andy Hu <andy.hu@starfivetech.com>
Andy Hu 1 year ago
parent
commit
ee0b08aa44

+ 18 - 26
wave511/code/sample_v2/component_encoder/component_enc_encoder.c

@@ -1013,7 +1013,7 @@ static BOOL PrepareEncoder(ComponentImpl* com, BOOL* done)
 
     /* Open Data File*/
     if (ctx->encOpenParam.EncStdParam.waveParam.scalingListEnable) {
-        if (testEncConfig->scaling_list_fileName) {
+        if (testEncConfig) {
             ChangePathStyle(testEncConfig->scaling_list_fileName);
             if ((testEncConfig->scaling_list_file = osal_fopen(testEncConfig->scaling_list_fileName, "r")) == NULL) {
                 VLOG(ERR, "fail to open scaling list file, %s\n", testEncConfig->scaling_list_fileName);
@@ -1023,7 +1023,7 @@ static BOOL PrepareEncoder(ComponentImpl* com, BOOL* done)
     }
 
     if (ctx->encOpenParam.EncStdParam.waveParam.customLambdaEnable) {
-        if (testEncConfig->custom_lambda_fileName) {
+        if (testEncConfig) {
             ChangePathStyle(testEncConfig->custom_lambda_fileName);
             if ((testEncConfig->custom_lambda_file = osal_fopen(testEncConfig->custom_lambda_fileName, "r")) == NULL) {
                 VLOG(ERR, "fail to open custom lambda file, %s\n", testEncConfig->custom_lambda_fileName);
@@ -1033,42 +1033,34 @@ static BOOL PrepareEncoder(ComponentImpl* com, BOOL* done)
     }
 
     if (testEncConfig->roi_enable) {
-        if (testEncConfig->roi_file_name) {
-            ChangePathStyle(testEncConfig->roi_file_name);
-            if ((testEncConfig->roi_file = osal_fopen(testEncConfig->roi_file_name, "r")) == NULL) {
-                VLOG(ERR, "fail to open ROI file, %s\n", testEncConfig->roi_file_name);
-                return FALSE;
-            }
+        ChangePathStyle(testEncConfig->roi_file_name);
+        if ((testEncConfig->roi_file = osal_fopen(testEncConfig->roi_file_name, "r")) == NULL) {
+            VLOG(ERR, "fail to open ROI file, %s\n", testEncConfig->roi_file_name);
+            return FALSE;
         }
     }
 
     if (testEncConfig->lambda_map_enable) {
-        if (testEncConfig->lambda_map_fileName) {
-            ChangePathStyle(testEncConfig->lambda_map_fileName);
-            if ((testEncConfig->lambda_map_file = osal_fopen(testEncConfig->lambda_map_fileName, "r")) == NULL) {
-                VLOG(ERR, "fail to open lambda map file, %s\n", testEncConfig->lambda_map_fileName);
-                return FALSE;
-            }
+        ChangePathStyle(testEncConfig->lambda_map_fileName);
+        if ((testEncConfig->lambda_map_file = osal_fopen(testEncConfig->lambda_map_fileName, "r")) == NULL) {
+            VLOG(ERR, "fail to open lambda map file, %s\n", testEncConfig->lambda_map_fileName);
+            return FALSE;
         }
     }
 
     if (testEncConfig->mode_map_flag) {
-        if (testEncConfig->mode_map_fileName) {
-            ChangePathStyle(testEncConfig->mode_map_fileName);
-            if ((testEncConfig->mode_map_file = osal_fopen(testEncConfig->mode_map_fileName, "r")) == NULL) {
-                VLOG(ERR, "fail to open custom mode map file, %s\n", testEncConfig->mode_map_fileName);
-                return FALSE;
-            }
+        ChangePathStyle(testEncConfig->mode_map_fileName);
+        if ((testEncConfig->mode_map_file = osal_fopen(testEncConfig->mode_map_fileName, "r")) == NULL) {
+            VLOG(ERR, "fail to open custom mode map file, %s\n", testEncConfig->mode_map_fileName);
+            return FALSE;
         }
     }
 
     if (testEncConfig->wp_param_flag & 0x1) {
-        if (testEncConfig->wp_param_fileName) {
-            ChangePathStyle(testEncConfig->wp_param_fileName);
-            if ((testEncConfig->wp_param_file = osal_fopen(testEncConfig->wp_param_fileName, "r")) == NULL) {
-                VLOG(ERR, "fail to open Weight Param file, %s\n", testEncConfig->wp_param_fileName);
-                return FALSE;
-            }
+        ChangePathStyle(testEncConfig->wp_param_fileName);
+        if ((testEncConfig->wp_param_file = osal_fopen(testEncConfig->wp_param_fileName, "r")) == NULL) {
+            VLOG(ERR, "fail to open Weight Param file, %s\n", testEncConfig->wp_param_fileName);
+            return FALSE;
         }
     }
 

+ 1 - 1
wave511/code/sample_v2/helper/main_helper.c

@@ -2158,7 +2158,7 @@ void GenRegionToQpMap(
 int openRoiMapFile(TestEncConfig *encConfig)
 {
     if (encConfig->roi_enable) {
-        if (encConfig->roi_file_name) {
+        if (encConfig) {
             ChangePathStyle(encConfig->roi_file_name);
             if ((encConfig->roi_file = osal_fopen(encConfig->roi_file_name, "r")) == NULL) {
                 VLOG(ERR, "fail to open ROI file, %s\n", encConfig->roi_file_name);

+ 2 - 1
wave511/code/sample_v2/helper/main_helper.h

@@ -79,6 +79,7 @@ struct OptionExt
 };
 
 #define MAX_FILE_PATH               256
+#define MAX_SRC_FILE_PATH           128
 #define MAX_PIC_SKIP_NUM            5
 
 
@@ -313,7 +314,7 @@ typedef struct {
 } W5ChangeParam;
 
 typedef struct {
-    char SrcFileName[MAX_FILE_PATH];
+    char SrcFileName[MAX_SRC_FILE_PATH];
     char BitStreamFileName[MAX_FILE_PATH];
     BOOL srcCbCrInterleave;
     int NumFrame;

+ 1 - 1
wave511/code/sample_v2/helper/vpuhelper.c

@@ -1394,7 +1394,7 @@ Int32 GetEncOpenParam(EncOpenParam *pEncOP, TestEncConfig *pEncConfig, ENC_CFG *
     ENC_CFG encCfgInst;
     ENC_CFG *pCfg;
     Int32   productId;
-    char yuvDir[256] = "yuv/";
+    char yuvDir[128] = "yuv/";
 
     productId   = VPU_GetProductId(pEncOP->coreIdx);