├── lib_fpga ├── lib_fpga.def ├── dll_fpga.def ├── project.mk ├── DevicePool.h └── BoardNone.c ├── Doxygen ├── logo.jpg ├── SmallLogo.jpg ├── MainPage.txt ├── README ├── doxygen.sh ├── footer.html ├── SvgCleanAndLink.py └── tabs.css ├── test └── config │ ├── simple.yuv │ ├── Sample_ROI_Cmd.txt │ ├── Sample_Dynamic_Cmd.txt │ └── QPs.hex ├── exe_decoder ├── Allegro.ico ├── al_resource.h ├── project.mk ├── CodecUtils.h ├── crc.h ├── IpDevice.h └── Conversion.h ├── exe_encoder ├── Allegro.ico ├── resource.h ├── sink_md5.h ├── sink_frame_writer.h ├── sink_bitstream_writer.h ├── container.cpp ├── MD5.h ├── ICommandsSender.h ├── sink.h ├── CommandsSender.h ├── FileUtils.h ├── IpDevice.h └── project.mk ├── ctrlsw_version.mk ├── lib_bitstream ├── project.mk ├── AVC_RbspEncod.h ├── HEVC_RbspEncod.h ├── lib_bitstream.h ├── SkippedPicture.h └── IRbspWriter.h ├── lib_common_dec ├── project.mk └── IpDecFourCC.c ├── lib_conv_yuv ├── project.mk ├── lib_conv_yuv.h ├── AL_NvxConvert.h └── ConvSrc.h ├── lib_common_enc ├── project.mk ├── EncSize.c ├── EncEPBuffer.h ├── EncRecBuffer.c └── EncSize.h ├── setlocalversion.sh ├── lib_app ├── project.mk ├── BufferMetaFactory.h ├── console.h ├── timing.h ├── BufferMetaFactory.c └── console_linux.cpp ├── lib_parsing ├── project.mk ├── Concealment.c ├── Concealment.h ├── AvcParser.h └── Aup.h ├── lib_rtos ├── lib_rtos.def ├── dll_rtos.def └── project.mk ├── lib_common ├── project.mk ├── AvcLevelsLimit.h ├── BufferCircMeta.h ├── Fifo.h ├── BufConst.h ├── ChannelResources.h ├── BufferCircMeta.c ├── StreamBufferPrivate.h └── BufferPictureMeta.c ├── encoder_defs.mk ├── lib_decode ├── project.mk ├── InternalError.h ├── NalUnitParserPrivate.h ├── NalDecoder.h ├── DecoderFeeder.h └── NalUnitParser.h ├── base.mk ├── README ├── LICENSE.md ├── lib_encode ├── JpegTables.c ├── JpegTables.h ├── AVC_Sections.h ├── HEVC_Sections.h ├── LoadLda.h ├── IScheduler.c ├── McuTimers.h ├── Encoder.h ├── DriverDataConversions.h ├── SourceBufferChecker.h ├── ISchedulerCommon.h ├── AVC_Sections.c ├── HEVC_Sections.c └── project.mk ├── include ├── lib_common │ ├── HardwareDriver.h │ ├── versions.h │ ├── Pitches.h │ ├── OffsetYC.h │ └── VideoMode.h ├── lib_encode │ └── SchedulerMcu.h ├── lib_common_dec │ └── DecSynchro.h ├── lib_fpga │ └── DmaAlloc.h └── traces │ └── Traces.h └── extra └── include └── allegro_ioctl_reg.h /lib_fpga/lib_fpga.def: -------------------------------------------------------------------------------- 1 | Board_Create 2 | DmaAlloc_Create 3 | -------------------------------------------------------------------------------- /Doxygen/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/vcu-ctrl-sw/HEAD/Doxygen/logo.jpg -------------------------------------------------------------------------------- /Doxygen/SmallLogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/vcu-ctrl-sw/HEAD/Doxygen/SmallLogo.jpg -------------------------------------------------------------------------------- /lib_fpga/dll_fpga.def: -------------------------------------------------------------------------------- 1 | LIBRARY AL_fpga 2 | EXPORTS 3 | Board_Create 4 | DmaAlloc_Create 5 | -------------------------------------------------------------------------------- /test/config/simple.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/vcu-ctrl-sw/HEAD/test/config/simple.yuv -------------------------------------------------------------------------------- /exe_decoder/Allegro.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/vcu-ctrl-sw/HEAD/exe_decoder/Allegro.ico -------------------------------------------------------------------------------- /exe_encoder/Allegro.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/vcu-ctrl-sw/HEAD/exe_encoder/Allegro.ico -------------------------------------------------------------------------------- /Doxygen/MainPage.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \mainpage Encoder / Decoder Control Software 4 | 5 | 6 | */ 7 | 8 | -------------------------------------------------------------------------------- /ctrlsw_version.mk: -------------------------------------------------------------------------------- 1 | MAJOR=0 2 | MINOR=9 3 | STEP=0 4 | CTRLSW_VER?=$(shell ./setlocalversion.sh) 5 | 6 | VERSION=$(MAJOR).$(MINOR).$(STEP)$(CTRLSW_VER) 7 | 8 | -------------------------------------------------------------------------------- /Doxygen/README: -------------------------------------------------------------------------------- 1 | To generate doxygen documentation 2 | ================================= 3 | 1) Install doxygen 4 | 2) Generate the html documentation : 5 | - Launch doxygen with doxygen.cfg config file 6 | doxygen doxygen.cfg 7 | - or use the doxygen wizard 8 | 3) Browse the html documentation starting from doc/html/index.html 9 | -------------------------------------------------------------------------------- /lib_bitstream/project.mk: -------------------------------------------------------------------------------- 1 | LIB_BITSTREAM_SRC:=\ 2 | lib_bitstream/BitStreamLite.c\ 3 | lib_bitstream/RbspEncod.c\ 4 | lib_bitstream/HEVC_RbspEncod.c\ 5 | lib_bitstream/HEVC_SkippedPict.c\ 6 | lib_bitstream/AVC_RbspEncod.c\ 7 | lib_bitstream/AVC_SkippedPict.c\ 8 | 9 | UNITTEST+=$(shell find lib_bitstream/unittests -name "*.cpp") 10 | -------------------------------------------------------------------------------- /lib_common_dec/project.mk: -------------------------------------------------------------------------------- 1 | LIB_COMMON_DEC_SRC:=\ 2 | lib_common_dec/DecBuffers.c\ 3 | lib_common_dec/DecHwScalingList.c\ 4 | lib_common_dec/DecInfo.c\ 5 | lib_common_dec/RbspParser.c\ 6 | lib_common_dec/IpDecFourCC.c\ 7 | 8 | UNITTEST+=$(shell find lib_common_dec/unittests -name "*.cpp") 9 | UNITTEST+=$(LIB_COMMON_DEC_SRC) 10 | 11 | -------------------------------------------------------------------------------- /lib_conv_yuv/project.mk: -------------------------------------------------------------------------------- 1 | LIB_CONV_SRC:=\ 2 | lib_conv_yuv/AL_NvxConvert.cpp\ 3 | 4 | ifneq ($(ENABLE_LG_COMP),0) 5 | LIB_CONV_SRC+=\ 6 | 7 | endif 8 | 9 | ifneq ($(ENABLE_LIBREF),0) 10 | ifneq ($(ENABLE_TILE_SRC),0) 11 | LIB_CONV_SRC+=\ 12 | $(LIB_FBCSTANDALONE_SRC)\ 13 | $(LIB_REFFBC_SRC)\ 14 | 15 | endif 16 | endif 17 | -------------------------------------------------------------------------------- /lib_common_enc/project.mk: -------------------------------------------------------------------------------- 1 | LIB_COMMON_ENC_SRC:=\ 2 | lib_common_enc/EncBuffers.c\ 3 | lib_common_enc/EncRecBuffer.c\ 4 | lib_common_enc/IpEncFourCC.c\ 5 | lib_common_enc/EncSize.c\ 6 | lib_common_enc/EncHwScalingList.c\ 7 | lib_common_enc/Settings.c\ 8 | 9 | UNITTEST+=$(shell find lib_common_enc/unittests -name "*.cpp") 10 | UNITTEST+=$(LIB_COMMON_ENC_SRC) 11 | -------------------------------------------------------------------------------- /test/config/Sample_ROI_Cmd.txt: -------------------------------------------------------------------------------- 1 | frame 0 : BkgQuality=STATIC_QUALITY, Order=QUALITY_ORDER 2 | 100:52, 8x4, HIGH_QUALITY 3 | 144:86, 5x5, LOW_QUALITY 4 | 5 | frame 13 : 6 | 12:8, 7x5, HIGH_QUALITY 7 | 14:8, 5x5, STATIC_QUALITY 8 | 9 | frame 20 : BkgQuality=NO_QUALITY, Order=INCOMING_ORDER 10 | 6:4, 8x4, LOW_QUALITY 11 | 11:9, 5x5, HIGH_QUALITY 12 | 20:15, 5x7, MEDIUM_QUALITY -------------------------------------------------------------------------------- /setlocalversion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | scriptDir=$(dirname -- "$(readlink -f -- "$0")") 5 | 6 | res="" 7 | 8 | has () 9 | { 10 | which $1 > /dev/null 11 | } 12 | 13 | if has svnversion ; then 14 | svnversion="$(svnversion -n $scriptDir)" 15 | if !(echo $svnversion | grep "Unversioned" > /dev/null 2>&1) ; then 16 | res="+$svnversion" 17 | fi 18 | fi 19 | 20 | echo -n "$res" 21 | 22 | -------------------------------------------------------------------------------- /lib_app/project.mk: -------------------------------------------------------------------------------- 1 | LIB_APP_SRC:= 2 | 3 | LIB_APP_SRC+=lib_app/utils.cpp\ 4 | lib_app/convert.cpp\ 5 | lib_app/BufPool.cpp\ 6 | lib_app/BufferMetaFactory.c\ 7 | lib_app/AllocatorTracker.cpp\ 8 | 9 | ifeq ($(findstring mingw,$(TARGET)),mingw) 10 | else 11 | LIB_APP_SRC+=lib_app/console_linux.cpp 12 | endif 13 | 14 | UNITTEST+=$(shell find lib_app/unittests -name "*.cpp") 15 | UNITTEST+=$(LIB_APP_SRC) 16 | -------------------------------------------------------------------------------- /lib_parsing/project.mk: -------------------------------------------------------------------------------- 1 | LIB_PARSING_SRC:=\ 2 | lib_parsing/common_syntax.c\ 3 | lib_parsing/AvcParser.c\ 4 | lib_parsing/HevcParser.c\ 5 | lib_parsing/SliceHdrParsing.c\ 6 | lib_parsing/DPB.c\ 7 | lib_parsing/I_PictMngr.c\ 8 | lib_parsing/Avc_PictMngr.c\ 9 | lib_parsing/Hevc_PictMngr.c\ 10 | lib_parsing/Concealment.c\ 11 | 12 | UNITTEST+=$(shell find lib_parsing/unittests -name "*.cpp") 13 | UNITTEST+=$(LIB_PARSING_SRC) 14 | -------------------------------------------------------------------------------- /lib_rtos/lib_rtos.def: -------------------------------------------------------------------------------- 1 | Rtos_Malloc 2 | Rtos_Free 3 | Rtos_Memcpy 4 | Rtos_Memmove 5 | Rtos_Memset 6 | Rtos_Memcmp 7 | Rtos_GetTime 8 | Rtos_CreateMutex 9 | Rtos_DeleteMutex 10 | Rtos_GetMutex 11 | Rtos_ReleaseMutex 12 | Rtos_CreateSemaphore 13 | Rtos_DeleteSemaphore 14 | Rtos_GetSemaphore 15 | Rtos_ReleaseSemaphore 16 | Rtos_CreateEvent 17 | Rtos_DeleteEvent 18 | Rtos_WaitEvent 19 | Rtos_SetEvent 20 | Rtos_CreateThread 21 | Rtos_JoinThread 22 | Rtos_DeleteThread 23 | -------------------------------------------------------------------------------- /Doxygen/doxygen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dir_script=$(dirname -- "$(readlink -f -- "$0")") 4 | 5 | pushd "$dir_script" > /dev/null 6 | Version=`grep AL_ENCODER_VERSION_STR "../exe_encoder/resource.h" | sed -e 's/^.*\"\(.*\)\".*$/\1/'` 7 | 8 | AL_VERSION=$Version doxygen doxygen.cfg 9 | 10 | ./SvgCleanAndLink.py Encoder.svg doc/html/Encoder.svg doc/html/globals_func.html 11 | ./SvgCleanAndLink.py Decoder.svg doc/html/Decoder.svg doc/html/globals_func.html 12 | popd > /dev/null 13 | -------------------------------------------------------------------------------- /lib_fpga/project.mk: -------------------------------------------------------------------------------- 1 | LIB_FPGA_SRC:= 2 | 3 | ifeq ($(findstring mingw,$(TARGET)),mingw) 4 | ifeq ($(findstring i686,$(TARGET)),i686) 5 | LDFLAGS += lib_windriver/wdapi1140_x86_K32.lib 6 | endif 7 | endif 8 | 9 | ifeq ($(findstring linux,$(TARGET)),linux) 10 | LIB_FPGA_SRC+=lib_fpga/DmaAllocLinux.c 11 | LIB_FPGA_SRC+=lib_fpga/DevicePool.c 12 | LDFLAGS+=-lpthread 13 | endif 14 | 15 | # provide dummy implementation 16 | ifeq ($(LIB_FPGA_SRC),) 17 | LIB_FPGA_SRC+=lib_fpga/BoardNone.c 18 | endif 19 | 20 | -------------------------------------------------------------------------------- /test/config/Sample_Dynamic_Cmd.txt: -------------------------------------------------------------------------------- 1 | 40: NumB=2 # Change B-Frames to 2 2 | 45: KF # Insert Key Frame 3 | 85: SC # Scene Change Event 4 | 120: GopLen=15 # Change GOP Length 5 | 140: LT # Define this frame as LT reference 6 | 175: KF, NumB=4 # Insert Key Frame and Change B-Frames to 4 7 | 180: UseLT # Use LT reference Picture for encoding this frame 8 | 200: BR=10000 # Change Bitrate to 10Mbps 9 | 250: SC, GopLen=20 # Scene Change Event and Change GOP Length 10 | 300: Fps=30 # Change Framerate to 30 11 | -------------------------------------------------------------------------------- /lib_rtos/dll_rtos.def: -------------------------------------------------------------------------------- 1 | LIBRARY AL_rtos 2 | EXPORTS 3 | Rtos_Malloc 4 | Rtos_Free 5 | Rtos_Memcpy 6 | Rtos_Memmove 7 | Rtos_Memset 8 | Rtos_Memcmp 9 | Rtos_GetTime 10 | Rtos_CreateMutex 11 | Rtos_DeleteMutex 12 | Rtos_GetMutex 13 | Rtos_ReleaseMutex 14 | Rtos_CreateSemaphore 15 | Rtos_DeleteSemaphore 16 | Rtos_GetSemaphore 17 | Rtos_ReleaseSemaphore 18 | Rtos_CreateEvent 19 | Rtos_DeleteEvent 20 | Rtos_WaitEvent 21 | Rtos_SetEvent 22 | Rtos_CreateThread 23 | Rtos_JoinThread 24 | Rtos_DeleteThread 25 | -------------------------------------------------------------------------------- /Doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |


