Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Laky-64 committed Feb 17, 2025
2 parents a62dcc1 + a85e118 commit 0ae9479
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 78 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LIBDIR_NAME=lib
SHAREDLIB_DIR=$(PREFIX)/lib
PROJECT_NAME=openh264
MODULE_NAME=gmpopenh264
GMP_API_BRANCH=Firefox114_2
GMP_API_BRANCH=Firefox135
GTEST_VER=release-1.8.1
CCASFLAGS=$(CFLAGS)
STATIC_LDFLAGS=-lstdc++
Expand All @@ -38,8 +38,8 @@ USE_STACK_PROTECTOR = Yes
USE_LOW_VERSION_NDK=No
USE_ANT=No

SHAREDLIB_MAJORVERSION=7
FULL_VERSION := 2.5.0
SHAREDLIB_MAJORVERSION=8
FULL_VERSION := 2.6.0

ifeq (,$(wildcard $(SRC_PATH)gmp-api))
HAVE_GMP_API=No
Expand Down
27 changes: 27 additions & 0 deletions RELEASES
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@

Releases
-----------
v2.6.0
------
- Initialize PSNR to 0 instead of NAN (Commit: cf3b514b, PR: #3836)
- Enable PIC in x86 assembly code (Commit: c42fa040, PR: #3831)
- Add QEMU test for LoongArch architecture (Commit: e49c0953, PR: #3833)
- Add support for calculating PSNR for Y/U/V components (Commit: 33f7f486, PR: #3824)
- Add support for PowerPC architecture in meson.build (Commit: 423eb2c3, PR: #3806)
- Fix potential bug in the codebase (Commit: 63db555e, PR: #3818)
- Pass the actual temporal ID to GMPVideoEncodedFrame (Commit: 1c47e719, PR: #3828)
- Use HW_NCPUONLINE on OpenBSD / NetBSD for CPU detection (Commit: fc1605c1, PR: #3813)
- Add Windows VSBuildTools VC17 compile support (Commit: 1ebb3f1a, PR: #3823)
- Expose temporal layer info via GMP API at encoder initialization and on a per-frame basis (Commit: ad3f6904, PR: #3821)
- Remove the use of -Werror to prevent warnings from being treated as errors (Commit: edbef4df, PR: #3809)
- Use void casts to silence warnings about memcpy to a class (Commit: 6746bc48, PR: #3800)

v2.5.0
------
- Fix some multi-thread decoding issues
- Remove unused pSpatialLayer variable in DetermineTemporalSettings
- Change picOrderCnt to 2
- Fix cross compile from darwin arm64 to x86_64
- Fix deadlock at the end of decoding
- Fix frame-decode errors
- Fix build with meson on riscv64
- Enable pac bti support
- Fix a bug in decoding H.264 streams encoded by Apple HWA encoder

v2.4.1
------
- Fix off by one regression in decoder
Expand Down
30 changes: 24 additions & 6 deletions build/AutoBuildForWindows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ rem --arm64 folder bin\ARM64
rem
rem [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.17763.0)
rem [vc_version] : Specify a VC++ version
rem VC17 for VC++ 2022
rem VC16 for VC++ 2019
rem VC15 for VC++ 2017
rem
Expand Down Expand Up @@ -97,6 +98,15 @@ goto :EOF
set MinGWPath=C:\MinGW\bin
set MsysPath=C:\MinGW\msys\1.0\bin

set VC17BuildToolsPath=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC
set VC17CommunityPath=C:\Program Files\Microsoft Visual Studio\2022\Community\VC
set VC17ProfessionalPath=C:\Program Files\Microsoft Visual Studio\2022\Professional\VC
set VC17EnterprisePath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC
if exist "%VC17BuildToolsPath%" set VC17PATH=%VC17BuildToolsPath%
if exist "%VC17CommunityPath%" set VC17PATH=%VC17CommunityPath%
if exist "%VC17ProfessionalPath%" set VC17PATH=%VC17ProfessionalPath%
if exist "%VC17EnterprisePath%" set VC17PATH=%VC17EnterprisePath%

set VC16BuildToolsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
set VC16CommunityPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC
set VC16ProfessionalPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC
Expand Down Expand Up @@ -130,14 +140,21 @@ goto :EOF
set VCVARSPATH=%VCPATH%
if exist "%VC15Path%" set VCVARSPATH=%VC15Path%\Auxiliary\Build
if exist "%VC16Path%" set VCVARSPATH=%VC16Path%\Auxiliary\Build
if exist "%VC17Path%" set VCVARSPATH=%VC17Path%\Auxiliary\Build

if /I "%OPENH264_VC_VERSION%" == "VC15" (
if /I "%OPENH264_VC_VERSION%" == "VC17" (
set VCPATH=
set "VCVARSPATH=%VC15Path%\Auxiliary\Build"
) else if /I "%OPENH264_VC_VERSION%" == "VC12" (
set "VCPATH=%VC12Path%"
set "VCVARSPATH=%VCPATH%"
)
set "VCVARSPATH=%VC17Path%\Auxiliary\Build"
) else if /I "%OPENH264_VC_VERSION%" == "VC16" (
set VCPATH=
set "VCVARSPATH=%VC16Path%\Auxiliary\Build"
) else if /I "%OPENH264_VC_VERSION%" == "VC15" (
set VCPATH=
set "VCVARSPATH=%VC15Path%\Auxiliary\Build"
) else if /I "%OPENH264_VC_VERSION%" == "VC12" (
set "VCPATH=%VC12Path%"
set "VCVARSPATH=%VCPATH%"
)

set GasScriptPath=%VCPATH%\bin

Expand Down Expand Up @@ -392,6 +409,7 @@ rem ***********************************************
echo Win32-Release-ASM
echo [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.17763.0)
echo [vc_version] : Specify a VC++ version
echo VC17 for VC++ 2022
echo VC16 for VC++ 2019
echo VC15 for VC++ 2017

Expand Down
4 changes: 2 additions & 2 deletions build/platform-darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ SHAREDLIB_DIR = $(PREFIX)/lib
SHAREDLIBSUFFIX = dylib
SHAREDLIBSUFFIXFULLVER=$(FULL_VERSION).$(SHAREDLIBSUFFIX)
SHAREDLIBSUFFIXMAJORVER=$(SHAREDLIB_MAJORVERSION).$(SHAREDLIBSUFFIX)
CURRENT_VERSION := 2.5.0
COMPATIBILITY_VERSION := 2.5.0
CURRENT_VERSION := 2.6.0
COMPATIBILITY_VERSION := 2.6.0
SHLDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \
-fno-common -headerpad_max_install_names -install_name \
$(SHAREDLIB_DIR)/$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER)
Expand Down
9 changes: 0 additions & 9 deletions build/platform-gnu-chain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,3 @@ endif
ifneq ($(filter %clang++,$(CXX)),)
CXXFLAGS += -Wc++11-compat-reserved-user-defined-literal
endif

ifneq ($(filter %g++,$(CXX)),)
ifeq ($(filter %clang++,$(CXX)),)
GCCVER_GTEQ8 = $(shell echo $$(($$($(CXX) -dumpversion | awk -F "." '{print $$1}') >= 8)))
ifeq ($(GCCVER_GTEQ8), 1)
CXXFLAGS += -Wno-class-memaccess
endif
endif
endif
8 changes: 8 additions & 0 deletions codec/api/wels/codec_app_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ typedef struct TagEncParamExt {
bool bIsLosslessLink; ///< LTR advanced setting
bool bFixRCOverShoot; ///< fix rate control overshooting
int iIdrBitrateRatio; ///< the target bits of IDR is (idr_bitrate_ratio/100) * average target bit per frame.
bool bPsnrY; ///< get Y PSNR stats for the whole video sequence
bool bPsnrU; ///< get U PSNR stats for the whole video sequence
bool bPsnrV; ///< get V PSNR stats for the whole video sequence
} SEncParamExt;

/**
Expand Down Expand Up @@ -635,6 +638,7 @@ typedef struct {
int iNalCount; ///< count number of NAL coded already
int* pNalLengthInByte; ///< length of NAL size in byte from 0 to iNalCount-1
unsigned char* pBsBuf; ///< buffer of bitstream contained
float rPsnr[3]; ///< PSNR values for Y/U/V
} SLayerBSInfo, *PLayerBSInfo;

/**
Expand All @@ -659,7 +663,11 @@ typedef struct Source_Picture_s {
int iPicWidth; ///< luma picture width in x coordinate
int iPicHeight; ///< luma picture height in y coordinate
long long uiTimeStamp; ///< timestamp of the source picture, unit: millisecond
bool bPsnrY; ///< get Y PSNR for this frame
bool bPsnrU; ///< get U PSNR for this frame
bool bPsnrV; ///< get V PSNR for this frame
} SSourcePicture;

/**
* @brief Structure for bit rate info
*/
Expand Down
8 changes: 4 additions & 4 deletions codec/api/wels/codec_ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include "codec_app_def.h"

static const OpenH264Version g_stCodecVersion = {2, 5, 0, 2411};
static const char* const g_strCodecVer = "OpenH264 version:2.5.0.2411";
static const OpenH264Version g_stCodecVersion = {2, 6, 0, 2502};
static const char* const g_strCodecVer = "OpenH264 version:2.6.0.2502";

#define OPENH264_MAJOR (2)
#define OPENH264_MINOR (5)
#define OPENH264_MINOR (6)
#define OPENH264_REVISION (0)
#define OPENH264_RESERVED (2411)
#define OPENH264_RESERVED (2502)

#endif // CODEC_VER_H
4 changes: 2 additions & 2 deletions codec/common/loongarch/mc_horver_lsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void McHorVer22WidthEq4_lsx(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pD
uint8_t *psrc = (uint8_t*)pSrc - 2;
__m128i src0, src1, src2, src3, src4, src5;
__m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, out0_l, out0_h;
__m128i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
__m128i dst0, dst1, dst2, dst3, dst4={0}, dst5={0}, dst6={0}, dst7={0};
v8i16 mask1 = {3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < iHeight; i++) {
DUP4_ARG2(__lsx_vldx,
Expand Down Expand Up @@ -565,7 +565,7 @@ void McHorVer22WidthEq5_lsx(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pD
uint8_t *psrc = (uint8_t*)pSrc - 2;
__m128i src0, src1, src2, src3, src4, src5;
__m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, out0_l, out0_h;
__m128i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
__m128i dst0, dst1, dst2, dst3, dst4={0}, dst5={0}, dst6={0}, dst7={0};
v8i16 mask1 = {3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < iHeight; i++) {
DUP4_ARG2(__lsx_vldx,
Expand Down
4 changes: 4 additions & 0 deletions codec/common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ elif cpu_family in ['loongarch32', 'loongarch64']
cpp_sources += asm_sources
elif cpu_family == 'riscv64'
asm_sources = []
elif cpu_family == 'ppc'
asm_sources = []
elif cpu_family == 'ppc64'
asm_sources = []
else
error('Unsupported cpu_family @0@'.format(cpu_family))
endif
Expand Down
4 changes: 3 additions & 1 deletion codec/common/src/WelsThreadLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#endif
#ifdef __APPLE__
#define HW_NCPU_NAME "hw.logicalcpu"
#elif defined(HW_NCPUONLINE)
#define HW_NCPU_NAME "hw.ncpuonline"
#else
#define HW_NCPU_NAME "hw.ncpu"
#endif
Expand Down Expand Up @@ -522,7 +524,7 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
size_t len = sizeof (pInfo->ProcessorCount);

#if defined(__OpenBSD__)
int scname[] = { CTL_HW, HW_NCPU };
int scname[] = { CTL_HW, HW_NCPUONLINE };
if (sysctl (scname, 2, &pInfo->ProcessorCount, &len, NULL, 0) == -1)
#else
if (sysctlbyname (HW_NCPU_NAME, &pInfo->ProcessorCount, &len, NULL, 0) == -1)
Expand Down
4 changes: 4 additions & 0 deletions codec/decoder/core/src/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,10 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
return pCtx->iErrorCode;
}

if (pCtx->iErrorCode != ERR_NONE && !(pCtx->iErrorCode & dsDataErrorConcealed)) {
return pCtx->iErrorCode;
}

pDstNal += (iDstIdx + 4); //init, increase 4 reserved zero bytes, used to store the next NAL
if ((iSrcLength - iSrcConsumed + 4) > (pRawData->pEnd - pDstNal)) {
pDstNal = pRawData->pCurPos = pRawData->pHead;
Expand Down
4 changes: 4 additions & 0 deletions codec/decoder/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ elif cpu_family in ['loongarch32', 'loongarch64']
cpp_sources += asm_sources
elif cpu_family == 'riscv64'
asm_sources = []
elif cpu_family == 'ppc'
asm_sources = []
elif cpu_family == 'ppc64'
asm_sources = []
else
error('Unsupported cpu family @0@'.format(cpu_family))
endif
Expand Down
5 changes: 0 additions & 5 deletions codec/encoder/core/inc/as264_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
#endif//ENABLE_FRAME_DUMP
#endif//__UNITTEST__

//#define ENABLE_PSNR_CALC
//#define STAT_OUTPUT
//#define MB_TYPES_CHECK
//
Expand All @@ -88,10 +87,6 @@
//@if !FRAME_INFO_OUTPUT
#if !defined(FRAME_INFO_OUTPUT)

#if defined(ENABLE_PSNR_CALC)
#undef ENABLE_PSNR_CALC
#endif//ENABLE_PSNR_CALC

//#if defined(STAT_OUTPUT)
//#undef STAT_OUTPUT
//#endif//STAT_OUTPUT
Expand Down
6 changes: 6 additions & 0 deletions codec/encoder/core/inc/param_svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
param.bIsLosslessLink = false;
param.bFixRCOverShoot = true;
param.iIdrBitrateRatio = IDR_BITRATE_RATIO * 100;
param.bPsnrY = false;
param.bPsnrU = false;
param.bPsnrV = false;
for (int32_t iLayer = 0; iLayer < MAX_SPATIAL_LAYER_NUM; iLayer++) {
param.sSpatialLayers[iLayer].uiProfileIdc = PRO_UNKNOWN;
param.sSpatialLayers[iLayer].uiLevelIdc = LEVEL_UNKNOWN;
Expand Down Expand Up @@ -345,6 +348,9 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
bIsLosslessLink = pCodingParam.bIsLosslessLink;
bFixRCOverShoot = pCodingParam.bFixRCOverShoot;
iIdrBitrateRatio = pCodingParam.iIdrBitrateRatio;
bPsnrY = pCodingParam.bPsnrY;
bPsnrU = pCodingParam.bPsnrU;
bPsnrV = pCodingParam.bPsnrV;
if (iUsageType == SCREEN_CONTENT_REAL_TIME && !bIsLosslessLink && bEnableLongTermReference) {
bEnableLongTermReference = false;
}
Expand Down
Loading

0 comments on commit 0ae9479

Please sign in to comment.