shithub: openh264

Download patch

ref: 2a23a508e16943fdc0bcfa908eb37e09709b1ac4
parent: fff39090530ef03520008d26189fd70b83aa4a3d
author: Martin Storsjö <[email protected]>
date: Sun Mar 9 08:23:37 EDT 2014

Mark pointers as const where possible in vaacalc

--- a/codec/processing/src/asm/vaa.asm
+++ b/codec/processing/src/asm/vaa.asm
@@ -359,7 +359,7 @@
 
 WELS_EXTERN VAACalcSad_sse2
 ;*************************************************************************************************************
-;void VAACalcSad_sse2( uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
+;void VAACalcSad_sse2( const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
 ;                                                               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8)
 ;*************************************************************************************************************
 
@@ -551,7 +551,7 @@
 
 WELS_EXTERN VAACalcSad_sse2
 ;*************************************************************************************************************
-;void VAACalcSad_sse2( uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
+;void VAACalcSad_sse2( const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
 ;                                                               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8)
 ;*************************************************************************************************************
 
@@ -649,7 +649,7 @@
 %ifdef X86_32
 WELS_EXTERN VAACalcSadVar_sse2
 ;*************************************************************************************************************
-;void VAACalcSadVar_sse2( uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
+;void VAACalcSadVar_sse2( const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
 ;               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16)
 ;*************************************************************************************************************
 
@@ -785,7 +785,7 @@
 
 WELS_EXTERN VAACalcSadVar_sse2
 ;*************************************************************************************************************
-;void VAACalcSadVar_sse2( uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
+;void VAACalcSadVar_sse2( const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight
 ;               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16)
 ;*************************************************************************************************************
 
@@ -928,7 +928,7 @@
 
 WELS_EXTERN VAACalcSadSsd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadSsd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadSsd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;       int32_t iPicStride,int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16, int32_t *psqdiff16x16)
 ;*************************************************************************************************************
 
@@ -1084,7 +1084,7 @@
 
 WELS_EXTERN VAACalcSadSsd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadSsd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadSsd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;       int32_t iPicStride,int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16, int32_t *psqdiff16x16)
 ;*************************************************************************************************************
 
@@ -1248,7 +1248,7 @@
 %ifdef X86_32
 WELS_EXTERN VAACalcSadBgd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadBgd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadBgd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;                               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *p_sd8x8, uint8_t *p_mad8x8)
 ;*************************************************************************************************************
 
@@ -1427,7 +1427,7 @@
 
 WELS_EXTERN VAACalcSadSsdBgd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadSsdBgd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadSsdBgd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;                int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16,
 ;                       int32_t *psqdiff16x16, int32_t *p_sd8x8, uint8_t *p_mad8x8)
 ;*************************************************************************************************************
@@ -1658,7 +1658,7 @@
 
 WELS_EXTERN VAACalcSadBgd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadBgd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadBgd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;                               int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *p_sd8x8, uint8_t *p_mad8x8)
 ;*************************************************************************************************************
 
@@ -1829,7 +1829,7 @@
 
 WELS_EXTERN VAACalcSadSsdBgd_sse2
 ;*************************************************************************************************************
