Coder Social home page Coder Social logo

cisco / openh264 Goto Github PK

View Code? Open in Web Editor NEW
5.4K 512.0 1.7K 124.85 MB

Open Source H.264 Codec

License: BSD 2-Clause "Simplified" License

Shell 1.41% JavaScript 0.01% Makefile 0.87% Python 0.21% C++ 59.98% Java 0.16% Objective-C 0.59% C# 0.37% Assembly 19.73% C 16.11% Batchfile 0.25% Meson 0.28% Dockerfile 0.02%

openh264's Introduction

OpenH264

OpenH264 is a codec library which supports H.264 encoding and decoding. It is suitable for use in real time applications such as WebRTC. See http://www.openh264.org/ for more details.

Encoder Features

  • Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
  • Arbitrary resolution, not constrained to multiples of 16x16
  • Rate control with adaptive quantization, or constant quantization
  • Slice options: 1 slice per frame, N slices per frame, N macroblocks per slice, or N bytes per slice
  • Multiple threads automatically used for multiple slices
  • Temporal scalability up to 4 layers in a dyadic hierarchy
  • Simulcast AVC up to 4 resolutions from a single input
  • Spatial simulcast up to 4 resolutions from a single input
  • Long Term Reference (LTR) frames
  • Memory Management Control Operation (MMCO)
  • Reference picture list modification
  • Single reference frame for inter prediction
  • Multiple reference frames when using LTR and/or 3-4 temporal layers
  • Periodic and on-demand Instantaneous Decoder Refresh (IDR) frame insertion
  • Dynamic changes to bit rate, frame rate, and resolution
  • Annex B byte stream output
  • YUV 4:2:0 planar input

Decoder Features

  • Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
  • Arbitrary resolution, not constrained to multiples of 16x16
  • Single thread for all slices
  • Long Term Reference (LTR) frames
  • Memory Management Control Operation (MMCO)
  • Reference picture list modification
  • Multiple reference frames when specified in Sequence Parameter Set (SPS)
  • Annex B byte stream input
  • YUV 4:2:0 planar output

OS Support

  • Windows 64-bit and 32-bit
  • Mac OS X 64-bit and 32-bit
  • Mac OS X ARM64
  • Linux 64-bit and 32-bit
  • Android 64-bit and 32-bit
  • iOS 64-bit and 32-bit
  • Windows Phone 32-bit

Architectures verified to be working

  • ppc64el

Processor Support

  • Intel x86 optionally with MMX/SSE (no AVX yet, help is welcome)
  • ARMv7 optionally with NEON, AArch64 optionally with NEON
  • Any architecture using C/C++ fallback functions

Building the Library

NASM needed to be installed for assembly code: workable version 2.10.06 or above, NASM can be downloaded from http://www.nasm.us/. For Mac OSX 64-bit NASM needed to be below version 2.11.08 as NASM 2.11.08 will introduce error when using RIP-relative addresses in Mac OSX 64-bit

To build the arm assembly for Windows Phone, gas-preprocessor is required. It can be downloaded from git://git.libav.org/gas-preprocessor.git

For Android Builds

To build for android platform, You need to install android sdk and ndk. You also need to export **ANDROID_SDK**/tools to PATH. On Linux, this can be done by

export PATH=**ANDROID_SDK**/tools:$PATH

The codec and demo can be built by

