Git Product home page Git Product logo

xin26x's Introduction

xin26x

  • Xin26x is an univeral video encoder framework, which can accommodate all video coding standard on this planet so far.
  • It is optimized for real time video communication, live streaming application and offline video encoding.
  • It currently supports HEVC, AV1(I frame), VVC video coding standards.
  • It is a very high performance encoder.
  • It is well-structured for understandability, maintainability and scalability.
  • It is written from scratch and has a plain C API to enable a simple integration into other software.
  • It is very small footprint encoder, it takes very small memory requirement under restricted mode.

Encoder Usage

xin26x_test.exe -i input.yuv -w 1280 -h 720 -f 30 -a 2 -p 1 -r 1 -b 2000000 -o test.bin
xin26x_test.exe -i input.yuv -w 1280 -h 720 -f 30 -a 2 -p 1 -r 0 -q 32 -o test.bin

Building Project

  • Our Windows build use CMake and Visual Studio. The workable version is CMake3.5 or above and Visual Studio 2013.
  • Run make-solutions.bat under build folder, building projects will be generated under this folder.
  • In addition, we put a pre-built win64 exe under folder testbin, you can run it on win64 without build.

Basic Parameters

-i/--input
which specifies input YUV file name. Currently we accept YUV 420 video format.

-a/--algmode
which specifies algorithm mode. 0: H265 1: AV1 2: H266

-w/--width
which specifies input YUV luma width.

-h/--height
which specifies input YUV luma height.

-f/--framerate
which specifies the frame rate of the input video.

-t/--temporallayer
which specifies temporal layer number. It works under all P frame sequence.

-p/--preset
which specifies the encoding preset, trading off compression efficiency against encoding speed. [0, 6] Big number means high quality but low encoder speed.

-o/--output
which specifies output bitstream file name. For HEVC and VVC, the output file accord with Annex B specification. For AV1, the output file accord with OBU format.

-R/--recon
which specifies reconstruction YUV file name. It is not a must input parameter.

-r/--ratecontrol
which specifies rate control mode. 0: rate control is off (fixed qp), 1: rate control is on.

-b/--bitrate
which specifies target bitrate. It works under rate control is on.

-q/--qp
which specifies quantization paramter. It works under rate control is off.

-n/--framenumber
which specifies how many frames to be encoded.

-B/--bframes
which specifies how many B frames in a gop. Currently, we support 1, 3 and 7.

-W/--wpp
which specifies whether wavefront parallel processing is enabled. 0: disable 1: enable.

-F/--fpp
which specifies whether frame parallel processing is enabled. 0: disable 1: enable.

-T/--thread
which specifies thread number in thread pool. It is decided by local system if this number is 0.

--refframes
which specifies how many frames is used for reference.

--signbithide
which specifies whether sign bit hidden coding tool is used in encoder. 0: off 1: on.

-d/--rdoq
which specifies whether rate distortion optimization quantization is enabled. 0: disable 1: enable.

Api Usage

Please refer to xin_app_enc.c.

Performance Comparison

Offline Comparison(Xin26x vs X265)

INPUT YUV BD-PSNR (dB) x265 veryslow xin265 p1 xin265 p4 xin265 p6 xin266 p1 xin266 p4 xin266 p6
pedestrian_area 0 -0.37 0.34 0.50 -0.1 0.67 0.84
B_Kimono1_1920x1080_24 0 -0.50 0.25 0.37 -0.16 0.67 0.85
B_ParkScene_1920x1080_24 0 -0.47 0.39 0.56 -0.13 0.84 1.06
B_BasketballDrive_1920x1080_50 0 -0.61 0.10 0.22 -0.30 0.50 0.67
B_BQTerrace_1920x1080_60 0 -0.17 0.57 0.70 0.32 0.73 0.91
B_Cactus_1920x1080_50 0 -0.38 0.49 0.65 0.08 0.78 0.97
Overall 0 -0.42 0.36 0.50 -0.05 0.70 0.88

INPUT YUV BD-RATE (%) x265 veryslow xin265 p1 xin265 p4 xin265 p6 xin266 p1 xin266 p4 xin266 p6
pedestrian_area 0 18.9 -16 -22.75 4.59 -30.66 -37.28
B_Kimono1_1920x1080_24 0 22.3 -10.08 -14.59 6.73 -26.11 -32.00
B_ParkScene_1920x1080_24 0 17.45 -12.76 -17.96 4.21 -25.96 -31.58
B_BasketballDrive_1920x1080_50 0 33.35 -4.83 -10.61 15.27 -23.00 -30.19
B_BQTerrace_1920x1080_60 0 20.4 -48.67 -56.68 -29.89 -58.49 -66.87
B_Cactus_1920x1080_50 0 24.56 -25.44 -33.63 -4.48 -40.14 -48.30
Overall 0 22.83 -19.63 -26.04 -0.6 -34.06 -41.04