-;void VAACalcSadSsdBgd_sse2(uint8_t *cur_data, uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
+;void VAACalcSadSsdBgd_sse2(const uint8_t *cur_data, const uint8_t *ref_data, int32_t iPicWidth, int32_t iPicHeight,
 ;                int32_t iPicStride, int32_t *psadframe, int32_t *psad8x8, int32_t *psum16x16, int32_t *psqsum16x16,
 ;                       int32_t *psqdiff16x16, int32_t *p_sd8x8, uint8_t *p_mad8x8)
 ;*************************************************************************************************************
--- a/codec/processing/src/vaacalc/vaacalcfuncs.cpp
+++ b/codec/processing/src/vaacalc/vaacalcfuncs.cpp
@@ -34,10 +34,10 @@
 
 WELSVP_NAMESPACE_BEGIN
 
-void VAACalcSadSsd_c (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
+void VAACalcSadSsd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
                       int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* psqsum16x16, int32_t* psqdiff16x16) {
-  uint8_t* tmp_ref = pRefData;
-  uint8_t* tmp_cur = pCurData;
+  const uint8_t* tmp_ref = pRefData;
+  const uint8_t* tmp_cur = pCurData;
   int32_t iMbWidth = (iPicWidth >> 4);
   int32_t mb_heigth = (iPicHeight >> 4);
   int32_t mb_index = 0;
@@ -49,8 +49,8 @@
     for (int32_t j = 0; j < iMbWidth; j ++) {
       int32_t k, l;
       int32_t l_sad, l_sqdiff, l_sum, l_sqsum;
-      uint8_t* tmp_cur_row;
-      uint8_t* tmp_ref_row;
+      const uint8_t* tmp_cur_row;
+      const uint8_t* tmp_ref_row;
 
       pSum16x16[mb_index] = 0;
       psqsum16x16[mb_index] = 0;
@@ -145,10 +145,10 @@
     tmp_cur += step;
   }
 }
-void VAACalcSadVar_c (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
+void VAACalcSadVar_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
                       int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* psqsum16x16) {
-  uint8_t* tmp_ref = pRefData;
-  uint8_t* tmp_cur = pCurData;
+  const uint8_t* tmp_ref = pRefData;
+  const uint8_t* tmp_cur = pCurData;
   int32_t iMbWidth = (iPicWidth >> 4);
   int32_t mb_heigth = (iPicHeight >> 4);
   int32_t mb_index = 0;
@@ -160,8 +160,8 @@
     for (int32_t j = 0; j < iMbWidth; j ++) {
       int32_t k, l;
       int32_t l_sad, l_sum, l_sqsum;
-      uint8_t* tmp_cur_row;
-      uint8_t* tmp_ref_row;
+      const uint8_t* tmp_cur_row;
+      const uint8_t* tmp_ref_row;
 
       pSum16x16[mb_index] = 0;
       psqsum16x16[mb_index] = 0;
@@ -249,10 +249,10 @@
 }
 
 
-void VAACalcSad_c (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
+void VAACalcSad_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
                    int32_t* pFrameSad, int32_t* pSad8x8) {
-  uint8_t* tmp_ref = pRefData;
-  uint8_t* tmp_cur = pCurData;
+  const uint8_t* tmp_ref = pRefData;
+  const uint8_t* tmp_cur = pCurData;
   int32_t iMbWidth = (iPicWidth >> 4);
   int32_t mb_heigth = (iPicHeight >> 4);
   int32_t mb_index = 0;
@@ -264,8 +264,8 @@
     for (int32_t j = 0; j < iMbWidth; j ++) {
       int32_t k, l;
       int32_t l_sad;
-      uint8_t* tmp_cur_row;
-      uint8_t* tmp_ref_row;
+      const uint8_t* tmp_cur_row;
+      const uint8_t* tmp_ref_row;
 
       l_sad =  0;
       tmp_cur_row = tmp_cur;
@@ -332,14 +332,14 @@
   }
 }
 
-void VAACalcSadSsdBgd_c (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+void VAACalcSadSsdBgd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                          int32_t iPicStride,
                          int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* psqsum16x16, int32_t* psqdiff16x16, int32_t* pSd8x8,
                          uint8_t* pMad8x8)
 
 {
-  uint8_t* tmp_ref = pRefData;
-  uint8_t* tmp_cur = pCurData;
+  const uint8_t* tmp_ref = pRefData;
+  const uint8_t* tmp_cur = pCurData;
   int32_t iMbWidth = (iPicWidth >> 4);
   int32_t mb_heigth = (iPicHeight >> 4);
   int32_t mb_index = 0;
@@ -351,8 +351,8 @@
     for (int32_t j = 0; j < iMbWidth; j ++) {
       int32_t k, l;
       int32_t l_sad, l_sqdiff, l_sum, l_sqsum, l_sd, l_mad;
-      uint8_t* tmp_cur_row;
-      uint8_t* tmp_ref_row;
+      const uint8_t* tmp_cur_row;
+      const uint8_t* tmp_ref_row;
 
       pSum16x16[mb_index] = 0;
       psqsum16x16[mb_index] = 0;
@@ -480,10 +480,10 @@
   }
 }
 
-void VAACalcSadBgd_c (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
+void VAACalcSadBgd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
                       int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSd8x8, uint8_t* pMad8x8) {
-  uint8_t* tmp_ref = pRefData;
-  uint8_t* tmp_cur = pCurData;
+  const uint8_t* tmp_ref = pRefData;
+  const uint8_t* tmp_cur = pCurData;
   int32_t iMbWidth = (iPicWidth >> 4);
   int32_t mb_heigth = (iPicHeight >> 4);
   int32_t mb_index = 0;
@@ -495,8 +495,8 @@
     for (int32_t j = 0; j < iMbWidth; j ++) {
       int32_t k, l;
       int32_t l_sad, l_sd, l_mad;
-      uint8_t* tmp_cur_row;
-      uint8_t* tmp_ref_row;
+      const uint8_t* tmp_cur_row;
+      const uint8_t* tmp_ref_row;
 
       l_mad = l_sd = l_sad =  0;
       tmp_cur_row = tmp_cur;
--- a/codec/processing/src/vaacalc/vaacalculation.h
+++ b/codec/processing/src/vaacalc/vaacalculation.h
@@ -49,24 +49,24 @@
 
 WELSVP_NAMESPACE_BEGIN
 
-typedef void (VAACalcSadBgdFunc) (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+typedef void (VAACalcSadBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                                   int32_t iPicStride,
                                   int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSd8x8, uint8_t* pMad8x8);
 
-typedef void (VAACalcSadSsdBgdFunc) (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+typedef void (VAACalcSadSsdBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                                      int32_t iPicStride,
                                      int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16,
                                      int32_t* pSsd16x16, int32_t* pSd8x8, uint8_t* pMad8x8);
 
-typedef void (VAACalcSadFunc) (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+typedef void (VAACalcSadFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                                int32_t iPicStride,
                                int32_t* pFrameSad, int32_t* pSad8x8);
 
-typedef void (VAACalcSadVarFunc) (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+typedef void (VAACalcSadVarFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                                   int32_t iPicStride,
                                   int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16);
 
-typedef void (VAACalcSadSsdFunc) (uint8_t* pCurData, uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
+typedef void (VAACalcSadSsdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
                                   int32_t iPicStride,
                                   int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16, int32_t* pSsd16x16);