Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

[do not submit] [IM360-166] no safestring and glog for android v1.8.0 #78

Draft
wants to merge 1 commit into
base: V1.8.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/360SCVP/360SCVPAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define _360SCVP_API_H_
#include "stdint.h"
#include <stdbool.h>
#include "pose.h"
#include "../utils/pose.h"

#ifdef __cplusplus
extern "C" {
Expand Down
10 changes: 0 additions & 10 deletions src/360SCVP/360SCVPViewportImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,12 +1326,7 @@ int32_t TgenViewport::ERPSelectRegion(short inputWidth, short inputHeight, shor
float fPitch = m_codingSVideoInfo.viewPort.fPitch;
float vFOV = m_codingSVideoInfo.viewPort.vFOV;
float hFOV = m_codingSVideoInfo.viewPort.hFOV;
#ifndef _ANDROID_NDK_OPTION_
float leftCol[m_tileNumRow] = {float(m_tileNumCol)};
float rightCol[m_tileNumRow] = {-1};
#else
float leftCol[m_tileNumRow], rightCol[m_tileNumRow];
#endif
bool bHasOccupiedTile;
float horzStep = ERP_HORZ_ANGLE / (float)m_tileNumCol;
float vertStep = ERP_VERT_ANGLE / (float)m_tileNumRow;
Expand Down Expand Up @@ -1368,10 +1363,6 @@ int32_t TgenViewport::ERPSelectRegion(short inputWidth, short inputHeight, shor
centerCol = (clampAngle(fYaw, -ERP_HORZ_ANGLE / 2, ERP_HORZ_ANGLE / 2) + ERP_HORZ_ANGLE / 2) / horzStep;
int32_t row, tileIdx;
float col;
#ifndef _ANDROID_NDK_OPTION_
float distanceLeftToCenter[m_tileNumRow] = {-1.0};
float distanceRightToCenter[m_tileNumRow] = {-1.0};
#else
float distanceLeftToCenter[m_tileNumRow], distanceRightToCenter[m_tileNumRow];

for (uint32_t i = 0; i < m_tileNumRow; i++) {
Expand All @@ -1385,7 +1376,6 @@ int32_t TgenViewport::ERPSelectRegion(short inputWidth, short inputHeight, shor
distanceLeftToCenter[i] = -1;
distanceRightToCenter[i] = -1;
}
#endif
/* Search in top vertical boundary */
for (float offsetAngle = hFOV/2; offsetAngle >= 0; offsetAngle -= HORZ_BOUNDING_STEP) {
pVertBoundaryPoint->alpha = clampAngle(pVertBoundaryPoint->alpha, -ERP_HORZ_ANGLE/2, ERP_HORZ_ANGLE/2) + ERP_HORZ_ANGLE / 2;
Expand Down
7 changes: 7 additions & 0 deletions src/360SCVP/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ config("my_config") {
"-Werror",
"-std=c++11",
]

include_dirs = [
".",
"../plugins/360SCVP_Plugins/TileSelection_Plugins",
]
}

static_library("lib360SCVP") {
Expand All @@ -32,8 +37,10 @@ static_library("lib360SCVP") {
"360SCVPHevcTileMerge.cpp",
"360SCVPHevcTilestream.cpp",
"360SCVPImpl.cpp",
"360SCVPLog.cpp",
"360SCVPViewPort.cpp",
"360SCVPViewportImpl.cpp",
"../utils/Log.cpp",
]
}

Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class TileSelection
//!
//! \brief construct
//!
TileSelection() {};
TileSelection() {}
//!
//! \brief de-construct
//!
virtual ~TileSelection() {};
virtual ~TileSelection() {}
//! \brief Initialze the pan zoom tile selection module
//!
//! \return int32_t Error code
Expand Down
9 changes: 9 additions & 0 deletions src/utils/GlogWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#ifndef GLOGWRAPPER_H
#define GLOGWRAPPER_H

#if 0

#include "glog/logging.h"
#include <unistd.h>
#include <sys/types.h>
Expand Down Expand Up @@ -83,5 +85,12 @@ class GlogWrapper {
private:
};

#else

#include <iostream>
#define LOG(x) std::cout

#endif

#endif /* GLOGWRAPPER_H */

15 changes: 6 additions & 9 deletions src/utils/safe_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,16 @@
#ifndef _SAFE_MEM_H_
#define _SAFE_MEM_H_

#include <algorithm>
using namespace std;

//memcpy
#ifndef _SAFE_MEM_
#define memcpy_s(dest, dest_sz, src, src_sz) \
memcpy((void *)(dest), (const void *)(src), (size_t)min((size_t)dest_sz, (size_t)src_sz))
memcpy((void *)(dest), (const void *)(src), (size_t)dest_sz)
#else
extern "C" {
#include "safestringlib/safe_mem_lib.h"
}
#define memcpy_s(dest, dest_sz, src, src_sz) \
memcpy_s((void *)(dest), dest_sz, (const void *)(src), (size_t)min((size_t)dest_sz, (size_t)src_sz))
memcpy_s((void *)(dest), dest_sz, (const void *)(src), (size_t)dest_sz)
#endif

//memset
Expand All @@ -64,26 +61,26 @@ extern "C" {
//memmove
#ifndef _SAFE_MEM_
#define memmove_s(dest, dest_sz, src, src_sz) \
memmove((void *)(dest), (const void *)(src), (size_t)min((size_t)dest_sz, (size_t)src_sz))
memmove((void *)(dest), (const void *)(src), (size_t)dest_sz)
#else
extern "C" {
#include "safestringlib/safe_mem_lib.h"
}
#define memmove_s(dest, dest_sz, src, src_sz) \
memmove_s((void *)(dest), dest_sz, (const void *)(src), (size_t)min((size_t)dest_sz, (size_t)src_sz))
memmove_s((void *)(dest), dest_sz, (const void *)(src), (size_t)dest_sz)
#endif


//memcmp
#ifndef _SAFE_MEM_
#define memcmp_s(dest, dmax, src, slen, diff) \
(*diff = {memcmp((const void *)(dest), (const void *)(src), (size_t)min((size_t)dmax, (size_t)slen))})
(*diff = {memcmp((const void *)(dest), (const void *)(src), (size_t)dmax)})
#else
extern "C" {
#include "safestringlib/safe_mem_lib.h"
}
#define memcmp_s(dest, dmax, src, slen, diff) \
memcmp_s((void *)(dest), dmax, (const void *)(src), (size_t)min((size_t)dmax, (size_t)slen), (int *)diff)
memcmp_s((void *)(dest), dmax, (const void *)(src), (size_t)dmax, (int *)diff)
#endif

#endif /* _SAFE_MEM_H_ */