5 |
6 | 7 | 8 | 12 | 19 | 20 |
9 | 10 | $projectname documentation 11 | 13 | 14 | Allegro DVT 15 | Copyright 2008-2018 16 | 17 | 18 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /lib_common/project.mk: -------------------------------------------------------------------------------- 1 | LIB_COMMON_SRC:=\ 2 | lib_common/Utils.c\ 3 | lib_common/BufCommon.c\ 4 | lib_common/AllocatorDefault.c\ 5 | lib_common/ChannelResources.c\ 6 | lib_common/MemDesc.c\ 7 | lib_common/HwScalingList.c\ 8 | lib_common/BufferAPI.c\ 9 | lib_common/BufferSrcMeta.c\ 10 | lib_common/BufferCircMeta.c\ 11 | lib_common/BufferStreamMeta.c\ 12 | lib_common/BufferPictureMeta.c\ 13 | lib_common/BufferLookAheadMeta.c\ 14 | lib_common/Fifo.c\ 15 | lib_common/AvcLevelsLimit.c\ 16 | lib_common/StreamBuffer.c\ 17 | lib_common/FourCC.c\ 18 | lib_common/HardwareDriver.c\ 19 | 20 | UNITTEST+=$(shell find lib_common/unittests -name "*.cpp") 21 | UNITTEST+=$(LIB_COMMON_SRC) 22 | 23 | -------------------------------------------------------------------------------- /exe_decoder/al_resource.h: -------------------------------------------------------------------------------- 1 | #define IDI_ICON1 101 2 | 3 | #define AL_DECODER_VERSION 1, 0, 41 4 | #define AL_DECODER_VERSION_STR "1,0,41" 5 | 6 | #define AL_DECODER_NAME_PART1 "AVC/" 7 | #define AL_DECODER_NAME_PART2 "HEVC" 8 | 9 | #define AL_DECODER_NAME AL_DECODER_NAME_PART1 AL_DECODER_NAME_PART2 10 | 11 | #define AL_DECODER_COMMENTS "Confidential material" 12 | #define AL_DECODER_COMPANY "Allegro DVT2" 13 | #define AL_DECODER_PRODUCT_NAME AL_DECODER_NAME " Decoder Reference Software" 14 | #define AL_DECODER_FILE_DESCR AL_DECODER_COMPANY " - " AL_DECODER_PRODUCT_NAME 15 | #define AL_DECODER_INTERNAL_NAME AL_DECODER_NAME " Decoder" 16 | #define AL_DECODER_COPYRIGHT "Copyright (C) 2018" 17 | #define AL_DECODER_ORIGINAL_NAME "ctrlsw_decoder" 18 | 19 | -------------------------------------------------------------------------------- /exe_decoder/project.mk: -------------------------------------------------------------------------------- 1 | EXE_DECODER_SRC:=\ 2 | exe_decoder/main.cpp\ 3 | exe_decoder/crc.cpp\ 4 | exe_decoder/IpDevice.cpp\ 5 | exe_decoder/CodecUtils.cpp\ 6 | exe_decoder/Conversion.cpp\ 7 | $(LIB_APP_SRC)\ 8 | 9 | -include exe_decoder/site.mk 10 | 11 | EXE_DECODER_OBJ:=$(EXE_DECODER_SRC:%=$(BIN)/%.o) 12 | 13 | UNITTEST+=$(shell find exe_decoder/unittests -name "*.cpp") 14 | 15 | $(BIN)/ctrlsw_decoder: $(EXE_DECODER_OBJ) $(LIB_REFDEC_A) $(LIB_DECODER_A) 16 | 17 | $(BIN)/exe_decoder/%.o: CFLAGS+=$(SVNDEV) 18 | 19 | $(BIN)/exe_decoder/%.o: INTROSPECT_FLAGS=-DAL_COMPIL_FLAGS='"$(CFLAGS)"' 20 | 21 | $(BIN)/exe_decoder/%.o: INTROSPECT_FLAGS+=-DHAS_COMPIL_FLAGS=1 22 | 23 | 24 | TARGETS+=$(BIN)/ctrlsw_decoder 25 | 26 | .PHONY: decoder 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib_rtos/project.mk: -------------------------------------------------------------------------------- 1 | LIB_RTOS_A=$(BIN)/lib_rtos.a 2 | 3 | LIB_RTOS_SRC:=\ 4 | lib_rtos/lib_rtos.c\ 5 | 6 | LIB_RTOS_OBJ:=$(LIB_RTOS_SRC:%=$(BIN)/%.o) 7 | 8 | ifeq ($(findstring linux,$(TARGET)),linux) 9 | CFLAGS+=-pthread 10 | LDFLAGS+=-lpthread 11 | endif 12 | 13 | ifeq ($(findstring mingw,$(TARGET)),mingw) 14 | LIB_RTOS_DLL=$(BIN)/lib_rtos.dll 15 | $(LIB_RTOS_DLL): $(LIB_RTOS_OBJ) 16 | $(Q)$(CXX) $(CFLAGS) -shared -o "$@" $^ lib_rtos/dll_rtos.def $(LDFLAGS) 17 | @echo "LD $@" 18 | else 19 | LIB_RTOS_DLL=$(BIN)/lib_rtos.so 20 | $(LIB_RTOS_DLL): $(LIB_RTOS_OBJ) 21 | $(Q)$(CXX) $(CFLAGS) -Wl,--retain-symbols-file=lib_rtos/lib_rtos.def -shared -o "$@" $^ $(LDFLAGS) 22 | @echo "LD $@" 23 | endif 24 | 25 | lib_rtos: lib_rtos_dll lib_rtos_a 26 | 27 | $(LIB_RTOS_A): $(LIB_RTOS_OBJ) 28 | 29 | lib_rtos_a: $(LIB_RTOS_A) 30 | 31 | lib_rtos_dll: $(LIB_RTOS_DLL) 32 | 33 | UNITTEST+=$(shell find lib_rtos/unittests -name "*.cpp") 34 | UNITTEST+=$(LIB_RTOS_SRC) 35 | 36 | .PHONY: lib_rtos lib_rtos_dll lib_rtos_a 37 | 38 | -------------------------------------------------------------------------------- /encoder_defs.mk: -------------------------------------------------------------------------------- 1 | # build configuration 2 | ENABLE_64BIT?=1 3 | ENABLE_ANDROID?=0 4 | ENABLE_COMP?=1 5 | ENABLE_STATIC?=0 6 | ENABLE_DECODER?=1 7 | ENABLE_UNITTESTS?=1 8 | ENABLE_LIBREF?=1 9 | 10 | BIN?=bin 11 | 12 | CONFIG?=include/config.h 13 | ifneq ($(CONFIG),) 14 | CFLAGS+=-include $(CONFIG) 15 | endif 16 | 17 | INCLUDES+=-I. 18 | INCLUDES+=-Iinclude 19 | INCLUDES+=-Iinclude/traces 20 | INCLUDES+=-I./extra/include 21 | 22 | #CFLAGS+=-Werror 23 | CFLAGS+=-Wall -Wextra 24 | 25 | ifeq ($(ENABLE_64BIT),0) 26 | # force 32 bit compilation 27 | ifneq (,$(findstring x86_64,$(TARGET))) 28 | CFLAGS+=-m32 29 | LDFLAGS+=-m32 30 | TARGET:=i686-linux-gnu 31 | endif 32 | endif 33 | 34 | ifeq ($(findstring x86_64,$(TARGET)),x86_64) 35 | ifeq ($(ENABLE_AVX2),1) 36 | CFLAGS+=-mavx2 37 | else 38 | CFLAGS+=-msse3 39 | endif 40 | endif 41 | 42 | # to be fixed 43 | $(BIN)/lib_encode/unittests/encode.cpp.o: CFLAGS+=-Wno-deprecated-declarations 44 | $(BIN)/test/integration/dmabuf/test_dmabuf_encode.cpp.o: CFLAGS+=-Wno-deprecated-declarations 45 | -------------------------------------------------------------------------------- /exe_encoder/resource.h: -------------------------------------------------------------------------------- 1 | #define IDI_ICON1 101 2 | 3 | #define AL_ENCODER_VERSION 1, 0, 41 4 | #define AL_ENCODER_VERSION_STR "1,0,41" 5 | 6 | #define AL_ENCODER_NAME_PART1 "AVC/" 7 | #define AL_ENCODER_NAME_PART2 "HEVC" 8 | #define AL_ENCODER_NAME_PART3 9 | #define AL_ENCODER_NAME_PART4 10 | #define AL_ENCODER_NAME_PART5 11 | #define AL_ENCODER_NAME AL_ENCODER_NAME_PART1 AL_ENCODER_NAME_PART2 AL_ENCODER_NAME_PART3 AL_ENCODER_NAME_PART4 AL_ENCODER_NAME_PART5 12 | 13 | #define AL_ENCODER_COMMENTS "Confidential material" 14 | #define AL_ENCODER_COMPANY "Allegro DVT2" 15 | #define AL_ENCODER_PRODUCT_NAME AL_ENCODER_NAME " Encoder Reference Software" 16 | #define AL_ENCODER_FILE_DESCR AL_ENCODER_COMPANY " - " AL_ENCODER_PRODUCT_NAME 17 | #define AL_ENCODER_INTERNAL_NAME AL_ENCODER_NAME " Encoder" 18 | #define AL_ENCODER_COPYRIGHT "Copyright (C) 2018" 19 | #define AL_ENCODER_ORIGINAL_NAME "ctrlsw_encoder" 20 | 21 | // Next default values for new objects 22 | // 23 | #ifdef APSTUDIO_INVOKED 24 | #ifndef APSTUDIO_READONLY_SYMBOLS 25 | #define _APS_NEXT_RESOURCE_VALUE 102 26 | #define _APS_NEXT_COMMAND_VALUE 40001 27 | #define _APS_NEXT_CONTROL_VALUE 1001 28 | #define _APS_NEXT_SYMED_VALUE 101 29 | #endif 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /lib_decode/project.mk: -------------------------------------------------------------------------------- 1 | LIB_DECODER_A=$(BIN)/liballegro_decode.a 2 | LIB_DECODER_DLL=$(BIN)/liballegro_decode.so 3 | 4 | ifneq ($(findstring mingw,$(TARGET)),mingw) 5 | CFLAGS+=-fPIC 6 | endif 7 | 8 | LIB_DECODE_SRC+=\ 9 | lib_decode/NalUnitParser.c\ 10 | lib_decode/NalDecoder.c\ 11 | lib_decode/HevcDecoder.c\ 12 | lib_decode/AvcDecoder.c\ 13 | lib_decode/FrameParam.c\ 14 | lib_decode/SliceDataParsing.c\ 15 | lib_decode/DefaultDecoder.c\ 16 | lib_decode/lib_decode.c\ 17 | lib_decode/BufferFeeder.c\ 18 | lib_decode/Patchworker.c\ 19 | lib_decode/DecoderFeeder.c\ 20 | lib_decode/DecChannelMcu.c\ 21 | 22 | LIB_DECODER_SRC:=\ 23 | $(LIB_RTOS_SRC)\ 24 | $(LIB_COMMON_SRC)\ 25 | $(LIB_COMMON_DEC_SRC)\ 26 | $(LIB_FPGA_SRC)\ 27 | $(LIB_PARSING_SRC)\ 28 | $(LIB_DECODE_SRC)\ 29 | $(LIB_SCHEDULER_DEC_SRC)\ 30 | $(LIB_SCHEDULER_SRC)\ 31 | $(LIB_PERFS_SRC)\ 32 | 33 | ifneq ($(ENABLE_TRACES),0) 34 | LIB_DECODER_SRC+=\ 35 | $(LIB_TRACE_SRC_DEC) 36 | endif 37 | 38 | LIB_DECODER_OBJ:=$(LIB_DECODER_SRC:%=$(BIN)/%.o) 39 | 40 | $(LIB_DECODER_A): $(LIB_DECODER_OBJ) 41 | 42 | $(LIB_DECODER_DLL): $(LIB_DECODER_OBJ) 43 | 44 | liballegro_decode: liballegro_decode_dll liballegro_decode_a 45 | 46 | liballegro_decode_dll: $(LIB_DECODER_DLL) 47 | 48 | liballegro_decode_a: $(LIB_DECODER_A) 49 | 50 | TARGETS+=$(LIB_DECODER_DLL) 51 | 52 | .PHONY: liballegro_decode liballegro_decode_dll liballegro_decode_a 53 | 54 | UNITTEST+=$(shell find lib_decode/unittests -name "*.cpp") 55 | UNITTEST+=$(LIB_DECODE_SRC) 56 | UNITTEST+=$(LIB_TRACE_SRC_DEC) 57 | 58 | -------------------------------------------------------------------------------- /base.mk: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | #general rules 3 | ############################################################## 4 | .SUFFIXES: 5 | 6 | V?=0 7 | 8 | ifeq ($(V),0) 9 | Q=@ 10 | else 11 | Q= 12 | endif 13 | 14 | LINK_COMPAT:= 15 | 16 | INTROSPECT_FLAGS= 17 | 18 | ifneq ($(ENABLE_STATIC),0) 19 | LINK_COMPAT+=-static-libstdc++ -static-libgcc -static 20 | endif 21 | 22 | ifneq ($(findstring mingw,$(TARGET)),mingw) 23 | LINK_COMPAT+=-Wl,--hash-style=both 24 | endif 25 | 26 | $(BIN)/%.cpp.o: %.cpp 27 | @mkdir -p $(dir $@) 28 | $(Q)$(CXX) $(CFLAGS) $(INTROSPECT_FLAGS) $(INCLUDES) -std=c++11 -o $@ -c $< 29 | @$(CXX) -MP -MM "$<" -MT "$@" -o "$(BIN)/$*_cpp.deps" $(INCLUDES) $(CFLAGS) -std=c++11 30 | @echo "CXX $<" 31 | 32 | $(BIN)/%.c.o: %.c 33 | @mkdir -p $(dir $@) 34 | $(Q)$(CC) $(CFLAGS) $(INTROSPECT_FLAGS) $(INCLUDES) -std=gnu99 -o $@ -c $< 35 | @$(CC) -MP -MM "$<" -MT "$@" -o "$(BIN)/$*_c.deps" $(INCLUDES) $(CFLAGS) 36 | @echo "CC $<" 37 | 38 | $(BIN)/%.a: 39 | @mkdir -p $(dir $@) 40 | $(Q)$(AR) cr $@ $^ 41 | @echo "AR $@" 42 | 43 | $(BIN)/%: 44 | @mkdir -p $(dir $@) 45 | $(Q)$(CXX) -o $@ $^ $(LINK_COMPAT) $(LDFLAGS) 46 | @echo "CXX $@" 47 | 48 | $(BIN)/%.so: 49 | $(Q)$(CXX) $(CFLAGS) -shared -Wl,-soname,$(notdir $@).$(MAJOR) -o "$@.$(VERSION)" $^ $(LDFLAGS) 50 | @echo "LD $@" 51 | @ln -fs "$(@:$(BIN)/%=%).$(VERSION)" $@.$(MAJOR) 52 | @ln -fs "$(@:$(BIN)/%=%).$(VERSION)" $@ 53 | 54 | clean: 55 | $(Q)rm -rf $(BIN) 56 | @echo "CLEAN $(BIN)" 57 | 58 | 59 | define get-my-dir 60 | $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) 61 | endef 62 | 63 | # Dependency generation 64 | 65 | include $(shell test -d $(BIN) && find $(BIN) -name "*.deps") 66 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ============================ 2 | VCU Control Software Source Code 3 | ============================ 4 | 5 | Overview 6 | ======== 7 | 8 | The control-software can be used as: 9 | - a standalone command-line executable (see below). 10 | - a library, whose entry point can be found in lib_encode and lib_decode 11 | 12 | How to build the encoder and the decoder 13 | ===================================== 14 | 15 | GCC: 16 | ---- 17 | 18 | You need a working gcc/g++ toolchain installed. 19 | Just run: 20 | 21 | $ make 22 | 23 | The resulting binaries will be available in the bin/ directory 24 | 25 | You can test it on a very simple configuration with the following command: 26 | $ ./bin/ctrlsw_encoder -cfg test/config/encode.simple.cfg 27 | 28 | Libraries 29 | ========= 30 | 31 | customers Allows to change build options like traces enabling (config.h) 32 | 33 | lib_app misc C++ utilities. 34 | lib_cfg C++ configuration file parsing. 35 | lib_conv_yuv C++ yuvs conversion helpers for the encoder (use lib_app) 36 | lib_preprocess QP table management 37 | 38 | lib_rtos wrapper around OS synchronization primitives. 39 | lib_common misc C utilities. 40 | lib_common_* structures used to communicate with the firmware 41 | lib_bitstream high-level syntax bitstream generation (e.g headers). 42 | 43 | lib_encode encode library entry point. 44 | lib_decode decode library entry point 45 | 46 | lib_parsing codec specifications specifics for the decoder (HLS, DPB, etc.) 47 | 48 | lib_fpga communication with the hardware (read/write register, irq). 49 | lib_ip_ctrl interface to the codec. 50 | 51 | User Manual 52 | =========== 53 | 54 | Refer to Xilinx product guide document: PG252 H.264/H.265 Video Codec Unit Product Guide 55 | 56 | -------------------------------------------------------------------------------- /Doxygen/SvgCleanAndLink.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import xml.etree.ElementTree as ET 5 | 6 | namespaces = { 'SVG': 'http://www.w3.org/2000/svg', 'HTML': 'http://www.w3.org/1999/xhtml'} 7 | 8 | def main(): 9 | links = {} 10 | 11 | ET.register_namespace("", namespaces['SVG']) 12 | 13 | if sys.argv[3] : 14 | get_function_links(sys.argv[3], links) 15 | 16 | cleanup_svg(sys.argv[1], sys.argv[2], links); 17 | 18 | def cleanup_svg(svgfilein, svgfileout, links): 19 | xmltree = ET.parse(svgfilein) 20 | root = xmltree.getroot() 21 | 22 | for defs in root.findall('SVG:defs', namespaces): 23 | root.remove(defs) 24 | 25 | parse_g(root, links) 26 | 27 | xmltree.write(svgfileout) 28 | 29 | def parse_g(tree, links): 30 | for g in tree.findall('SVG:g', namespaces): 31 | if 'font-family' in g.attrib: 32 | g.attrib['font-family'] = g.attrib['font-family'].replace(' embedded', '') 33 | parse_g(g, links) 34 | 35 | for text in tree.findall('SVG:text', namespaces): 36 | for tspan in text.findall('SVG:tspan', namespaces): 37 | text.text = tspan.text 38 | if tspan.text in links: 39 | link = ET.Element("a", { 'href': links[tspan.text], 'target':'_top' }) 40 | link.append(text) 41 | tree.append(link) 42 | tree.remove(text) 43 | text.remove(tspan) 44 | 45 | def get_function_links(funcfile, links): 46 | return get_function_links_rec(ET.parse(funcfile).getroot(), links) 47 | 48 | def get_function_links_rec(tree, links): 49 | for child in tree.findall('HTML:li', namespaces): 50 | get_link(child, links) 51 | 52 | for child in tree: 53 | get_function_links_rec(child, links) 54 | 55 | def get_link(elem, links): 56 | name = elem.text 57 | if name != None and name[0:3] == "AL_": 58 | link = elem.find('HTML:a', namespaces) 59 | if link != None and 'href' in link.attrib : 60 | links[name.split('(')[0]] = link.attrib['href'] 61 | 62 | main() 63 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2017 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | -------------------------------------------------------------------------------- /lib_encode/JpegTables.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib_encode/JpegTables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib_conv_yuv/lib_conv_yuv.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "ConvSrc.h" 41 | 42 | #include "AL_NvxConvert.h" 43 | 44 | -------------------------------------------------------------------------------- /include/lib_common/HardwareDriver.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | typedef struct AL_t_driver AL_TDriver; 39 | 40 | AL_TDriver* AL_GetHardwareDriver(); 41 | 42 | -------------------------------------------------------------------------------- /lib_app/BufferMetaFactory.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "lib_common/BufferMeta.h" 39 | 40 | AL_TMetaData* AL_MetaData_Clone(AL_TMetaData* pMeta); 41 | 42 | -------------------------------------------------------------------------------- /lib_bitstream/AVC_RbspEncod.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "IRbspWriter.h" 41 | 42 | IRbspWriter* AL_GetAvcRbspWriter(); 43 | 44 | -------------------------------------------------------------------------------- /lib_bitstream/HEVC_RbspEncod.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "IRbspWriter.h" 41 | 42 | IRbspWriter* AL_GetHevcRbspWriter(); 43 | 44 | -------------------------------------------------------------------------------- /lib_fpga/DevicePool.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "lib_rtos/types.h" 40 | 41 | int AL_DevicePool_Open(const char* filename); 42 | int AL_DevicePool_Close(int fd); 43 | 44 | -------------------------------------------------------------------------------- /lib_common/AvcLevelsLimit.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | int Avc_GetMaxNumberOfSlices(int profile_idc, int level_idc, int numUnitInTicks, int timeScale, int numMbsInPic); 41 | 42 | -------------------------------------------------------------------------------- /include/lib_common/versions.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #define HW_IP_VER_0_1 0x00000001 41 | 42 | #ifndef HW_IP_VERSION 43 | #define HW_IP_VERSION HW_IP_VER_0_1 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /test/config/QPs.hex: -------------------------------------------------------------------------------- 1 | 12 2 | 11 3 | 10 4 | 0F 5 | 0F 6 | 0F 7 | 0F 8 | 0F 9 | 10 10 | 11 11 | 12 12 | 12 13 | 11 14 | 10 15 | 0F 16 | 0F 17 | 0F 18 | 0F 19 | 0F 20 | 10 21 | 11 22 | 12 23 | 12 24 | 11 25 | 10 26 | 0F 27 | 0F 28 | 0F 29 | 0F 30 | 0F 31 | 10 32 | 11 33 | 12 34 | 12 35 | 11 36 | 10 37 | 0F 38 | 0F 39 | 0F 40 | 0F 41 | 0F 42 | 10 43 | 11 44 | 12 45 | 33 46 | 32 47 | 31 48 | 30 49 | 30 50 | 30 51 | 12 52 | 11 53 | 10 54 | 0F 55 | 0F 56 | 0F 57 | 0F 58 | 0F 59 | 10 60 | 11 61 | 12 62 | 12 63 | 11 64 | 10 65 | 0F 66 | 0F 67 | 0F 68 | 0F 69 | 0F 70 | 10 71 | 11 72 | 12 73 | 12 74 | 11 75 | 10 76 | 0F 77 | 0F 78 | 0F 79 | 0F 80 | 0F 81 | 10 82 | 11 83 | 12 84 | 12 85 | 11 86 | 10 87 | 0F 88 | 0F 89 | 0F 90 | 0F 91 | 0F 92 | 10 93 | 11 94 | 12 95 | 33 96 | 32 97 | 31 98 | 30 99 | 30 100 | 30 101 | 12 102 | 11 103 | 10 104 | 0F 105 | 0F 106 | 0F 107 | 0F 108 | 0F 109 | 10 110 | 11 111 | 12 112 | 12 113 | 11 114 | 10 115 | 0F 116 | 0F 117 | 0F 118 | 0F 119 | 0F 120 | 10 121 | 11 122 | 12 123 | 12 124 | 11 125 | 10 126 | 0F 127 | 0F 128 | 0F 129 | 0F 130 | 0F 131 | 10 132 | 11 133 | 12 134 | 12 135 | 11 136 | 10 137 | 0F 138 | 0F 139 | 0F 140 | 0F 141 | 0F 142 | 10 143 | 11 144 | 12 145 | 33 146 | 32 147 | 31 148 | 30 149 | 30 150 | 30 151 | 12 152 | 11 153 | 10 154 | 0F 155 | 0F 156 | 0F 157 | 0F 158 | 0F 159 | 10 160 | 11 161 | 12 162 | 12 163 | 11 164 | 10 165 | 0F 166 | 0F 167 | 0F 168 | 0F 169 | 0F 170 | 10 171 | 11 172 | 12 173 | 12 174 | 11 175 | 10 176 | 0F 177 | 0F 178 | 0F 179 | 0F 180 | 0F 181 | 10 182 | 11 183 | 12 184 | 12 185 | 11 186 | 10 187 | 0F 188 | 0F 189 | 0F 190 | 0F 191 | 0F 192 | 10 193 | 11 194 | 12 195 | 33 196 | 32 197 | 31 198 | 30 199 | 30 200 | 30 201 | 12 202 | 11 203 | 10 204 | 0F 205 | 0F 206 | 0F 207 | 0F 208 | 0F 209 | 10 210 | 11 211 | 12 212 | 12 213 | 11 214 | 10 215 | 0F 216 | 0F 217 | 0F 218 | 0F 219 | 0F 220 | 10 221 | 11 222 | 12 223 | 12 224 | 11 225 | 10 226 | 0F 227 | 0F 228 | 0F 229 | 0F 230 | 0F 231 | 10 232 | 11 233 | 12 234 | 12 235 | 11 236 | 10 237 | 0F 238 | 0F 239 | 0F 240 | 0F 241 | 0F 242 | 10 243 | 11 244 | 12 245 | 33 246 | 32 247 | 31 248 | 30 249 | 30 250 | 30 251 | -------------------------------------------------------------------------------- /exe_decoder/CodecUtils.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_app/console.h" 41 | 42 | void DisplayFrameStatus(int iFrameNum); 43 | void DisplayVersionInfo(); 44 | void DisplayBuildInfo(); 45 | 46 | -------------------------------------------------------------------------------- /exe_encoder/sink_md5.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "sink.h" 41 | #include "CfgParser.h" 42 | 43 | std::unique_ptr createMd5Calculator(std::string path, ConfigFile& cfg_, AL_TBuffer* Yuv_); 44 | 45 | -------------------------------------------------------------------------------- /lib_encode/AVC_Sections.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "Sections.h" 40 | #include "IP_EncoderCtx.h" 41 | 42 | void AVC_GenerateSections(AL_TEncCtx* pCtx, AL_TBuffer* pStream, AL_TEncPicStatus const* pPicStatus); 43 | 44 | -------------------------------------------------------------------------------- /exe_encoder/sink_frame_writer.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "sink.h" 41 | #include "CfgParser.h" 42 | 43 | std::unique_ptr createFrameWriter(std::string path, ConfigFile& cfg_, AL_TBuffer* Yuv_, int iLayerID_); 44 | 45 | -------------------------------------------------------------------------------- /lib_encode/HEVC_Sections.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "Sections.h" 40 | #include "IP_EncoderCtx.h" 41 | 42 | void HEVC_GenerateSections(AL_TEncCtx* pCtx, AL_TBuffer* pStream, AL_TEncPicStatus const* pPicStatus, int iLayerID); 43 | 44 | -------------------------------------------------------------------------------- /exe_encoder/sink_bitstream_writer.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | #include "sink.h" 42 | #include "CfgParser.h" 43 | 44 | std::unique_ptr createBitstreamWriter(std::string path, ConfigFile const& cfg); 45 | 46 | -------------------------------------------------------------------------------- /lib_decode/InternalError.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | typedef enum 41 | { 42 | SUCCESS_ACCESS_UNIT, 43 | SUCCESS_NAL_UNIT, 44 | ERR_UNIT_NOT_FOUND, 45 | ERR_UNIT_INVALID_CHANNEL, 46 | ERR_UNIT_DYNAMIC_ALLOC, 47 | }UNIT_ERROR; 48 | 49 | -------------------------------------------------------------------------------- /lib_decode/NalUnitParserPrivate.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | void UpdateCircBuffer(AL_TRbspParser* pRP, TCircBuffer* pBufStream, int* pSliceHdrLength); 41 | bool SkipNal(); 42 | 43 | AL_TRbspParser getParserOnNonVclNal(AL_TDecCtx* pCtx); 44 | 45 | -------------------------------------------------------------------------------- /lib_encode/LoadLda.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "lib_common_enc/EncBuffersInternal.h" 40 | #include "lib_common_enc/Settings.h" 41 | 42 | bool LoadLambdaFromFile(char const* lambdaFileName, TBufferEP* pEP); 43 | 44 | void LoadCustomLda(TBufferEP* pEP); 45 | 46 | -------------------------------------------------------------------------------- /include/lib_encode/SchedulerMcu.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/Allocator.h" 41 | 42 | typedef struct AL_t_driver AL_TDriver; 43 | typedef struct t_Scheduler TScheduler; 44 | 45 | TScheduler* AL_SchedulerMcu_Create(AL_TDriver* driver, AL_TAllocator* pDmaAllocator); 46 | 47 | -------------------------------------------------------------------------------- /lib_parsing/Concealment.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "Concealment.h" 39 | 40 | void AL_Conceal_Init(AL_TConceal* pConceal) 41 | { 42 | pConceal->iFirstLCU = -1; 43 | pConceal->iActivePPS = -1; 44 | pConceal->bValidFrame = false; 45 | pConceal->iLastPPSId = -1; 46 | pConceal->bHasPPS = false; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Doxygen/tabs.css: -------------------------------------------------------------------------------- 1 | /* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ 2 | 3 | DIV.tabs 4 | { 5 | float : left; 6 | width : 100%; 7 | background : url("tab_b.gif") repeat-x bottom; 8 | margin-bottom : 4px; 9 | } 10 | 11 | DIV.tabs UL 12 | { 13 | margin : 0px; 14 | padding-left : 10px; 15 | list-style : none; 16 | } 17 | 18 | DIV.tabs LI, DIV.tabs FORM 19 | { 20 | display : inline; 21 | margin : 0px; 22 | padding : 0px; 23 | } 24 | 25 | DIV.tabs FORM 26 | { 27 | float : right; 28 | } 29 | 30 | DIV.tabs A 31 | { 32 | float : left; 33 | background : url("tab_r.gif") no-repeat right top; 34 | border-bottom : 1px solid #84B0C7; 35 | font-size : 8px; 36 | font-weight : bold; 37 | text-decoration : none; 38 | } 39 | 40 | DIV.tabs A:hover 41 | { 42 | background-position: 100% -150px; 43 | } 44 | 45 | DIV.tabs A:link, DIV.tabs A:visited, 46 | DIV.tabs A:active, DIV.tabs A:hover 47 | { 48 | color: #1A419D; 49 | } 50 | 51 | DIV.tabs SPAN 52 | { 53 | float : left; 54 | display : block; 55 | background : url("tab_l.gif") no-repeat left top; 56 | padding : 5px 9px; 57 | white-space : nowrap; 58 | } 59 | 60 | DIV.tabs INPUT 61 | { 62 | float : right; 63 | display : inline; 64 | font-size : 1em; 65 | } 66 | 67 | DIV.tabs TD 68 | { 69 | font-size : 8px; 70 | font-weight : bold; 71 | text-decoration : none; 72 | } 73 | 74 | 75 | 76 | /* Commented Backslash Hack hides rule from IE5-Mac \*/ 77 | DIV.tabs SPAN {float : none;} 78 | /* End IE5-Mac hack */ 79 | 80 | DIV.tabs A:hover SPAN 81 | { 82 | background-position: 0% -150px; 83 | } 84 | 85 | DIV.tabs LI.current A 86 | { 87 | background-position: 100% -150px; 88 | border-width : 0px; 89 | } 90 | 91 | DIV.tabs LI.current SPAN 92 | { 93 | background-position: 0% -150px; 94 | padding-bottom : 6px; 95 | } 96 | 97 | DIV.navpath 98 | { 99 | background : none; 100 | border : none; 101 | border-bottom : 1px solid #84B0C7; 102 | } 103 | -------------------------------------------------------------------------------- /lib_encode/IScheduler.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "IScheduler.h" 39 | 40 | /* can't be a static inline function as api user need this function and 41 | * don't know about the TScheduler type internals */ 42 | void AL_ISchedulerEnc_Destroy(TScheduler* pScheduler) 43 | { 44 | pScheduler->vtable->destroy(pScheduler); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /exe_decoder/crc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | 42 | extern "C" 43 | { 44 | #include "lib_common/SliceConsts.h" // EChromaMode 45 | } 46 | 47 | template 48 | void Compute_CRC(int iBdInY, int iBdInC, int iBdOut, int iNumPix, int iNumPixC, AL_EChromaMode eMode, T* pBuf, std::ofstream& ofCrcFile); 49 | 50 | -------------------------------------------------------------------------------- /lib_encode/McuTimers.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | #include 42 | 43 | #include "lib_rtos/types.h" 44 | 45 | #define TIMER_SENTINEL 0xdeaddead 46 | 47 | typedef struct 48 | { 49 | uint32_t id; 50 | uint32_t value; 51 | }timerData; 52 | 53 | bool McuTimers_Write(FILE* perfsFile, timerData* timerValues); 54 | 55 | -------------------------------------------------------------------------------- /exe_encoder/container.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include 39 | #include "lib_app/InputFiles.h" 40 | #include "lib_encode/lib_encoder.h" 41 | 42 | using namespace std; 43 | 44 | void WriteContainerHeader(ofstream& fp, AL_TEncSettings const& Settings, TYUVFileInfo const& FileInfo, int numFrames) 45 | { 46 | (void)fp; 47 | (void)Settings; 48 | (void)FileInfo; 49 | (void)numFrames; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /lib_conv_yuv/AL_NvxConvert.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "ConvSrc.h" 41 | 42 | class CNvxConv : public IConvSrc 43 | { 44 | public: 45 | CNvxConv(TFrameInfo const& FrameInfo); 46 | 47 | virtual unsigned int GetSrcBufSize(int iPitch, int iStrideHeight); 48 | virtual void ConvertSrcBuf(uint8_t uBitDepth, AL_TBuffer const* pSrcIn, AL_TBuffer* pSrcOut); 49 | 50 | protected: 51 | TFrameInfo const m_FrameInfo; 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /lib_common/BufferCircMeta.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/BufferMeta.h" 41 | 42 | typedef struct AL_t_CircMetaData 43 | { 44 | AL_TMetaData tMeta; 45 | int32_t iOffset; 46 | int32_t iAvailSize; 47 | bool bLastBuffer; 48 | }AL_TCircMetaData; 49 | 50 | AL_TCircMetaData* AL_CircMetaData_Create(int32_t iOffset, int32_t iAvailSize, bool bLastBuffer); 51 | AL_TCircMetaData* AL_CircMetaData_Clone(AL_TCircMetaData* pMeta); 52 | 53 | -------------------------------------------------------------------------------- /lib_encode/Encoder.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common_enc/EncBuffers.h" 41 | #include "lib_common_enc/EncRecBuffer.h" 42 | #include "lib_common_enc/Settings.h" 43 | 44 | typedef struct AL_s_TEncoder AL_TEncoder; 45 | typedef struct AL_t_EncCtx AL_TEncCtx; 46 | 47 | /****************************************************************************/ 48 | typedef struct AL_s_TEncoder 49 | { 50 | AL_TEncCtx* pCtx; 51 | }AL_TEncoder; 52 | 53 | -------------------------------------------------------------------------------- /lib_app/console.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | enum EConColor 41 | { 42 | CC_BLACK, 43 | CC_RED, 44 | CC_GREEN, 45 | CC_YELLOW, 46 | CC_BLUE, 47 | CC_MAGENTA, 48 | CC_CYAN, 49 | CC_GREY, 50 | CC_DARK_RED, 51 | CC_DARK_GREEN, 52 | CC_DARK_YELLOW, 53 | CC_DARK_BLUE, 54 | CC_DARK_MAGENTA, 55 | CC_DARK_CYAN, 56 | CC_DARK_GREY, 57 | CC_WHITE, 58 | CC_DEFAULT, 59 | }; 60 | 61 | void SetEnableColor(bool bColor); 62 | void SetConsoleColor(EConColor eColor); 63 | 64 | -------------------------------------------------------------------------------- /lib_app/timing.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | inline uint64_t GetPerfTime() 45 | { 46 | using namespace std; 47 | 48 | auto now = chrono::high_resolution_clock::now(); 49 | auto elapsed = now.time_since_epoch(); 50 | return chrono::duration_cast(elapsed).count(); 51 | } 52 | 53 | inline void Sleep(int ms) 54 | { 55 | using namespace std; 56 | this_thread::sleep_for(chrono::milliseconds(ms)); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /exe_encoder/MD5.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/types.h" 41 | #include 42 | 43 | class CMD5 44 | { 45 | public: 46 | CMD5(); 47 | 48 | void Update(uint8_t* pBuffer, uint32_t uSize); 49 | std::string GetMD5(); 50 | 51 | protected: 52 | void UpdateBlock(uint32_t* pBlock); 53 | 54 | union 55 | { 56 | uint32_t m_pHash32[4]; 57 | uint8_t m_pHash8[16]; 58 | }; 59 | 60 | AL_64U m_uNumBytes; 61 | 62 | uint8_t m_pBound[64]; // 512 bits 63 | uint32_t m_uBound; 64 | }; 65 | 66 | -------------------------------------------------------------------------------- /lib_common_enc/EncSize.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "EncSize.h" 39 | #include "lib_common/Utils.h" 40 | 41 | /****************************************************************************/ 42 | int AL_GetCompLcuSize(uint8_t uLcuSize, uint8_t uBitDepth, AL_EChromaMode eChromaMode, bool bUseEnt) 43 | { 44 | 45 | (void)uLcuSize, (void)uBitDepth, (void)eChromaMode, (void)bUseEnt; 46 | // header + MVDs + residuals words size 47 | return 1312; 48 | } 49 | 50 | /****************************************************************************/ 51 | 52 | -------------------------------------------------------------------------------- /lib_common/Fifo.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/lib_rtos.h" 41 | 42 | typedef struct 43 | { 44 | size_t zMaxElem; 45 | size_t zTail; 46 | size_t zHead; 47 | void** ElemBuffer; 48 | AL_MUTEX hMutex; 49 | AL_SEMAPHORE hCountSem; 50 | AL_SEMAPHORE hSpaceSem; 51 | }AL_TFifo; 52 | 53 | bool AL_Fifo_Init(AL_TFifo* pFifo, size_t zMaxElem); 54 | void AL_Fifo_Deinit(AL_TFifo* pFifo); 55 | bool AL_Fifo_Queue(AL_TFifo* pFifo, void* pElem, uint32_t uWait); 56 | void* AL_Fifo_Dequeue(AL_TFifo* pFifo, uint32_t uWait); 57 | 58 | -------------------------------------------------------------------------------- /lib_common_enc/EncEPBuffer.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/MemDesc.h" 41 | #include "lib_rtos/types.h" 42 | 43 | /*************************************************************************//*! 44 | \brief Buffer with encoder parameters content 45 | *****************************************************************************/ 46 | typedef struct t_BufferEP 47 | { 48 | TMemDesc tMD; /*!< Memory descriptor associated to the buffer */ 49 | uint32_t uFlags; /*!< Specifies which tables are present in the buffer */ 50 | }TBufferEP; 51 | 52 | -------------------------------------------------------------------------------- /lib_encode/DriverDataConversions.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #if __linux__ 39 | 40 | #include "allegro_ioctl_mcu_enc.h" 41 | #include "lib_common_enc/EncPicInfo.h" 42 | #include "lib_common_enc/EncChanParam.h" 43 | #include "lib_common/BufferAPI.h" 44 | #include "lib_common/MemDesc.h" 45 | 46 | #define DCACHE_OFFSET 0x80000000 47 | 48 | void setChannelParam(struct al5_params* msg, AL_TEncChanParam* pChParam, TMemDesc* pEP1); 49 | void setEncodeMsg(struct al5_encode_msg* msg, AL_TEncInfo* encInfo, AL_TEncRequestInfo* reqInfo, AL_TEncPicBufAddrs* bufAddrs); 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /exe_encoder/ICommandsSender.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | struct ICommandsSender 41 | { 42 | virtual ~ICommandsSender() {}; 43 | virtual void notifySceneChange(int lookAhead) = 0; 44 | virtual void notifyIsLongTerm() = 0; 45 | virtual void notifyUseLongTerm() = 0; 46 | virtual void restartGop() = 0; 47 | virtual void setGopLength(int gopLength) = 0; 48 | virtual void setNumB(int numB) = 0; 49 | virtual void setFrameRate(int frameRate, int clockRatio) = 0; 50 | virtual void setBitRate(int bitRate) = 0; 51 | virtual void setQP(int qp) = 0; 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /lib_conv_yuv/ConvSrc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | extern "C" 41 | { 42 | #include "lib_common/BufferAPI.h" 43 | #include "lib_common/SliceConsts.h" 44 | } 45 | 46 | class IConvSrc 47 | { 48 | public: 49 | virtual ~IConvSrc() {}; 50 | 51 | virtual unsigned int GetSrcBufSize(int iPitch, int iStrideHeight) = 0; 52 | virtual void ConvertSrcBuf(uint8_t uBitDepth, AL_TBuffer const* pSrcIn, AL_TBuffer* pSrcOut) = 0; 53 | }; 54 | 55 | struct TFrameInfo 56 | { 57 | int iWidth; 58 | int iHeight; 59 | uint8_t iBitDepth; 60 | AL_EChromaMode eCMode; 61 | }; 62 | 63 | -------------------------------------------------------------------------------- /lib_parsing/Concealment.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/types.h" 41 | 42 | typedef struct t_Conceal 43 | { 44 | bool bHasPPS; 45 | bool bValidFrame; 46 | int iLastPPSId; 47 | int iActivePPS; 48 | int iFirstLCU; 49 | }AL_TConceal; 50 | 51 | void AL_Conceal_Init(AL_TConceal* pConceal); 52 | 53 | typedef enum 54 | { 55 | AL_CONCEAL = 0, 56 | AL_OK = 1, 57 | AL_UNSUPPORTED = 2 58 | }AL_PARSE_RESULT; 59 | 60 | 61 | #define COMPLY(cond) \ 62 | do { \ 63 | if(!(cond)) \ 64 | return AL_CONCEAL; \ 65 | } \ 66 | while(0) \ 67 | 68 | 69 | -------------------------------------------------------------------------------- /lib_encode/SourceBufferChecker.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/lib_rtos.h" 41 | #include "lib_common/BufferAPI.h" 42 | #include "lib_common/FourCC.h" 43 | #include "lib_common_enc/EncChanParam.h" 44 | 45 | typedef struct 46 | { 47 | int width; 48 | int height; 49 | AL_TPicFormat picFmt; 50 | AL_ESrcMode srcMode; 51 | TFourCC fourCC; 52 | }AL_TSrcBufferChecker; 53 | 54 | void AL_SrcBuffersChecker_Init(AL_TSrcBufferChecker* pCtx, AL_TEncChanParam const* pChParam); 55 | bool AL_SrcBuffersChecker_CanBeUsed(AL_TSrcBufferChecker* pCtx, AL_TBuffer* buffer); 56 | 57 | -------------------------------------------------------------------------------- /lib_common/BufConst.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #define MAX_REF 16 // max number of frame buffer 41 | 42 | #define AL_MAX_COLUMNS_TILE 20 // warning : true only for main profile (4K = 10; 8K = 20) 43 | #define AL_MAX_ROWS_TILE 22 // warning : true only for main profile (4K = 11; 8K = 22) 44 | 45 | #define AL_MAX_NUM_TILE ((AL_MAX_COLUMNS_TILE)*(AL_MAX_ROWS_TILE)) 46 | #define AL_MAX_NUM_WPP 528// max line number : sqrt(MaxLumaSample size * 8) / 32. (4K = 264; 8K = 528); 47 | 48 | #define AL_MAX_ENTRY_POINT (((AL_MAX_NUM_TILE) > (AL_MAX_NUM_WPP)) ? (AL_MAX_NUM_TILE) : (AL_MAX_NUM_WPP)) 49 | 50 | -------------------------------------------------------------------------------- /lib_parsing/AvcParser.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/PPS.h" 41 | #include "lib_common/SEI.h" 42 | #include "lib_common/SPS.h" 43 | #include "lib_common_dec/RbspParser.h" 44 | #include "Concealment.h" 45 | #include "common_syntax.h" 46 | #include "Aup.h" 47 | 48 | #include "lib_decode/lib_decode.h" // for AL_CB_ParsedSEI 49 | 50 | void AL_AVC_InitAUP(AL_TAvcAup* pAUP); 51 | 52 | AL_PARSE_RESULT AL_AVC_ParsePPS(AL_TAup* pIAup, AL_TRbspParser* pRP); 53 | AL_PARSE_RESULT AL_AVC_ParseSPS(AL_TAup* pIAup, AL_TRbspParser* pRP); 54 | bool AL_AVC_ParseSEI(AL_TAup* pIAup, AL_TRbspParser* pRP, AL_CB_ParsedSei* cb); 55 | 56 | -------------------------------------------------------------------------------- /lib_bitstream/lib_bitstream.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /**************************************************************************** 39 | ----------------------------------------------------------------------------- 40 | **************************************************************************//*! 41 | \file 42 | \defgroup lib_bitstream lib_bitstream 43 | @{ 44 | *****************************************************************************/ 45 | #pragma once 46 | 47 | #include "BitStreamLite.h" 48 | #include "HEVC_RbspEncod.h" 49 | #include "HEVC_SkippedPict.h" 50 | #include "AVC_RbspEncod.h" 51 | #include "AVC_SkippedPict.h" 52 | /*@}*/ 53 | 54 | -------------------------------------------------------------------------------- /include/lib_common/Pitches.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /**************************************************************************//*! 39 | \addtogroup Buffers 40 | @{ 41 | \file 42 | *****************************************************************************/ 43 | #pragma once 44 | 45 | /*************************************************************************//*! 46 | \brief luma and chroma Pitches size 47 | *****************************************************************************/ 48 | typedef struct AL_t_Pitches 49 | { 50 | int iLuma; /*!< Luma pitch size in bytes */ 51 | int iChroma; /*!< Chroma pitch size in bytes */ 52 | }AL_TPitches; 53 | 54 | -------------------------------------------------------------------------------- /lib_fpga/BoardNone.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include 39 | #include "lib_rtos/types.h" 40 | #include "lib_fpga/Board.h" 41 | #include "lib_common/Allocator.h" 42 | 43 | AL_TIpCtrl* AL_Board_Create(const char* deviceFile, uint32_t uIntReg, uint32_t uMskReg, uint32_t uIntMask) 44 | { 45 | (void)deviceFile; 46 | (void)uIntReg; 47 | (void)uMskReg; 48 | (void)uIntMask; 49 | fprintf(stderr, "No support for FPGA board on this platform\n"); 50 | return NULL; 51 | } 52 | 53 | AL_TAllocator* AL_DmaAlloc_Create(const char* deviceFile) 54 | { 55 | (void)deviceFile; 56 | fprintf(stderr, "No support for FPGA board on this platform\n"); 57 | return NULL; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /lib_common_enc/EncRecBuffer.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "lib_common_enc/EncRecBuffer.h" 39 | /****************************************************************************/ 40 | void ResetBufferRec(TBufferRec* pBufRec) 41 | { 42 | MemDesc_Init(&pBufRec->tMD); 43 | pBufRec->iWidth = pBufRec->iHeight = 0; 44 | pBufRec->iPitchY = pBufRec->iPitchC = 0; 45 | } 46 | 47 | /****************************************************************************/ 48 | uint32_t AL_GetRecPitch(uint32_t uBitDepth, uint32_t uWidth) 49 | { 50 | if(uBitDepth > 8) 51 | { 52 | return ((uWidth + 63) >> 6) * 320; 53 | } 54 | else 55 | { 56 | return ((uWidth + 63) >> 6) * 256; 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /lib_encode/ISchedulerCommon.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common_enc/EncChanParam.h" 41 | #include "lib_common_enc/EncRecBuffer.h" 42 | #include "lib_common_enc/EncBuffers.h" 43 | 44 | typedef struct 45 | { 46 | uint32_t uWidth; 47 | uint32_t uHeight; 48 | uint32_t uRecSize; 49 | uint32_t uRecSizeY; 50 | TFourCC RecFourCC; 51 | uint32_t uRecPitchY; 52 | uint32_t uRecPitchC; 53 | }AL_TCommonChannelInfo; 54 | 55 | void SetChannelInfo(AL_TCommonChannelInfo* pChanInfo, AL_TEncChanParam* pChParam); 56 | 57 | void SetRecPic(TRecPic* pRecPic, AL_TAllocator* pAllocator, AL_HANDLE hRecBuf, AL_TCommonChannelInfo* pChanInfo, AL_TReconstructedInfo* pRecInfo); 58 | 59 | -------------------------------------------------------------------------------- /lib_common/ChannelResources.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "lib_rtos/types.h" 40 | 41 | typedef struct 42 | { 43 | int minWidth; 44 | int maxWidth; 45 | int resources; 46 | bool enableMultiCore; 47 | }AL_CoreConstraint; 48 | 49 | void AL_CoreConstraint_Init(AL_CoreConstraint* constraint, int coreFrequency, int margin, int hardwareCyclesCount, int minWidth, int maxWidth); 50 | int AL_CoreConstraint_GetExpectedNumberOfCores(AL_CoreConstraint* constraint, int width, int height, int frameRate, int clockRatio); 51 | int AL_CoreConstraint_GetMinCoresCount(AL_CoreConstraint* constraint, int width); 52 | 53 | int AL_GetResources(int width, int height, int frameRate, int clockRatio); 54 | 55 | -------------------------------------------------------------------------------- /exe_encoder/sink.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | #include 42 | 43 | extern "C" 44 | { 45 | #include "lib_common/BufferAPI.h" 46 | } 47 | 48 | struct IFrameSink 49 | { 50 | virtual ~IFrameSink() {}; 51 | virtual void ProcessFrame(AL_TBuffer* frame) = 0; 52 | }; 53 | 54 | struct NullFrameSink : IFrameSink 55 | { 56 | virtual void ProcessFrame(AL_TBuffer*) {} 57 | }; 58 | 59 | struct MultiSink : IFrameSink 60 | { 61 | virtual void ProcessFrame(AL_TBuffer* frame) 62 | { 63 | for(auto& sink : sinks) 64 | sink->ProcessFrame(frame); 65 | } 66 | 67 | std::vector> sinks; 68 | }; 69 | 70 | AL_TBuffer* const EndOfStream = nullptr; 71 | 72 | -------------------------------------------------------------------------------- /include/lib_common/OffsetYC.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /**************************************************************************//*! 39 | \addtogroup Buffers 40 | @{ 41 | \file 42 | *****************************************************************************/ 43 | 44 | #pragma once 45 | 46 | /*************************************************************************//*! 47 | \brief Offset for luma and chroma 48 | *****************************************************************************/ 49 | typedef struct AL_t_OffsetYC 50 | { 51 | int iLuma; /*!< Offset to the begining of the luma in bytes */ 52 | int iChroma; /*!< Offset to the begining of the chroma in bytes */ 53 | }AL_TOffsetYC; 54 | 55 | /*@}*/ 56 | 57 | -------------------------------------------------------------------------------- /lib_encode/AVC_Sections.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "AVC_Sections.h" 39 | #include "lib_bitstream/AVC_RbspEncod.h" 40 | 41 | Nuts CreateAvcNuts(void) 42 | { 43 | Nuts nuts = 44 | { 45 | &GetNalHeaderAvc, 46 | AL_AVC_NUT_SPS, 47 | AL_AVC_NUT_PPS, 48 | AL_AVC_NUT_AUD, 49 | AL_AVC_NUT_FD, 50 | AL_AVC_NUT_PREFIX_SEI, 51 | AL_AVC_NUT_SUFFIX_SEI, 52 | }; 53 | return nuts; 54 | } 55 | 56 | void AVC_GenerateSections(AL_TEncCtx* pCtx, AL_TBuffer* pStream, AL_TEncPicStatus const* pPicStatus) 57 | { 58 | Nuts nuts = CreateAvcNuts(); 59 | NalsData nalsData = AL_ExtractNalsData(pCtx, 0); 60 | GenerateSections(AL_GetAvcRbspWriter(), nuts, &nalsData, pStream, pPicStatus, pCtx->Settings.NumLayer); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /include/lib_common_dec/DecSynchro.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /*************************************************************************//*! 39 | \addtogroup Decoder_Settings 40 | @{ 41 | \file 42 | *****************************************************************************/ 43 | #pragma once 44 | 45 | /*************************************************************************//*! 46 | \brief Decoder synchronization mode 47 | *****************************************************************************/ 48 | typedef enum AL_e_DecUnit 49 | { 50 | AL_AU_UNIT = 0, /*< decode at the Access Unit level (frame) */ 51 | AL_VCL_NAL_UNIT = 1, /*< decode at the NAL Unit level (slice) */ 52 | AL_DEC_UNIT_MAX_ENUM, 53 | }AL_EDecUnit; 54 | 55 | /*@}*/ 56 | 57 | -------------------------------------------------------------------------------- /exe_encoder/CommandsSender.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "ICommandsSender.h" 41 | #include "lib_encode/lib_encoder.h" 42 | 43 | class CommandsSender : public ICommandsSender 44 | { 45 | public: 46 | explicit CommandsSender(AL_HEncoder hEnc) : hEnc(hEnc) {}; 47 | ~CommandsSender() {}; 48 | void notifySceneChange(int lookAhead) override; 49 | void notifyIsLongTerm() override; 50 | void notifyUseLongTerm() override; 51 | void restartGop() override; 52 | void setGopLength(int gopLength) override; 53 | void setNumB(int numB) override; 54 | void setFrameRate(int frameRate, int clockRatio) override; 55 | void setBitRate(int bitRate) override; 56 | void setQP(int qp) override; 57 | 58 | private: 59 | AL_HEncoder hEnc; 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /extra/include/allegro_ioctl_reg.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | 42 | #define AL_CMD_UNBLOCK_CHANNEL _IO('q', 1) 43 | 44 | #define AL_CMD_IP_WRITE_REG _IOWR('q', 10, struct al5_reg) 45 | #define AL_CMD_IP_READ_REG _IOWR('q', 11, struct al5_reg) 46 | #define AL_CMD_IP_WAIT_IRQ _IOWR('q', 12, __s32) 47 | #define GET_DMA_FD _IOWR('q', 13, struct al5_dma_info) 48 | #define GET_DMA_MMAP _IOWR('q', 26, struct al5_dma_info) 49 | #define GET_DMA_PHY _IOWR('q', 18, struct al5_dma_info) 50 | 51 | 52 | 53 | struct al5_reg { 54 | __u32 id; 55 | __u32 value; 56 | }; 57 | 58 | struct al5_dma_info { 59 | __u32 fd; 60 | __u32 size; 61 | __u32 phy_addr; 62 | }; 63 | 64 | -------------------------------------------------------------------------------- /lib_encode/HEVC_Sections.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "HEVC_Sections.h" 39 | #include "lib_bitstream/HEVC_RbspEncod.h" 40 | 41 | Nuts CreateHevcNuts(void) 42 | { 43 | Nuts nuts = 44 | { 45 | &GetNalHeaderHevc, 46 | AL_HEVC_NUT_SPS, 47 | AL_HEVC_NUT_PPS, 48 | AL_HEVC_NUT_AUD, 49 | AL_HEVC_NUT_FD, 50 | AL_HEVC_NUT_PREFIX_SEI, 51 | AL_HEVC_NUT_SUFFIX_SEI, 52 | }; 53 | return nuts; 54 | } 55 | 56 | void HEVC_GenerateSections(AL_TEncCtx* pCtx, AL_TBuffer* pStream, AL_TEncPicStatus const* pPicStatus, int iLayerID) 57 | { 58 | Nuts nuts = CreateHevcNuts(); 59 | NalsData nalsData = AL_ExtractNalsData(pCtx, iLayerID); 60 | GenerateSections(AL_GetHevcRbspWriter(), nuts, &nalsData, pStream, pPicStatus, pCtx->Settings.NumLayer); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /lib_app/BufferMetaFactory.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "BufferMetaFactory.h" 39 | 40 | #include "lib_common/BufferSrcMeta.h" 41 | #include "lib_common/BufferStreamMeta.h" 42 | #if AL_ENABLE_TWOPASS 43 | #include "lib_common/BufferLookAheadMeta.h" 44 | #endif 45 | 46 | AL_TMetaData* AL_MetaData_Clone(AL_TMetaData* pMeta) 47 | { 48 | switch(pMeta->eType) 49 | { 50 | case AL_META_TYPE_SOURCE: 51 | return (AL_TMetaData*)AL_SrcMetaData_Clone((AL_TSrcMetaData*)pMeta); 52 | case AL_META_TYPE_STREAM: 53 | return (AL_TMetaData*)AL_StreamMetaData_Clone((AL_TStreamMetaData*)pMeta); 54 | #if AL_ENABLE_TWOPASS 55 | case AL_META_TYPE_LOOKAHEAD: 56 | return (AL_TMetaData*)AL_LookAheadMetaData_Clone((AL_TLookAheadMetaData*)pMeta); 57 | #endif 58 | default: 59 | return NULL; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /lib_decode/NalDecoder.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "DefaultDecoder.h" 40 | 41 | typedef struct 42 | { 43 | AL_ENut seiPrefix; 44 | AL_ENut seiSuffix; 45 | AL_ENut sps; 46 | AL_ENut pps; 47 | AL_ENut vps; 48 | AL_ENut eos; 49 | }AL_NonVclNuts; 50 | 51 | typedef struct 52 | { 53 | AL_PARSE_RESULT (* parseSps)(AL_TAup*, AL_TRbspParser*); 54 | AL_PARSE_RESULT (* parsePps)(AL_TAup*, AL_TRbspParser*, AL_TDecCtx*); 55 | void (* parseVps)(AL_TAup*, AL_TRbspParser*); 56 | bool (* parseSei)(AL_TAup*, AL_TRbspParser*, AL_CB_ParsedSei* cb); 57 | void (* decodeSliceData)(AL_TAup*, AL_TDecCtx*, AL_ENut, bool, int*); 58 | bool (* isSliceData)(AL_ENut nut); 59 | }AL_NalParser; 60 | 61 | void AL_DecodeOneNal(AL_NonVclNuts, AL_NalParser, AL_TAup*, AL_TDecCtx*, AL_ENut, bool, int*); 62 | 63 | -------------------------------------------------------------------------------- /lib_common_enc/EncSize.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/types.h" 41 | #include "lib_common/SliceConsts.h" 42 | 43 | #define RES_SIZE_16x16_AVC 832/*!< residuals size of a 16x16 LCU */ 44 | #define RES_SIZE_16x16_HEVC 768/*!< residuals size of a 16x16 LCU */ 45 | #define SIZE_LCU_INFO 16 /*!< LCU compressed size + LCU offset */ 46 | 47 | int AL_GetCompLcuSize(uint8_t uLcuSize, uint8_t uBitDepth, AL_EChromaMode eChromaMode, bool bUseEnt); 48 | 49 | 50 | #define AL_MAX_SUPPORTED_LCU_SIZE 6 51 | #define AL_MIN_SUPPORTED_LCU_SIZE 4 52 | 53 | #define AL_MAX_FIXED_SLICE_HEADER_SIZE 32 54 | #define QP_CTRL_TABLE_SIZE 48 55 | 56 | 57 | #define AL_MAX_SLICES_SUBFRAME 32 58 | #define AL_MAX_STREAM_BUFFER (AL_MAX_SLICES_SUBFRAME * 10) 59 | #define AL_MAX_SOURCE_BUFFER (AL_MAX_NUM_B_PICT * 2 + 8) 60 | 61 | -------------------------------------------------------------------------------- /exe_decoder/IpDevice.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include 40 | #include 41 | #include "CodecUtils.h" 42 | #include "lib_app/utils.h" 43 | #include "lib_common_dec/DecChanParam.h" 44 | 45 | typedef struct AL_t_Allocator AL_TAllocator; 46 | typedef struct AL_t_IDecChannel AL_TIDecChannel; 47 | typedef struct AL_t_IpCtrl AL_TIpCtrl; 48 | typedef struct AL_t_Timer AL_Timer; 49 | 50 | /*****************************************************************************/ 51 | struct CIpDevice 52 | { 53 | AL_TIDecChannel* m_pDecChannel = nullptr; 54 | std::shared_ptr m_pAllocator; 55 | AL_Timer* m_pTimer; 56 | }; 57 | 58 | std::shared_ptr CreateIpDevice(int* iUseBoard, int iSchedulerType, std::function wrapIpCtrl, bool trackDma = false, int uNumCore = 0, int hangers = 0); 59 | 60 | -------------------------------------------------------------------------------- /lib_common/BufferCircMeta.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "lib_rtos/lib_rtos.h" 39 | #include "BufferCircMeta.h" 40 | 41 | static bool destroy(AL_TMetaData* pMeta) 42 | { 43 | Rtos_Free(pMeta); 44 | return true; 45 | } 46 | 47 | AL_TCircMetaData* AL_CircMetaData_Create(int32_t iOffset, int32_t iAvailSize, bool bLastBuffer) 48 | { 49 | AL_TCircMetaData* pMeta = Rtos_Malloc(sizeof(*pMeta)); 50 | 51 | if(!pMeta) 52 | return NULL; 53 | 54 | pMeta->tMeta.eType = AL_META_TYPE_CIRCULAR; 55 | pMeta->tMeta.MetaDestroy = destroy; 56 | pMeta->iOffset = iOffset; 57 | pMeta->iAvailSize = iAvailSize; 58 | pMeta->bLastBuffer = bLastBuffer; 59 | 60 | return pMeta; 61 | } 62 | 63 | AL_TCircMetaData* AL_CircMetaData_Clone(AL_TCircMetaData* pMeta) 64 | { 65 | return AL_CircMetaData_Create(pMeta->iOffset, pMeta->iAvailSize, pMeta->bLastBuffer); 66 | } 67 | 68 | -------------------------------------------------------------------------------- /exe_encoder/FileUtils.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | 42 | /****************************************************************************/ 43 | void formatFolderPath(std::string& folderPath); 44 | 45 | /****************************************************************************/ 46 | std::string combinePath(const std::string& folder, const std::string& filename); 47 | 48 | /****************************************************************************/ 49 | std::string createFileNameWithID(const std::string& path, const std::string& motif, const std::string& extension, int iFrameID); 50 | 51 | /****************************************************************************/ 52 | int FromHex2(char a, char b); 53 | 54 | /****************************************************************************/ 55 | int FromHex4(char a, char b, char c, char d); 56 | 57 | -------------------------------------------------------------------------------- /exe_encoder/IpDevice.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include 40 | #include 41 | #include "lib_app/InputFiles.h" 42 | #include "lib_app/utils.h" 43 | 44 | extern "C" 45 | { 46 | #include "lib_common_enc/Settings.h" 47 | #include "lib_encode/lib_encoder.h" 48 | } 49 | 50 | typedef struct AL_t_Allocator AL_TAllocator; 51 | typedef struct AL_t_IpCtrl AL_TIpCtrl; 52 | typedef struct AL_t_Timer AL_Timer; 53 | 54 | /*****************************************************************************/ 55 | struct CIpDevice 56 | { 57 | TScheduler* m_pScheduler = nullptr; 58 | std::shared_ptr m_pAllocator; 59 | AL_Timer* m_pTimer; 60 | }; 61 | 62 | std::shared_ptr CreateIpDevice(bool bUseRefSoftware, int iSchedulerType, AL_TEncSettings& Settings, std::function wrapIpCtrl, bool trackDma = false, int iVqDescr = 0); 63 | 64 | -------------------------------------------------------------------------------- /lib_common_dec/IpDecFourCC.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "lib_common_dec/IpDecFourCC.h" 39 | #include 40 | 41 | TFourCC AL_GetDecFourCC(AL_TPicFormat const picFmt) 42 | { 43 | if(AL_FB_RASTER == picFmt.eStorageMode) 44 | { 45 | assert(picFmt.eChromaMode == CHROMA_MONO || picFmt.eChromaOrder == AL_C_ORDER_SEMIPLANAR); 46 | assert(picFmt.uBitDepth == 8 || picFmt.b10bPacked); 47 | } 48 | 49 | return AL_GetFourCC(picFmt); 50 | } 51 | 52 | AL_TPicFormat AL_GetDecPicFormat(AL_EChromaMode eChromaMode, uint8_t uBitDepth, AL_EFbStorageMode eStorageMode, bool bIsCompressed) 53 | { 54 | bool b10bPacked = false; 55 | b10bPacked = AL_FB_RASTER == eStorageMode && 10 == uBitDepth; 56 | 57 | AL_TPicFormat picFormat = { eChromaMode, uBitDepth, eStorageMode, eChromaMode == CHROMA_MONO ? AL_C_ORDER_NO_CHROMA : AL_C_ORDER_SEMIPLANAR, bIsCompressed, b10bPacked }; 58 | return picFormat; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /lib_decode/DecoderFeeder.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/BufferAPI.h" 41 | #include "lib_common/Fifo.h" 42 | 43 | #include "lib_decode/lib_decode.h" 44 | #include "Patchworker.h" 45 | #include "lib_rtos/types.h" 46 | 47 | typedef struct 48 | { 49 | void (* func)(void* pUserParam); 50 | void* userParam; 51 | }AL_CB_Error; 52 | 53 | typedef struct AL_TDecoderFeederS AL_TDecoderFeeder; 54 | 55 | AL_TDecoderFeeder* AL_DecoderFeeder_Create(TMemDesc* decodeMemoryDescriptor, AL_HANDLE hDec, AL_TPatchworker* patchworker, AL_CB_Error* errorCallback); 56 | void AL_DecoderFeeder_Destroy(AL_TDecoderFeeder* pDecFeeder); 57 | /* push a buffer in the queue. it will be fed to the decoder when possible */ 58 | void AL_DecoderFeeder_Process(AL_TDecoderFeeder* pDecFeeder); 59 | void AL_DecoderFeeder_Flush(AL_TDecoderFeeder* pDecFeeder); 60 | void AL_DecoderFeeder_Reset(AL_TDecoderFeeder* pDecFeeder); 61 | 62 | -------------------------------------------------------------------------------- /include/lib_common/VideoMode.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | /*************************************************************************//*! 41 | \brief Video Mode 42 | *****************************************************************************/ 43 | typedef enum AL_e_VideoMode 44 | { 45 | AL_VM_PROGRESSIVE = 0, /*!< Progressive */ 46 | AL_VM_INTERLACED_TOP = 1, /*!< interlaced top filed first */ 47 | AL_VM_INTERLACED_BOTTOM = 2, /*!< interlaced bottom field first */ 48 | AL_VM_MAX_ENUM 49 | }AL_EVideoMode; 50 | 51 | /*************************************************************************//*! 52 | \brief Sequence Mode 53 | *****************************************************************************/ 54 | typedef enum AL_e_SequenceMode 55 | { 56 | AL_SM_UNKNOWN, /*!< unknown */ 57 | AL_SM_PROGRESSIVE, /*!< progressive */ 58 | AL_SM_INTERLACED, /*!< interlaced */ 59 | AL_SM_MAX_ENUM, 60 | }AL_ESequenceMode; 61 | 62 | -------------------------------------------------------------------------------- /include/lib_fpga/DmaAlloc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /**************************************************************************//*! 39 | \addtogroup Allocator 40 | @{ 41 | \file 42 | *****************************************************************************/ 43 | #pragma once 44 | 45 | #include "lib_common/Allocator.h" 46 | 47 | /**************************************************************************//*! 48 | \brief Create an allocator supporting dma allocations 49 | Dma buffers are required for all the buffers used by the hardware ip. 50 | On a typical platform, use "/dev/allegroIP" for the encoder and 51 | "/dev/allegroDecodeIP" for the decoder 52 | \param[in] deviceFile the device file of the driver that provides 53 | the dma allocation facilities 54 | *****************************************************************************/ 55 | AL_TAllocator* AL_DmaAlloc_Create(const char* deviceFile); 56 | 57 | /*@}*/ 58 | 59 | -------------------------------------------------------------------------------- /lib_bitstream/SkippedPicture.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_rtos/types.h" 41 | 42 | /*****************************************************************************/ 43 | static const int PictureDisplayToFieldNumber[9] = 44 | { 45 | 2, 1, 1, 2, 2, 3, 3, 4, 6 46 | }; 47 | 48 | /*************************************************************************//*! 49 | \brief This structure is designed to store slice data information of 50 | skipped picture. 51 | \see GenerateSkippedPicture 52 | *****************************************************************************/ 53 | typedef struct AL_t_SkippedPicture 54 | { 55 | uint8_t* pBuffer; /*!< Array of bytes for storing precomputed skipped picture bitstream */ 56 | int iBufSize; /*!< Size (in byte of pBuffer */ 57 | 58 | int iNumBits; /*!< Number of bits used by the skipped picture */ 59 | int iNumBins; /*!< Number of bins used by the skipped picture */ 60 | }AL_TSkippedPicture; 61 | 62 | -------------------------------------------------------------------------------- /lib_encode/project.mk: -------------------------------------------------------------------------------- 1 | LIB_ENCODER_A=$(BIN)/liballegro_encode.a 2 | LIB_ENCODER_DLL=$(BIN)/liballegro_encode.so 3 | 4 | ifneq ($(findstring mingw,$(TARGET)),mingw) 5 | CFLAGS+=-fPIC 6 | endif 7 | 8 | LIB_ENCODE_SRC+=\ 9 | lib_encode/Com_Encoder.c\ 10 | lib_encode/HEVC_Encoder.c\ 11 | lib_encode/HEVC_Sections.c\ 12 | lib_encode/AVC_Encoder.c\ 13 | lib_encode/AVC_Sections.c\ 14 | lib_encode/Sections.c\ 15 | lib_encode/NalWriters.c\ 16 | lib_encode/IP_Utils.c\ 17 | lib_encode/IP_Stream.c\ 18 | lib_encode/lib_encoder.c\ 19 | lib_encode/SourceBufferChecker.c\ 20 | lib_encode/LoadLda.c\ 21 | lib_encode/JpegTables.c\ 22 | 23 | LIB_ISCHEDULER_ENC_A=$(BIN)/liballegro_encscheduler.a 24 | LIB_ISCHEDULER_ENC_DLL=$(BIN)/liballegro_encscheduler.so 25 | 26 | ISCHEDULER_SRC:=\ 27 | lib_encode/DriverDataConversions.c\ 28 | lib_encode/ISchedulerCommon.c\ 29 | lib_encode/IScheduler.c\ 30 | lib_encode/SchedulerMcu.c\ 31 | 32 | LIB_ISCHEDULER_ENC_SRC:=\ 33 | $(ISCHEDULER_SRC)\ 34 | $(LIB_RATECTRL_SRC)\ 35 | $(LIB_BUF_MNGT_SRC)\ 36 | $(LIB_SCHEDULER_SRC)\ 37 | $(LIB_SCHEDULER_ENC_SRC)\ 38 | $(LIB_BITSTREAM_SRC)\ 39 | 40 | # needed but user can modify these carefully 41 | #$(LIB_PERFS_SRC)\ 42 | #$(LIB_RTOS_SRC)\ 43 | #$(LIB_COMMON_SRC)\ 44 | #$(LIB_COMMON_ENC_SRC)\ 45 | 46 | LIB_ISCHEDULER_ENC_OBJ:=$(LIB_ISCHEDULER_ENC_SRC:%=$(BIN)/%.o) 47 | 48 | $(LIB_ISCHEDULER_ENC_DLL): $(LIB_ISCHEDULER_ENC_OBJ) 49 | 50 | $(LIB_ISCHEDULER_ENC_A): $(LIB_ISCHEDULER_ENC_OBJ) 51 | 52 | LIB_ENCODER_SRC:=\ 53 | $(LIB_FPGA_SRC)\ 54 | $(LIB_COMMON_SRC)\ 55 | $(LIB_COMMON_ENC_SRC)\ 56 | $(LIB_RTOS_SRC)\ 57 | $(LIB_ENCODE_SRC)\ 58 | $(LIB_PERFS_SRC)\ 59 | 60 | 61 | ifneq ($(ENABLE_TRACES),0) 62 | LIB_ENCODER_SRC+=\ 63 | $(LIB_TRACE_SRC_ENC) 64 | endif 65 | 66 | ifneq ($(ENABLE_STATIC),0) 67 | $(warning the lib_ischeduler will be compiled in instead of being compiled as a library) 68 | ENABLE_LIB_ISCHEDULER:=0 69 | endif 70 | 71 | ifneq ($(ENABLE_LIB_ISCHEDULER),0) 72 | LIB_ENCODER_OBJ+=$(LIB_ISCHEDULER_ENC_DLL) 73 | else 74 | LIB_ENCODER_OBJ+=$(LIB_ISCHEDULER_ENC_OBJ) 75 | endif 76 | 77 | LIB_ENCODER_OBJ+=$(LIB_ENCODER_SRC:%=$(BIN)/%.o) 78 | 79 | $(LIB_ENCODER_DLL): $(LIB_ENCODER_OBJ) 80 | 81 | $(LIB_ENCODER_A): $(LIB_ENCODER_OBJ) 82 | 83 | liballegro_encode: liballegro_encode_dll liballegro_encode_a 84 | 85 | liballegro_encode_dll: $(LIB_ENCODER_DLL) 86 | 87 | liballegro_encode_a: $(LIB_ENCODER_A) 88 | 89 | TARGETS+=liballegro_encode_dll 90 | 91 | UNITTEST+=$(shell find lib_encode/unittests -name "*.cpp") 92 | UNITTEST+=$(LIB_ENCODE_SRC) 93 | UNITTEST+=$(ISCHEDULER_SRC) 94 | UNITTEST+=$(LIB_SCHEDULER_SRC) 95 | UNITTEST+=$(LIB_SCHEDULER_ENC_SRC) 96 | UNITTEST+=$(LIB_COMMON_SRC) 97 | UNITTEST+=$(LIB_BITSTREAM_SRC) 98 | UNITTEST+=$(LIB_COMMON_ENC_SRC) 99 | UNITTEST+=$(LIB_RATECTRL_SRC) 100 | UNITTEST+=$(LIB_TRACE_SRC_ENC) 101 | 102 | .PHONY: liballegro_encode liballegro_encode_dll liballegro_encode_a 103 | -------------------------------------------------------------------------------- /lib_common/StreamBufferPrivate.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | #include "lib_common/Utils.h" 40 | 41 | static const uint16_t AL_PCM_SIZE[4][3] = 42 | { 43 | { 256, 1024, 4096 }, { 384, 1536, 6144 }, { 512, 2048, 8192 }, { 768, 3072, 12288 } 44 | }; 45 | 46 | #define AL_MAX_SLICE_HEADER_SIZE 512 47 | 48 | /****************************************************************************/ 49 | int GetMaxVclNalSize(AL_TDimension tDim, AL_EChromaMode eMode, int iBitDepth); 50 | 51 | /****************************************************************************/ 52 | int GetPcmVclNalSize(AL_TDimension tDim, AL_EChromaMode eMode, int iBitDepth); 53 | 54 | /****************************************************************************/ 55 | int GetBlk64x64(AL_TDimension tDim); 56 | 57 | /****************************************************************************/ 58 | int GetBlk32x32(AL_TDimension tDim); 59 | 60 | /****************************************************************************/ 61 | int GetBlk16x16(AL_TDimension tDim); 62 | 63 | -------------------------------------------------------------------------------- /lib_parsing/Aup.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "lib_common/SPS.h" 41 | #include "lib_common/PPS.h" 42 | 43 | #define AL_MAX_VPS 16 44 | 45 | typedef struct 46 | { 47 | // Context 48 | AL_THevcPps pPPS[AL_HEVC_MAX_PPS]; // Holds received PPSs. 49 | AL_THevcSps pSPS[AL_HEVC_MAX_SPS]; // Holds received SPSs. 50 | AL_THevcVps pVPS[AL_MAX_VPS]; // Holds received VPSs. 51 | AL_THevcSps* pActiveSPS; // Holds only the currently active SPS. 52 | 53 | AL_EPicStruct ePicStruct; 54 | int iRecoveryCnt; 55 | }AL_THevcAup; 56 | 57 | typedef struct 58 | { 59 | // Context 60 | AL_TAvcSps pSPS[AL_AVC_MAX_SPS]; // Holds all already received SPSs. 61 | AL_TAvcPps pPPS[AL_AVC_MAX_PPS]; // Holds all already received PPSs. 62 | AL_TAvcSps* pActiveSPS; // Holds only the currently active ParserSPS. 63 | 64 | AL_ESliceType ePictureType; 65 | int iRecoveryCnt; 66 | }AL_TAvcAup; 67 | 68 | typedef struct 69 | { 70 | union 71 | { 72 | AL_THevcAup hevcAup; 73 | AL_TAvcAup avcAup; 74 | }; 75 | }AL_TAup; 76 | 77 | -------------------------------------------------------------------------------- /exe_decoder/Conversion.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include 41 | 42 | extern "C" 43 | { 44 | #include "lib_common/BufferAPI.h" 45 | } 46 | 47 | /*************************************************************************//*! 48 | \brief Crop YUV Frame Buffer 49 | \param[out] pYUV Pointer to the frame buffer (IYUV planar format) that receives the converted frame 50 | \param[in] iSizePix Size of each samples in byte 51 | \param[in] uCropLeft Delta limit of the rectangular region at the left of the picture 52 | \param[in] uCropRight Delta limit of the rectangular region at the right of the picture 53 | \param[in] uCropTop Delta limit of the rectangular region at the top of the picture 54 | \param[in] uCropBottom Delta limit of the rectangular region at the bottom of the picture 55 | *****************************************************************************/ 56 | void CropFrame(AL_TBuffer* pYUV, int iSizePix, uint32_t uCropLeft, uint32_t uCropRight, uint32_t uCropTop, uint32_t uCropBottom); 57 | 58 | -------------------------------------------------------------------------------- /lib_common/BufferPictureMeta.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "lib_common/BufferPictureMeta.h" 39 | #include "lib_rtos/lib_rtos.h" 40 | #include 41 | 42 | static bool PictureMeta_Destroy(AL_TMetaData* pMeta) 43 | { 44 | AL_TPictureMetaData* pPictureMeta = (AL_TPictureMetaData*)pMeta; 45 | Rtos_Free(pPictureMeta); 46 | return true; 47 | } 48 | 49 | AL_TPictureMetaData* AL_PictureMetaData_Create() 50 | { 51 | AL_TPictureMetaData* pMeta; 52 | 53 | pMeta = Rtos_Malloc(sizeof(*pMeta)); 54 | 55 | if(!pMeta) 56 | return NULL; 57 | 58 | pMeta->tMeta.eType = AL_META_TYPE_PICTURE; 59 | pMeta->tMeta.MetaDestroy = PictureMeta_Destroy; 60 | 61 | pMeta->eType = SLICE_MAX_ENUM; 62 | 63 | return pMeta; 64 | } 65 | 66 | AL_TPictureMetaData* AL_PictureMetaData_Clone(AL_TPictureMetaData* pMeta) 67 | { 68 | if(!pMeta) 69 | return NULL; 70 | 71 | AL_TPictureMetaData* pPictureMeta = AL_PictureMetaData_Create(); 72 | 73 | if(!pPictureMeta) 74 | return NULL; 75 | pPictureMeta->eType = pMeta->eType; 76 | return pPictureMeta; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /lib_app/console_linux.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #include "console.h" 39 | 40 | #include 41 | #include 42 | 43 | static bool bUseColor; 44 | 45 | static 46 | int translateColor(EConColor col) 47 | { 48 | switch(col) 49 | { 50 | case CC_BLACK: return 30; 51 | case CC_RED: return 91; 52 | case CC_GREEN: return 92; 53 | case CC_YELLOW: return 93; 54 | case CC_BLUE: return 94; 55 | case CC_MAGENTA: return 95; 56 | case CC_CYAN: return 96; 57 | case CC_GREY: return 97; 58 | case CC_DARK_RED: return 31; 59 | case CC_DARK_GREEN: return 32; 60 | case CC_DARK_YELLOW: return 33; 61 | case CC_DARK_BLUE: return 34; 62 | case CC_DARK_MAGENTA: return 35; 63 | case CC_DARK_CYAN: return 36; 64 | case CC_DARK_GREY: return 30; 65 | case CC_WHITE: return 37; 66 | case CC_DEFAULT: 67 | default: return 39; 68 | } 69 | } 70 | 71 | void SetConsoleColor(EConColor eColor) 72 | { 73 | if(bUseColor) 74 | printf("\033[%dm", translateColor(eColor)); 75 | } 76 | 77 | void SetEnableColor(bool bColor) 78 | { 79 | bUseColor = bColor; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /lib_decode/NalUnitParser.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /**************************************************************************** 39 | ----------------------------------------------------------------------------- 40 | **************************************************************************//*! 41 | \addtogroup lib_decode_hls 42 | @{ 43 | \file 44 | *****************************************************************************/ 45 | #pragma once 46 | 47 | #include "lib_common/ScalingList.h" 48 | #include "lib_common/SPS.h" 49 | #include "lib_common/PPS.h" 50 | #include "lib_common/SliceHeader.h" 51 | 52 | #include "lib_parsing/I_PictMngr.h" 53 | #include "lib_parsing/AvcParser.h" 54 | #include "lib_parsing/HevcParser.h" 55 | 56 | typedef struct t_Dec_Ctx AL_TDecCtx; 57 | 58 | void UpdateContextAtEndOfFrame(AL_TDecCtx* pCtx); 59 | 60 | void AL_AVC_DecodeOneNAL(AL_TAup* pAUP, AL_TDecCtx* pCtx, AL_ENut eNUT, bool bIsLastAUNal, int* iNumSlice); 61 | void AL_HEVC_DecodeOneNAL(AL_TAup* pAUP, AL_TDecCtx* pCtx, AL_ENut eNUT, bool bIsLastAUNal, int* iNumSlice); 62 | 63 | /*@}*/ 64 | 65 | -------------------------------------------------------------------------------- /exe_encoder/project.mk: -------------------------------------------------------------------------------- 1 | THIS_EXE_ENCODER:=$(call get-my-dir) 2 | 3 | PARSER_SRCS:=\ 4 | $(THIS_EXE_ENCODER)/CfgParser.cpp\ 5 | $(THIS_EXE_ENCODER)/Parser.cpp\ 6 | $(THIS_EXE_ENCODER)/Tokenizer.cpp\ 7 | 8 | EXE_ENCODER_SRCS:=\ 9 | $(THIS_EXE_ENCODER)/CodecUtils.cpp\ 10 | $(THIS_EXE_ENCODER)/FileUtils.cpp\ 11 | $(THIS_EXE_ENCODER)/IpDevice.cpp\ 12 | $(THIS_EXE_ENCODER)/container.cpp\ 13 | $(THIS_EXE_ENCODER)/main.cpp\ 14 | $(THIS_EXE_ENCODER)/sink_bitstream_writer.cpp\ 15 | $(THIS_EXE_ENCODER)/sink_frame_writer.cpp\ 16 | $(THIS_EXE_ENCODER)/sink_md5.cpp\ 17 | $(THIS_EXE_ENCODER)/MD5.cpp\ 18 | $(THIS_EXE_ENCODER)/ROIMngr.cpp\ 19 | $(THIS_EXE_ENCODER)/EncCmdMngr.cpp\ 20 | $(THIS_EXE_ENCODER)/QPGenerator.cpp\ 21 | $(THIS_EXE_ENCODER)/CommandsSender.cpp\ 22 | $(PARSER_SRCS)\ 23 | $(LIB_CONV_SRC)\ 24 | $(LIB_APP_SRC)\ 25 | 26 | ifneq ($(ENABLE_TWOPASS),0) 27 | EXE_ENCODER_SRCS+=$(THIS_EXE_ENCODER)/TwoPassMngr.cpp 28 | endif 29 | 30 | -include $(THIS_EXE_ENCODER)/site.mk 31 | 32 | UNITTEST+=$(shell find $(THIS_EXE_ENCODER)/unittests -name "*.cpp") 33 | UNITTEST+=$(THIS_EXE_ENCODER)/ROIMngr.cpp 34 | UNITTEST+=$(THIS_EXE_ENCODER)/FileUtils.cpp 35 | UNITTEST+=$(THIS_EXE_ENCODER)/QPGenerator.cpp 36 | UNITTEST+=$(THIS_EXE_ENCODER)/EncCmdMngr.cpp 37 | UNITTEST+=$(PARSER_SRCS) 38 | 39 | EXE_ENCODER_OBJ:=$(EXE_ENCODER_SRCS:%=$(BIN)/%.o) 40 | 41 | ############################################################## 42 | # get svn revision for debug message 43 | ############################################################## 44 | SVNDEV:=-D'SVN_REV="$(shell svnversion -n . | grep -v Unversioned || echo 0)"' 45 | 46 | $(BIN)/$(THIS_EXE_ENCODER)/main.cpp.o: CFLAGS+=$(SVNDEV) 47 | 48 | $(BIN)/$(THIS_EXE_ENCODER)/main.cpp.o: INTROSPECT_FLAGS=-DAL_COMPIL_FLAGS='"$(CFLAGS)"' 49 | 50 | $(BIN)/$(THIS_EXE_ENCODER)/main.cpp.o: INTROSPECT_FLAGS+=-DHAS_COMPIL_FLAGS=1 51 | 52 | ifneq ($(ENABLE_INTROSPECTION),0) 53 | $(BIN)/$(THIS_EXE_ENCODER)/main.cpp.o: generated/Printer.h 54 | 55 | $(BIN)/$(THIS_EXE_ENCODER)/ParserMain.cpp.o: generated/Printer.h 56 | 57 | generated/Printer.h: 58 | @echo "Generate introspection files" 59 | ./scripts/allegro_introspection.sh 60 | endif 61 | 62 | $(BIN)/ctrlsw_encoder: $(EXE_ENCODER_OBJ) $(LIB_REFENC_A) $(LIB_ENCODER_A) 63 | 64 | TARGETS+=$(BIN)/ctrlsw_encoder 65 | 66 | ifndef ($(ENABLE_LIB_ISCHEDULER),0) 67 | $(BIN)/AL_Encoder.sh: $(BIN)/ctrlsw_encoder 68 | @echo "Generate script $@" 69 | $(shell echo 'LD_LIBRARY_PATH=$(BIN) $(BIN)/ctrlsw_encoder "$$@"' > $@ && chmod a+x $@) 70 | 71 | TARGETS+=$(BIN)/AL_Encoder.sh 72 | endif 73 | 74 | # for compilation time reduction (we don't need this to be optimized) 75 | $(BIN)/$(THIS_EXE_ENCODER)/CfgParser.cpp.o: CFLAGS+=-O0 76 | 77 | EXE_CFG_PARSER_SRCS:=\ 78 | $(THIS_EXE_ENCODER)/ParserMain.cpp \ 79 | $(PARSER_SRCS)\ 80 | 81 | EXE_CFG_PARSER_OBJ:=$(EXE_CFG_PARSER_SRCS:%=$(BIN)/%.o) 82 | 83 | $(BIN)/AL_CfgParser.exe: $(EXE_CFG_PARSER_OBJ) $(LIB_ENCODER_A) 84 | 85 | TARGETS+=$(BIN)/AL_CfgParser.exe 86 | 87 | $(BIN)/$(THIS_EXE_ENCODER)/unittests/commandsparser.cpp.o: CFLAGS+=-Wno-missing-field-initializers 88 | -------------------------------------------------------------------------------- /include/traces/Traces.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | /*************************************************************************//*! 39 | \addtogroup Traces 40 | @{ 41 | \file 42 | *****************************************************************************/ 43 | #pragma once 44 | 45 | /*************************************************************************//*! 46 | \brief Trace type enum 47 | *****************************************************************************/ 48 | typedef enum e_TraceType 49 | { 50 | PARSING_INPUT_TRACE = 0, 51 | DECODING_INPUT_TRACE = 1, 52 | PARSING_OUTPUT_TRACE = 2, 53 | DECODING_OUTPUT_TRACE = 3, 54 | }AL_ETraceType; 55 | 56 | /*************************************************************************//*! 57 | \brief Output trace mode 58 | *****************************************************************************/ 59 | typedef enum e_TraceMode 60 | { 61 | AL_TRACE_NONE = 0, 62 | AL_TRACE_ON_ERR = 1, 63 | AL_TRACE_LATEST = 2, 64 | AL_TRACE_ALL = 3, 65 | AL_TRACE_FRAME = 4, 66 | AL_TRACE_STATUS = 5, 67 | }AL_ETraceMode; 68 | 69 | /*@}*/ 70 | 71 | -------------------------------------------------------------------------------- /lib_bitstream/IRbspWriter.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2018 Allegro DVT2. All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * Use of the Software is limited solely to applications: 16 | * (a) running on a Xilinx device, or 17 | * (b) that interact with a Xilinx device through a bus or interconnect. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | * XILINX OR ALLEGRO DVT2 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in 29 | * this Software without prior written authorization from Xilinx. 30 | * 31 | * 32 | * Except as contained in this notice, the name of Allegro DVT2 shall not be used 33 | * in advertising or otherwise to promote the sale, use or other dealings in 34 | * this Software without prior written authorization from Allegro DVT2. 35 | * 36 | ******************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #include "BitStreamLite.h" 41 | #include "lib_common/SPS.h" 42 | #include "lib_common/PPS.h" 43 | 44 | typedef struct rbspWriter 45 | { 46 | void (* WriteAUD)(AL_TBitStreamLite* writer, int primary_pic_type); 47 | void (* WriteVPS)(AL_TBitStreamLite* writer, AL_THevcVps const* pVps); 48 | void (* WriteSPS)(AL_TBitStreamLite* writer, AL_TSps const* pSps); 49 | void (* WritePPS)(AL_TBitStreamLite* writer, AL_TPps const* pPps); 50 | void (* WriteSEI_ActiveParameterSets)(AL_TBitStreamLite* writer, AL_THevcVps const* pVps, AL_TSps const* pISps); 51 | void (* WriteSEI_BufferingPeriod)(AL_TBitStreamLite* writer, AL_TSps const* pISps, int iInitialCpbRemovalDelay, int iInitialCpbRemovalOffset); 52 | void (* WriteSEI_RecoveryPoint)(AL_TBitStreamLite* writer, int iRecoveryFrameCount); 53 | void (* WriteSEI_PictureTiming)(AL_TBitStreamLite* writer, AL_TSps const* pISps, int iAuCpbRemovalDelay, int iPicDpbOutputDelay, int iPicStruct); 54 | void (* WriteSEI_UserDataUnregistered)(AL_TBitStreamLite* writer, uint8_t uuid[16]); 55 | }IRbspWriter; 56 | 57 | --------------------------------------------------------------------------------