Offline encoder parameters for xin26x and x265 are as follows:

x265 veryslow
x265.exe -o test.bin --input-res 1920x1080 --fps 30 --frames frames --bitrate kbitrate --tune psnr -p veryslow input.yuv

xin265 p1
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 1 -a 0

xin265 p4
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 4 -a 0

xin265 p6
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 6 -a 0

xin266 p1
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 1 -a 2

xin266 p4
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 4 -a 2

xin266 p6
xin26x_test.exe -o test.bin -i input.yuv -w 1920 -h 1080 -f 30 -n frames -r 6 -b bitrate -p 6 -a 2

In above table, we set x265(veryslow) as a reference, others are compared with x265(veryslow). x265 is 2020/12/25 version.

Lowdelay Comparison(Xin265)

Single thread for IPPPPPPPPP under suitbale bitrate

B_BasketballDrive_1920x1080_50.yuv FPS PSNR Encoder parameters
xin26x 20.68 36.929 xin26x_test.exe -i B_BasketballDrive_1920x1080_50.yuv -a 0 -o test.265 -w 1920 -h 1080 -b 3000000 -f 30 -I 0 --wpp 0 --thread 1 --preset 3 --bframes 0 -n 500
x265 7.96 36.913 x265.exe --preset fast -I -1 --input-res 1920x1080 --input B_BasketballDrive_1920x1080_50.yuv test.265 --bitrate 3000 --fps 30 --pools 1 --bframes 0 --frame-threads 0 --no-wpp --tune psnr -f 500
pedestrian_area.yuv FPS PSNR Encoder parameters
xin26x 39.203 39.719 xin26x_test.exe -i pedestrian_area.yuv -a 0 -o test.265 -w 1920 -h 1080 -b 2000000 -f 30 -I 0 --wpp 0 --thread 1 --preset 0 --bframes 0
x265 8.35 39.707 x265.exe --preset fast -I -1 --input-res 1920x1080 --input pedestrian_area.yuv test.265 --bitrate 2000 --fps 30 --pools 1 --bframes 0 --frame-threads 0 --no-wpp --tune psnr
E_KristenAndSara_1280x720_60.yuv FPS PSNR Encoder parameters
xin26x 103.68 43.218 xin26x_test.exe -i E_KristenAndSara_1280x720_60.yuv -a 0 -o test.265 -w 1280 -h 720 -b 1000000 -f 30 -I 0 --wpp 0 --thread 1 --preset 0 --bframes 0
x265 23.56 43.183 x265.exe --preset fast -I -1 --input-res 1280x720 --input E_KristenAndSara_1280x720_60.yuv test.265 --bitrate 1000 --fps 30 --pools 1 --bframes 0 --frame-threads 0 --no-wpp --tune psnr
sc_desktop_1920x1080_60_8bit_420.yuv FPS PSNR Encoder parameters
xin26x 39.48 40.082 xin26x_test.exe -i sc_desktop_1920x1080_60_8bit_420.yuv -a 0 -o test.265 -w 1920 -h 1080 -b 2000000 -f 30 -I 0 --wpp 0 --thread 1 --preset 0 --bframes 0 -s 1
x265 16.83 29.817 x265.exe --preset fast -I -1 --input-res 1920x1080 --input sc_desktop_1920x1080_60_8bit_420.yuv test.265 --bitrate 2000 --fps 30 --pools 1 --bframes 0 --frame-threads 0 --no-wpp --tune psnr

For a encoder, we normally take a tradeoff between picture quality and encoder sppeed. For a RTC encoder, performance on unit core or whole system capacity is more important. The performance of xin26x(HEVC) is x4 compared to x265 under single unit core. One important thing is that, the screen content coding performance of xin26x(HEVC) outperform x265 greatly both for speed and quality.

I would like to note that, to make fair comparison to x265, the lookahead and cu-tree are both enabled. In addition, ABR is adopted in both xin26x and x265. When it comes to real RTC world, none of these coding tools can be applied, so there will be a inevitable loss of PSNR for RTC encoder. But the speed for a real RTC encoder should be faster than the data in the table.

Processor Support

  • Intel x86 with AVX2 support.