make OS=android NDKROOT=**ANDROID_NDK** TARGET=**ANDROID_TARGET**

Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as android-12. You can also set ARCH, NDKLEVEL according to your device and NDK version. ARCH specifies the architecture of android device. Currently arm, arm64, x86 and x86_64 are supported, the default is arm. (mips and mips64 can also be used, but there's no specific optimization for those architectures.) NDKLEVEL specifies android api level, the default is 12. Available possibilities can be found in **ANDROID_NDK**/platforms, such as android-21 (strip away the android- prefix).

By default these commands build for the armeabi-v7a ABI. To build for the other android ABIs, add ARCH=arm64, ARCH=x86, ARCH=x86_64, ARCH=mips or ARCH=mips64. To build for the older armeabi ABI (which has armv5te as baseline), add APP_ABI=armeabi (ARCH=arm is implicit). To build for 64-bit ABI, such as arm64, explicitly set NDKLEVEL to 21 or higher.

For iOS Builds

You can build the libraries and demo applications using xcode project files located in codec/build/iOS/dec and codec/build/iOS/enc.

You can also build the libraries (but not the demo applications) using the make based build system from the command line. Build with

make OS=ios ARCH=**ARCH**

Valid values for **ARCH** are the normal iOS architecture names such as armv7, armv7s, arm64, and i386 and x86_64 for the simulator. Another settable iOS specific parameter is SDK_MIN, specifying the minimum deployment target for the built library. For other details on building using make on the command line, see 'For All Platforms' below.

For Linux Builds

You can build the libraries (but not the demo applications) using the make based build system from the command line. Build with

make OS=linux ARCH=**ARCH**

You can set ARCH according to your linux device . ARCH specifies the architecture of the device. Currently arm, arm64, x86 and x86_64 are supported

NOTICE: If your computer is x86 architecture, for build the libnary which be used on arm/aarch64 machine, you may need to use cross-compiler, for example: make OS=linux CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ ARCH=arm64 or make OS=linux CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ ARCH=arm

For Windows Builds

"make" must be installed. It is recommended to install the Cygwin and "make" must be selected to be included in the installation. After the installation, please add the Cygwin bin path to your PATH.

openh264/build/AutoBuildForWindows.bat is provided to help compile the libraries on Windows platform.
Usage of the .bat script:

`AutoBuildForWindows.bat Win32-Release-ASM` for x86 Release build  
`AutoBuildForWindows.bat Win64-Release-ASM` for x86_64 Release build  
`AutoBuildForWindows.bat ARM64-Release-ASM` for arm64 release build  

for more usage, please refer to the .bat script help.

For All Platforms

Using make

From the main project directory:

  • make for automatically detecting architecture and building accordingly
  • make ARCH=i386 for x86 32-bit builds
  • make ARCH=x86_64 for x86 64-bit builds
  • make ARCH=arm64 for arm64 Mac 64-bit builds
  • make V=No for a silent build (not showing the actual compiler commands)
  • make DEBUGSYMBOLS=True for two libraries, one is normal libraries, another one is removed the debugging symbol table entries (those created by the -g option)

The command line programs h264enc and h264dec will appear in the main project directory.

A shell script to run the command-line apps is in testbin/CmdLineExample.sh

Usage information can be found in testbin/CmdLineReadMe

Using meson

Meson build definitions have been added, and are known to work on Linux and Windows, for x86 and x86 64-bit.

See http://mesonbuild.com/Installing.html for instructions on how to install meson, then:

meson builddir
ninja -C builddir

Run the tests with:

meson test -C builddir -v

Install with:

ninja -C builddir install

Using the Source

  • codec - encoder, decoder, console (test app), build (makefile, vcproj)
  • build - scripts for Makefile build system
  • test - GTest unittest files
  • testbin - autobuild scripts, test app config files
  • res - yuv and bitstream test files

Known Issues

See the issue tracker on https://github.com/cisco/openh264/issues

  • Encoder errors when resolution exceeds 3840x2160
  • Encoder errors when compressed frame size exceeds half uncompressed size
  • Decoder errors when compressed frame size exceeds 1MB
  • Encoder RC requires frame skipping to be enabled to hit the target bitrate, if frame skipping is disabled the target bitrate may be exceeded

License

BSD, see LICENSE file for details.

openh264's People

Contributors

andreasgal avatar benzhengzhang avatar daniel-j-h avatar dongzha avatar ekr avatar ethanhugg avatar fluffy avatar ganyangbbl avatar guangweiwang avatar haibozhu avatar huili2 avatar jwwang avatar licaiguo avatar lyao2 avatar mstorsjo avatar pengyanhai avatar ruil2 avatar saamas avatar shihuade avatar sijchen avatar syureyi avatar thaytan avatar varunbpatil avatar volvet avatar xiaotiansf avatar xiaotianshi2 avatar xiweigu avatar ylatuya avatar zhilwang avatar zhuling13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openh264's Issues

make 'OS=msvc-arm' libraries failed

Hi,

I am trying to compile the openh264 lib for WP8.

  1. I use the "Visual Studio 2012 ARM Phone" cmd line tool.
  2. I run the msys.bat.
  3. I run the command: make 'OS=msvc-arm' libraries, but the compiling failed at the line 210 of gas-preprocessor.pl:
    open(INPUT, "-|", @preprocess_c_cmd) || die "Error running preprocessor";

I am not familiar with perl, would anyone please tell me what's wrong with it or how to solve the problem?
Thank you in advance!

BTW. I managed to compile it in this way without compiling the asm files.

Brs

Request a tag

Hi,

Packaging work needs some stable version or "released" version, can you provide us a tag(even alpha/beta is OK)?

Thanks.

Random issue on WelsIDctRecI16x16Dc_sse2

Sometimes the unit test of WelsIDctRecI16x16Dc_sse2 can't pass, but the most of time this unit test pass with the same code.

Anyone can help to check it? thanks a lot!

build failed for h264enc

Failed to build with the latest commit:
commit 75f8b41
Merge: e7ed80c 21e9c83
Author: volvet [email protected]
Date: Fri Feb 21 17:31:34 2014 +0800

Merge pull request #334 from mstorsjo/cleanup-vp-interface

Don't use a custom calling convention for the VP library entry points

Output log from console:
g++ -O3 -m64 -DX86_ASM -Werror -fPIC -DLINUX -DMT_ENABLED -MMD -MP -DNO_DYNAMIC_VP -Icodec/api/svc -Icodec/common -Icodec/encoder/core/inc -Icodec/encoder/plus/inc -Icodec/processing/interface -Icodec/console/enc/inc -c -o codec/console/enc/src/welsenc.o codec/console/enc/src/welsenc.cpp
g++ -o h264enc codec/console/enc/src/read_config.o codec/console/enc/src/welsenc.o -L. -lencoder -lprocessing -lcommon -m64 -lpthread
./libencoder.a(svc_set_mb_syn_cavlc.o): In function WelsSVCEnc::WelsWriteMbResidual(WelsSVCEnc::TagMbCache*, WelsSVCEnc::TagMB*, WelsSVCEnc::TagBitStringAux*)': svc_set_mb_syn_cavlc.cpp:(.text+0x39d7): undefined reference toWelsSVCEnc::WriteBlockResidualCavlc(short_, int, int, int, signed char, WelsSVCEnc::TagBitStringAux_)'
svc_set_mb_syn_cavlc.cpp:(.text+0x39fb): undefined reference to WelsSVCEnc::WriteBlockResidualCavlc(short*, int, int, int, signed char, WelsSVCEnc::TagBitStringAux*)' svc_set_mb_syn_cavlc.cpp:(.text+0x3a7f): undefined reference toWelsSVCEnc::WriteBlockResidualCavlc(short_, int, int, int, signed char, WelsSVCEnc::TagBitStringAux_)'
svc_set_mb_syn_cavlc.cpp:(.text+0x3aef): undefined reference to WelsSVCEnc::WriteBlockResidualCavlc(short*, int, int, int, signed char, WelsSVCEnc::TagBitStringAux*)' svc_set_mb_syn_cavlc.cpp:(.text+0x3b5f): undefined reference toWelsSVCEnc::WriteBlockResidualCavlc(short_, int, int, int, signed char, WelsSVCEnc::TagBitStringAux_)'
./libencoder.a(svc_set_mb_syn_cavlc.o):svc_set_mb_syn_cavlc.cpp:(.text+0x3bcf): more undefined references to `WelsSVCEnc::WriteBlockResidualCavlc(short_, int, int, int, signed char, WelsSVCEnc::TagBitStringAux_)' follow
collect2: error: ld returned 1 exit status
make: *** [h264enc] Error 1

Repo unnecessarily big to clone

When doing an initial clone of the openh264 repo, this downloads over 50 MB, due to one commit in the ekr1 branch. And even in this branch, the huge file is removed in the following commit. Could this branch be removed from the main publuc repo, or at least updated to squash in the removal of the huge file so that it doesn't exist in any commit? A third alternative would be to move the branch to some personal repo instead of keeping it here in the main public repo, bloating the download significantly.

File names

The console was returning "does not exist" errors due to some Include missing the _2010 tag in file names (I'm using VS2010 auto build but I think the same happens in 2012). My forked corrections: 00b3c524fb9e917946a69

The auto build still didn't manage to compile welsenc.exe and h264dec.exe for me, but that might be related to the previous issue: #5 (comment)

This is the console output log of my latest auto build: PasteBin.comOFCode.org
And this is the list of all compiled files (release folder):

10/12/2013  16:30            20.992 decConsole.exe
10/12/2013  16:29            34.816 encConsole.exe
10/12/2013  16:29           609.280 encConsole.pdb
10/12/2013  16:30           269.362 welsdcore.lib
10/12/2013  16:30           102.400 welsdec.dll
10/12/2013  16:30               919 welsdec.exp
10/12/2013  16:30             1.924 welsdec.lib
10/12/2013  16:30            81.123 welsdec.map
10/12/2013  16:30           420.864 welsdec.pdb
10/12/2013  16:29           239.104 welsenc.dll
10/12/2013  16:29               939 welsenc.exp
10/12/2013  16:29             1.954 welsenc.lib
10/12/2013  16:29           137.051 welsenc.map
10/12/2013  16:29           945.152 welsenc.pdb
10/12/2013  16:29           101.376 welsvp.dll
10/12/2013  16:29               999 welsvp.exp
10/12/2013  16:29             1.518 welsvp.lib
10/12/2013  16:29            91.688 welsvp.map

Please either add source, or remove this project

It is embarrassing for Cisco, and a bit insulting to those of us who work in Open Source, to call this project "Open Source", and not actually have any source code in it. Rather than getting any goodwill from announcing your intent to share the code of your H.264 implementation, you will likely find that the community will react with scorn and derision.

I recommend removing this project from Github until the source code IS available. I understand that it takes time to do this for various legal and organizational reasons, but jumping the gun, and releasing a project that doesn't have any source code, and calling it "Open Source", is insulting to our intelligence, our hard work, and it incurs a dramatic credibility cost for Cisco with the very people that I presume you're trying to befriend.

Please. Don't do this. Don't go down this tired BigDumbCorp road. Take this empty thing down, or add the source code. It's offensive and insulting, and the internet is already descending on you with jokes and jibes. If the goal is marketing, then this is absolutely the wrong way to go about it.

build fail for android

Hi,

I have tried to build the codec for android with the following command:
make OS=android NDKROOT= TARGET=android-19 NDKLEVEL=19

I have got the following errors:
/home/julia/soft/ndk/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: codec/processing/src/common/thread.o: incompatible target
/home/julia/soft/ndk/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: codec/processing/src/common/WelsFrameWorkEx.o: incompatible target
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Init(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexLock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Init(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexUnlock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Uninit(int): error: undefined reference to 'nsWelsVP::WelsMutexLock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Uninit(int): error: undefined reference to 'nsWelsVP::WelsMutexUnlock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::~CVpFrameWork(): error: undefined reference to 'nsWelsVP::WelsMutexDestroy(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Get(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexLock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Get(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexUnlock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Set(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexLock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::Set(int, void_): error: undefined reference to 'nsWelsVP::WelsMutexUnlock(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function DestroyVpInterface: error: undefined reference to 'nsWelsVP::DestroySpecificVpInterface(IWelsVPc_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function nsWelsVP::CVpFrameWork::CVpFrameWork(unsigned int, EResult&): error: undefined reference to 'nsWelsVP::WelsMutexInit(pthread_mutex_t_)'
codec/processing/src/common/WelsFrameWork.o:WelsFrameWork.cpp:function CreateVpInterface: error: undefined reference to 'nsWelsVP::CreateSpecificVpInterface(IWelsVPc_*)'

I'm using linux 64 bit.
In the reedme file, it is indicated that the supported version is android 32 bit. Does it mean that it can be built only on linux 32 bit or I have made something wrong?

Thanks in advance.

Duplicate symbols in assembly

Trying to link the assembly version of the encoder and decoder together gets you:

duplicate symbol _DeblockLumaLt4H_sse2 in:
../../../openh264//libencoder.a(deblocking.o)
../../../openh264//libdecoder.a(deblocking.o)
duplicate symbol _DeblockLumaEq4H_sse2 in:
../../../openh264//libencoder.a(deblocking.o)
../../../openh264//libdecoder.a(deblocking.o)
duplicate symbol _WelsI4x4LumaPredH_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI16x16LumaPredPlane_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI16x16LumaPredH_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI16x16LumaPredV_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsIChromaPredPlane_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredDDR_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredDc_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsIChromaPredH_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredHD_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredHU_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredVR_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredDDL_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI4x4LumaPredVL_mmx in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsIChromaPredDc_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
duplicate symbol _WelsI16x16LumaPredDc_sse2 in:
../../../openh264//libdecoder.a(intra_pred.o)
../../../openh264//libencoder.a(intra_pred.o)
ld: 17 duplicate symbols for architecture x86_64

Failed to decode on android

Hi!

I have faced with error when I try to decode the frame.
My application gets the frames from camera, after that I convert them into I420 format using libyuv library.

I pass the frame in I420 format to encoder, and it seems that it encodes successfully, I get the type of the first frame - IDR, and the following frames' type is P.

Encoder and decoder initialization:

  SEncParamBase param;
  memset (&param, 0, sizeof(SEncParamBase));

  param.fMaxFrameRate = 30.0f;
  param.iPicWidth = 320;
  param.iPicHeight = 240;
  param.iTargetBitrate = 5000;
  param.iInputCsp = videoFormatI420;
  int retVal = encoder_->Initialize(&param);

  //decoder
  SDecodingParam decParam;
  memset(&decParam, 0, sizeof(SDecodingParam));
  decParam.sVideoProperty.size = sizeof (decParam.sVideoProperty);
  decParam.iOutputColorFormat  = videoFormatI420;
  decParam.uiTargetDqLayer = (uint8_t) - 1;
  decParam.uiEcActiveFlag  = 1;
  decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_AVC;
  long rv = decoder_->Initialize(&decParam);

This is how I copy the buffer:

  int iSliceSize;
  iSliceSize = CalcBufferSize(kI420, inputImage.width(), inputImage.height());
  uint8_t*  encodedBuf;
  uint8_t* encodedBufHead;
  encodedBuf = new uint8_t [iSliceSize];
  encodedBufHead = encodedBuf;

  int freespace = iSliceSize;
  int layerSize = 0;

  for (int i = 0; i < encodedOutput.iLayerNum; ++i) 
  {
    const SLayerBSInfo& layerInfo = encodedOutput.sLayerInfo[i];
    layerSize = 0;    
    for (int j = 0; j < layerInfo.iNalCount; ++j) 
    {
        layerSize += layerInfo.iNalLengthInByte[j];
    }
    if (freespace >= layerSize)
    {
        memcpy(encodedBufHead, layerInfo.pBsBuf, layerSize);
        encodedBufHead += layerSize;
    }
  }

Then I pass encodedBuf to DecodeFrame2() method:

  SBufferInfo sDstBufInfo;
  memset (&sDstBufInfo, 0, sizeof (SBufferInfo));
  void* pData[3] = {NULL};
  pData[0] = NULL;
  pData[1] = NULL;
  pData[2] = NULL;

  decoder_->DecodeFrame2 (encodedBuf, layerSize, pData, &sDstBufInfo);

As a result I have sDstBufInfo.iBufferStatus != 1.
All the fields in sDstBufInfo are empty.

What do I do wrong? Or this is a bug?

Fixing the log generation

Currently the log CodecVPBuild.log is not being saved, by default the console window displays 400 lines max and it's a bit hard to keep track of the warnings/errors unless you change the window settings.

As temporary fix I'm using this bat to dump the VS2010 output in a log file:
AutoBuild_Windows_VS2010_Logger.bat

It would be nice to have a log for anyone who wants to help in reporting issues even if they're not experts, this script works just fine for me, but I think it's possible to merge something like this within the main batch files (to avoid unnecessary bat files), I don't know how to do it though.

AAC license not included?

From initial announcements, an AAC license is not included, making openh264 presumably unable to play back existing H.264+AAC media content on the web, and presumably unable to encode new H.264+AAC media content to be played back by other decoders.

Updating encode size corrupts output

I use InitializeExt to setup the encoder with a particular output resolution:
_encodingParam.sSpatialLayers[0].iVideoWidth = 640;
_encodingParam.sSpatialLayers[0].iVideoHeight = 480;

I then update the encoding parameters after running for a bit:
_encodingParam.sSpatialLayers[0].iVideoWidth = 320;
_encodingParam.sSpatialLayers[0].iVideoHeight = 240;
_encoder->SetOption(ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &_encodingParam);

The display now seems to be covered in lots of green - even though the primary shape is visible. I'm assuming that the Y component is being correctly scaled, but the Cr/Cb components aren't. Even if I do a ForceIntraFrame(true) it doesn't fix.

Also the SetOption(ENCODER_OPTION_SVC_ENCODE_PARAM_EXT) is broken:
welsEncodingExt.cpp - line 749.
sizeof (SEncParamBase) should be sizeof(SEncParamExt)

[PATCH] Fix regression in encoder/core/src/slice_multi_threading.cpp

Please review the attached patch. It removes an redundant ) in encoder/core/src/slice_multi_threading.cpp, which leads to a regression if the compiler flag -DENABLE_TRACE_MT is defined.

diff --git a/codec/encoder/core/src/slice_multi_threading.cpp b/codec/encoder/core/src/slice_multi_threading.cpp
index f33e258..40cb808 100644
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -488,7 +488,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
     err = WelsEventOpen (&pSmt->pReadySliceCodingEvent[iIdx], name);
 #if defined(ENABLE_TRACE_MT)
     WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d\n", iIdx,
-             (void*)pSmt->pReadySliceCodingEvent[iIdx]), (void*) (*ppCtx), err, errno);
+             (void*)pSmt->pReadySliceCodingEvent[iIdx], (void*) (*ppCtx), err, errno);
 #endif
 #endif//_WIN32

Best regards and many thanks

Martin Ettl

[PATCH] resource leaks in codec/console/enc/src/welsenc.cpp

Please review the attached patch. It fixes two resource leaks in codec/console/enc/src/welsenc.cpp:

diff --git a/codec/console/enc/src/welsenc.cpp b/codec/console/enc/src/welsenc.cpp
index fb0663c..f7b0270 100644
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -909,11 +909,13 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
   int iParsedNum = 3;
   if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, sSvcParam) != 0) {
     printf ("parse pCommand line failed\n");
+    fclose(pFpSrc);
     return 1;
   }

   if (cmResultSuccess != pPtrEnc->Initialize (&sSvcParam, INIT_TYPE_PARAMETER_BASED)) {
     fprintf (stderr, "Encoder Initialization failed!\n");
+    fclose(pFpSrc);
     return 1;
   }

Best regards

Martin Ettl

What's GOM stand for?

Dear Authors,
I wonder the meaning of "GOM" in so many place, but I could not figure it out. Could you answer me?

Old codec makefiles out-of-order and so are the autobuild scripts in testbin/

Due to recent changes in directory structure of the project, the old makefiles (codec/build/linux/enc/makefile, codec/build/linux/dec/makefile, codec/processing/build/linux/makefile) are no longer up to date and do not work. As a result, the autobuild scripts in testbin/ are also of no use.

Should these makefiles be updated ? Or is there a plan to remove these makefiles in the near future (If I remember correctly, there was a discussion on this a while back) ?

BUILDTYPE=Release not working

BUILDTYPE=Release

/Users/cdiehl/dev/repos/llvm/build/bin/clang++ -O3 -fsanitize=address -m32 -Wno-deprecated-declarations -Werror -fPIC  -DX86_ASM -DNO_DYNAMIC_VP  -Icodec/api/svc -Icodec/common -Igtest/include  -Icodec/decoder/core/inc -c -o codec/common/./cpu.o codec/common/./cpu.cpp
/Users/cdiehl/dev/repos/llvm/build/bin/clang++ -O3 -fsanitize=address -m32 -Wno-deprecated-declarations -Werror -fPIC  -DX86_ASM -DNO_DYNAMIC_VP  -Icodec/api/svc -Icodec/common -Igtest/include  -Icodec/decoder/core/inc -c -o codec/common/./deblocking_common.o codec/common/./deblocking_common.cpp
/Users/cdiehl/dev/repos/llvm/build/bin/clang++ -O3 -fsanitize=address -m32 -Wno-deprecated-declarations -Werror -fPIC  -DX86_ASM -DNO_DYNAMIC_VP  -Icodec/api/svc -Icodec/common -Igtest/include  -Icodec/decoder/core/inc -c -o codec/common/./logging.o codec/common/./logging.cpp
nasm --prefix _ -DNOPREFIX -f macho -DX86_32 -DNO_DYNAMIC_VP -Icodec/common/   -o codec/common/./asm_inc.o codec/common/./asm_inc.asm
codec/common/./asm_inc.asm:63: error: parser: instruction expected
make: *** [codec/common/./asm_inc.o] Error 1

array subscript above array bounds when compiling with g++-4.8

codec/encoder/core/src/ref_list_mgr_svc.cpp:101:61: warning: array subscript is above array bounds [-Warray-bounds]
pRefList->pLongRefList[k] = pRefList->pLongRefList[k + 1];

codec/encoder/core/inc/svc_enc_golomb.h:196:41: warning: array subscript is above array bounds [-Warray-bounds]
n += (g_uiGolombUELength[iTmpValue - 1] >> 1);

C interface support is neccessary?

I plan to update parameter structure by using interitance as below. but C doesn't support it.
Is it neccessary to support C interface?

typedef struct TagEncParamBase{
}SEncParamBase;

typedef struct TagEncParamExt: SEncParamBase
{
}SEncParamExt;

h264 encode crash

on MAC book
step 1. git clone https://github.com/cisco/openh264
step 2. make
step 3. cd testbin
gdb ../h264enc
run welsenc.cfg

then crash.
the crash stack:
gdb) bt
#0 0x00007fff88cbfb3b in std::string::assign ()
#1 0x0000000100002161 in ParseConfig ()
#2 0x00000001000043ac in ProcessEncodingSvcWithConfig ()
#3 0x0000000100004a2f in main ()

could someone take a look?

problems running USE_ASM=Yes build

Has anyone successfully run a build with the ASM enabled?
(for example one generated by make USE_ASM=Yes or make BUILDTYPE=Release)
For me they build, but resulting h264dec and h264enc crash at runtime.

$ ../h264enc welsenc_vd_1d.cfg
Illegal instruction

for both encoder and decoder in an assembled function called DeblockLumaLt4V_sse2

Wonder if there is any ETA for the binaries and license.

Wonder if there is any ETA for the binaries and license.
I have started a new commercial project that should be finished in a few weeks.
I already integrated the Openh264 in my source and i am waiting for binaries to make project a live.

Thanks!

Win32 build error

Hi everybody,

I downloaded the source code and built the openh264-master\codec\build\win32\encWelsEncoder_2012.sln However, It wasn't successful.

Here are the errors:

  • WelsEncCore_2012 project:
    error msb6006 cmd.exe exited with code 9009 microsoft.cppcommon.targets
  • encConsole_2012 project:
    error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h
  • WelsVP_2012
    error msb6006 cmd.exe exited with code 9009 microsoft.cppcommon.targets

I'm using Visual Studio 2012 express version and Windows 7.1

If you have any idea, please help me.
Thank you all.

Provide x264 binaries with patent licenses

If you going to provide binaries of your own codec with patent license then, I think, nothing prevents your from providing binaries of other open source H.264 encoder - x264 with the same patent licensing terms. It is the best H.264 encoder in existence.

cross-platform build system

Any plan to support cross-platform build system, like gyp, cmake, or others? Got little tired to see so many sln, vcproj files.

[PATCH] Remove assignment of function parameter, which has no effect outside the function

Please review the attached patch, it removes an assignment of a function parameter, which has no effect outside function.

Here is the patch:

diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp
index 65dd30a..eec4609 100644
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -480,6 +480,5 @@ long CreateDecoder (ISVCDecoder** ppDecoder) {
 void_t DestroyDecoder (ISVCDecoder* pDecoder) {
   if (NULL != pDecoder) {
     delete (CWelsDecoder*)pDecoder;
-    pDecoder = NULL;
   }
 }

Best regards and many thanks

Martin Ettl

build for android

Hi!

Do you have plans to release the codec for android?
Could you please provide approximate date of the release?

Thanks.

WelsGetLevelIdc return 9 BUG

when encoder set qcif, bitrate = 100kbps, enable RC,
WelsGetLevelIdc will return 9.

But decoder GetLevelLimits not support 9, decode failed.

Detect stride size

I want to create a texture before DecodeFrame2.

How to know decoder's pitch/stride size before DecodeFrame2 ?

thanks.

Enc test app help text printed out twice in some cases

Suppose, I run the command :

../h264enc incorrect_config.cfg -h

the help text gets printed to console twice, first time because of the -h switch and the second time because of the error in parsing config. This doesn't look nice.

Moreover, it would be nice to have just "h264enc -h" to display help text without the command failing and then printing out help text. i.e, "h264enc -h" should be a valid command which returns success.

Cannot build with MS VS 2010 Express

I just tried "AutoBuild_Windows_VS2010.bat" but it couldn't find afxres.h and winres.h, I think they're both part of MFC Library but this is not included in Windows SDK 7 and MS VS 2010 Express as far as I know, is it impossible to compile the encoder binary if I don't have MFC? I tried using windows.h instead but it didn't help, it returns "LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt".

Some sices exeed x2 size than constraint at uiSliceMode 4

some slices has over 1900byte. when set the uiSliceMode 4.
in this case, can't send some silces through rtp.

here is code.

ISVCEncoder *enc = new ISVCEncoder();
SEncParamExt *param;

memset(param, 0x00, sizeof(SEncParamExt));
CreateSVCEncoder(&enc);

param->fMaxFrameRate = 30;      // input frame rate
param->iPicWidth = 640;     // width of picture in samples
param->iPicHeight = 480;        // height of picture in samples
param->iTargetBitrate = 512000;     // target bitrate desired
param->iTemporalLayerNum = 3;   // layer number at temporal level
param->iSpatialLayerNum = 1;    // layer number at spatial level
param->bEnableDenoise   = 1;    // denoise control
param->bEnableBackgroundDetection = 1; // background detection control
param->bEnableAdaptiveQuant       = 1; // adaptive quantization control
param->bEnableFrameSkip           = 1; // frame skipping
param->bEnableLongTermReference   = 1; // long term reference control
param->iLoopFilterDisableIdc = 0;
param->iInputCsp        = videoFormatI420; // color space of input sequence
param->uiIntraPeriod        = 30;       // period of Intra frame
param->bEnableSpsPpsIdAddition = 0;
param->bPrefixNalAddingCtrl = 0;        

param->sSpatialLayers[iIndexLayer].iVideoWidth  = 640;
param->sSpatialLayers[iIndexLayer].iVideoHeight = 480;
param->sSpatialLayers[iIndexLayer].fFrameRate   = 30;       
param->sSpatialLayers[iIndexLayer].iSpatialBitrate = 512000;
param->sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = 0;
param->sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1200;

encode support

2160p yuv video coding, a single file size is 6G, fseek (pFileYUV[iDlayerIdx], 0, SEEK_END) execution failure?

Can't find defs: vVideoFormat_I420, vResult, etc.

Searched all 414 files, but cannot find defs such as:

vVideoFormat_I420
vResult
pfnCreateVpInterface
pCreateVpInterface
pfnDestroyVpInterface
vPixMap

when building the WelsVideoProcessor project.
Sorry, but I'm stumped.

Using VS2005. Decoder built fine. Have not built Encoder.

Gary

What's OU stand for?

Dear Authors, I wonder the meaning of "OU" in so many place(eg: SBackgroundOU), but I could not figure it out. Could you answer me? Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.