shithub: openh264

Download patch

ref: f7ba0e4d1cb6caaf439ec9f43238b87063d3aaa5
parent: 32d5c22a9ab0937426836bc332e46ca39f835361
author: Martin Storsjö <[email protected]>
date: Thu Jun 26 10:05:08 EDT 2014

Make some tables const where easily possible

--- a/codec/decoder/core/src/mc.cpp
+++ b/codec/decoder/core/src/mc.cpp
@@ -892,7 +892,7 @@
 
 void McLuma_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
                   int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) {
-  static PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y]
+  static const PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y]
     {McCopy_neon,  McHorVer01_neon, McHorVer02_neon,    McHorVer03_neon},
     {McHorVer10_neon, McHorVer11_neon, McHorVer12_neon, McHorVer13_neon},
     {McHorVer20_neon,    McHorVer21_neon, McHorVer22_neon,    McHorVer23_neon},
@@ -1143,7 +1143,7 @@
 
 void McLuma_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
                           int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) {
-  static PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y]
+  static const PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y]
     {McCopy_AArch64_neon,  McHorVer01_AArch64_neon, McHorVer02_AArch64_neon,    McHorVer03_AArch64_neon},
     {McHorVer10_AArch64_neon, McHorVer11_AArch64_neon, McHorVer12_AArch64_neon, McHorVer13_AArch64_neon},
     {McHorVer20_AArch64_neon,    McHorVer21_AArch64_neon, McHorVer22_AArch64_neon,    McHorVer23_AArch64_neon},
--- a/codec/encoder/core/src/md.cpp
+++ b/codec/encoder/core/src/md.cpp
@@ -590,8 +590,8 @@
   int32_t iBestQuarPix = ME_NO_BEST_QUAR_PIXEL;
 
   SQuarRefineParams sParams;
-  static int32_t iMvQuarAddX[10] = {0, 0, -1, 1, 0, 0, 0, -1, 1, 0};
-  int32_t* pMvQuarAddY = iMvQuarAddX + 3;
+  static const int32_t iMvQuarAddX[10] = {0, 0, -1, 1, 0, 0, 0, -1, 1, 0};
+  const int32_t* pMvQuarAddY = iMvQuarAddX + 3;
   uint8_t* pBestPredInter = pRef;
   int32_t iInterBlk4Stride = ME_REFINE_BUF_STRIDE;
 
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -697,11 +697,11 @@
 
 // 1st index: 0: for P pSlice; 1: for I pSlice;
 // 2nd index: 0: for non-dynamic pSlice; 1: for dynamic I pSlice;
-PWelsCodingSliceFunc	g_pWelsSliceCoding[2][2] = {
+static const PWelsCodingSliceFunc	g_pWelsSliceCoding[2][2] = {
   { WelsCodePSlice, WelsCodePOverDynamicSlice },	// P SSlice
   { WelsISliceMdEnc, WelsISliceMdEncDynamic }	// I SSlice
 };
-PWelsSliceHeaderWriteFunc		g_pWelsWriteSliceHeader[2] = {	// 0: for base; 1: for ext;
+static const PWelsSliceHeaderWriteFunc		g_pWelsWriteSliceHeader[2] = {	// 0: for base; 1: for ext;
   WelsSliceHeaderWrite,
   WelsSliceHeaderExtWrite
 };