Known Issues

  • Max resolution we support is 3860x2160.
  • Max temporal layer we support is 3.
  • For AV1, the outputted frame are all IDR. Please ignore encoder speed, currently AV1 encoder is pure C code, without SIMD or multi-thread optimization.
  • Under evaluation mode, only ABR is supported.
  • For VVC, please use vtm 10 to decode the bitstream. You can download vtm 10 from https://vcgit.hhi.fraunhofer.de/jvet/VVCSoftware_VTM/-/releases/VTM-10.0

Todo Lists

Xin26x

  • 2 pass coding tool support.
  • 16 and 32 picture gop size support.
  • Preprocessing algorithm refactor.
  • Rate contronl algorithm refine.
  • Encoder structre refactor for offline coding consideration.
  • 10 bit encoder support.
  • Fast algorithm optimization.

HEVC

  • Minor structure adjustment.
  • Local algorithm refinement.

AV1

  • P and B frame support.
  • General video coding tools support.
  • SIMD optimization.

VVC

  • Screen content coding tools support.
  • SIMD optimization.
  • More VVC coding tools support.
  • Memory usage reduction.
  • Affine motion estimation.

About Xin26x

The main purpose of Xin26x is unification. Xin26x is designed to unify different video standards and different implementations for same video standard.

In past 30 years, there are a lot of video standards released by different groups. Fortunately, these standards are all block-based motion compensation and transform hybrid scheme. Actually, it never changed since h.261 had been released. Based on that, Xin26x is designed to unify mainstream video standards into ONE encoder. Xin26x is a flexible video encoder framework to accommodate all the video standard so far on this planet. Currently, Xin26x have implemented h.265 and h.266. For AV1, Xin26x supports static picture encoding. Later, Xin26x is planning to accommodate EVC.

For same video standard, there are different implememations target to different application scenario. In my opinion, there are mainly 3 categories of encoder according to application latency.

Latency Scenario
200ms or blow (real time) real time video communication
1s-3s (low latency) live video boardcast
10s or above (offline) offline video application

Different encoding tools are adopted for different encoder implementions. For example, B frame is normally not adopted for RTC(Real-Time Communication) encoder. Frame parallelism is not used for RTC encoder. Rate control for RTC encoder is very strict. Besides, lookahead and mb-tree are normally not applied on first 2 encoders. Screen content coding tools are normally considered for a RTC encoder. In current industry, Openh264 is for real time video communication application. X264 is mainly for offline and low latency. Xin26x begins at a RTC video encoder. To accommodate offline video coding tools and video standard evolution, the encoder architecture has been greatly refactored. Also to make encoder work under different application scenarios, multiple different rate control modes are designed in Xin26x.

I wish video coding standardization would take a revolution, break though current hybrid scheme, stop piling up computation for better compression rate in the future, then Xin26x reaches its end-of-life. Otherwise, Xin26x will keep catching up with the latest video coding standard, till I reach my end-of-life.

Basicly, Xin26x is purely a result of coding happiness pursuit. It is named after my 8 year old beautiful child. I would like her know how great her father is. After she grows up, I wish she would know how father loved her.

Any question, please contact [email protected]

xin26x's People

Contributors

georgepig avatar pigpeppa 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xin26x's Issues

Decoding fail

command:

xin26x_test.exe -i BasketballDrive_1920x1080_50.yuv -w 1920 -h 1080 -f 50 -a 2 -p 1 -b 2000000 -o test.bin

xinConfig:
InputFileName = BasketballDrive_1920x1080_50.yuv
OutputFileName = test.bin
ReconFileName =
inputWidth = 1920
inputHeight = 1080
STATUS: Xin26x lib build date: Aug 18 2020 21:17:24.

Start coding...
Complete coding.
501 frames encoded, coding speed fps:53.9057 bitrate: 2029.17 kbps.

./DecoderApp -b test.bin -o test.yuv

VVCSoftware: VTM Decoder Version 10.0 [Linux][GCC 7.5.0][64 bit] [SIMD=AVX2]

ERROR: In function "decompressSlice" in /home/ldu/VVCSoftware_VTM-VTM-10.0/source/Lib/DecoderLib/DecSlice.cpp:266: Expecting a terminating bit

Total Time: 0.011 sec.

happy 2024

In 2023, Xin26x have made 10% bdrate decrease under h266 mode. For xin26x, I guess there are another 5-10% bdrate to make for h266 compared to h265. After that, probably, Xin26x will switch to catch up with ECM. Wish everyone all the best in 2024.

[SUGGESTION] best-in-class features for all codecs

Hi there, 1st of all thanks for your (volunteer) work !

Since the project's goal is unification it would be extremely interesting - if it hasn't already been considered - to "grab" the @kierank's x262 approach: make the best-in-class features available for all codecs, without (anyway) breaking their standards.

Hope that inspires !

run in linux still failed

linux lib type should be .a or .so! would you mind to provide one for testing in linux environment?
using the latest code and the error log as following

[ 25%] Building C object app/encoder/CMakeFiles/xin26x_test.dir/source/xin_app_enc.c.o
[ 50%] Building C object app/encoder/CMakeFiles/xin26x_test.dir//common/source/xin_config_file.c.o
[ 75%] Building C object app/encoder/CMakeFiles/xin26x_test.dir//common/source/xin_encoder_option.c.o
[100%] Linking C executable xin26x_test
/usr/bin/ld: cannot find -lxin26x
collect2: error: ld returned 1 exit status
make[2]: *** [app/encoder/CMakeFiles/xin26x_test.dir/build.make:114: app/encoder/xin26x_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:112: app/encoder/CMakeFiles/xin26x_test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

How to run in linux?

Where is the libxin26x.so? If not, can you provide one for testing?

/usr/bin/ld: CMakeFiles/xin26x_test.dir/__/common/source/xin_config_file.c.o:(.bss+0x0): multiple definition of pfXin26xLogEntry'; CMakeFiles/xin26x_test.dir/source/xin_app_enc.c.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/xin26x_test.dir/__/common/source/xin_encoder_option.c.o:(.bss+0x0): multiple definition of pfXin26xLogEntry'; CMakeFiles/xin26x_test.dir/source/xin_app_enc.c.o:(.bss+0x0): first defined here
/usr/bin/ld: cannot find -lxin26x
collect2: error: ld returned 1 exit status
make[2]: *** [app/encoder/CMakeFiles/xin26x_test.dir/build.make:133: app/encoder/xin26x_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:131: app/encoder/CMakeFiles/xin26x_test.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Readme mistake

all video coding standard on this planet

Earth is not a planet. The word comes from greek planētēs which means 'wandering (star)'.
Earth Is an immobile, level Plane. All scientific experiments ever done show this. Motionless and level.
Research this; we have been lied to. If the atmosphere of Earth was surrounded by a vacuum, there would be no atmosphere!
Look at zoomed-in and focused videos of the stars and planets (which are just wandering stars and not solid bodies).

[Windows] Build - and not only - issues

Hi there,
since the provided exe won't run on my W11x64 system, I've asked John Edwards (aka John33, the dev behind RareWares) to build an optimized - ICL 19 - bin and here's his reply about:

Bit of a puzzle, really! The 'make-solutions.bat' file generates a VisualStudio sln file that loads into VS and compiles but the resulting executable does nothing. I'm not convinced that all the necessary code is included. I tried to link to the dll that is provided, but that doesn't appear to work either. I can't generate a usable output file even using the exe that is provided but that could be me not generating a suitable input file correctly!

...can you help to fix the problem?

Thanks in advance.

Segfault on HEAD when encoding H266 with fixed QP

Steps to reproduce:

  1. Encode a video using ./xin26x_test.exe" -i "video.yuv" -a 2 -o "video.266" -w 1920 -h 1080 -f 24000/1001 -p 2:
    The encoding starts normally.
  2. Encode a video using ./xin26x_test.exe" -i "video.yuv" -a 2 -o "video.266" -w 1920 -h 1080 -f 24000/1001 -r 0 -q 20 -p 2:
    Segmentation fault.

Last usable commit is around 497e509 .
Thanks.

[REQ] add a (GH-compliant) license file

Hi there, happy 2024 !

Since we've "doxed" it in our HyMPS project (under the VIDEO \ Tools \ Encoders subsection), can you add a license file please ?

As you probably already know, expliciting licensing terms is extremely important to let other devs - and not only - understand how to reuse/adapt/modify your code in other open projects and vice-versa.

Although it may sounds like a minor aspect, license file omission obviously causes an inconsistent generation of the relative badge too:


(badge-generator URL: https://flat.badgen.net/github/license/pigpeppa/xin26x/?label=LICENSE)

Anyway you can easily set a "compliant" one through the GH's license wizard tool.

Last but not least, let us know how - in your opinion - we could improve categorization/sorting of collected projects in order to push their evolution by favouring collaborations between developers (and not only).

Thanks in advance.

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.