Skip to content

Commit

Permalink
Stanalone native lib build CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
widgetii committed Feb 5, 2020
0 parents commit 0a30abd
Show file tree
Hide file tree
Showing 98 changed files with 49,580 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Release
*.la
*.o
99 changes: 99 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
cmake_minimum_required(VERSION 3.16)

project(debug_h265)

include(CMakePackageConfigHelpers)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

include_directories(libde265)
include_directories(.)

set (libde265_sources
alloc_pool.cc
bitstream.cc
cabac.cc
configparam.cc
contextmodel.cc
de265.cc
deblock.cc
decctx.cc
dpb.cc
# en265.cc
fallback-dct.cc
fallback-motion.cc
fallback.cc
image-io.cc
image.cc
intrapred.cc
md5.cc
motion.cc
nal-parser.cc
nal.cc
pps.cc
quality.cc
refpic.cc
sao.cc
scan.cc
sei.cc
slice.cc
sps.cc
threads.cc
transform.cc
util.cc
visualize.cc
vps.cc
vui.cc
)

set (libde265_headers
acceleration.h
alloc_pool.h
bitstream.h
cabac.h
configparam.h
deblock.h
decctx.h
dpb.h
en265.h
fallback-dct.h
fallback-motion.h
fallback.h
image-io.h
image.h
intrapred.h
md5.h
motion.h
nal-parser.h
nal.h
pps.h
quality.h
refpic.h
sao.h
scan.h
sei.h
slice.h
sps.h
threads.h
transform.h
util.h
visualize.h
vps.h
vui.h
)


add_definitions(-DLIBDE265_EXPORTS)

#add_subdirectory (encoder)

if(SUPPORTS_SSE4_1)
add_definitions(-DHAVE_SSE4_1)
add_subdirectory (x86)
endif()

add_library(${PROJECT_NAME} STATIC ${libde265_sources} ${ENCODER_OBJECTS} ${X86_OBJECTS})
find_package(Threads)
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
100 changes: 100 additions & 0 deletions alloc_pool.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* H.265 video codec.
* Copyright (c) 2014 struktur AG, Dirk Farin <[email protected]>
*
* Authors: Dirk Farin <[email protected]>
*
* This file is part of libde265.
*
* libde265 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* libde265 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libde265. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdint.h>
#include "libde265/alloc_pool.h"
#include "libde265/util.h"
#include <assert.h>
#include <stdio.h>

#define DEBUG_MEMORY 1


alloc_pool::alloc_pool(size_t objSize, int poolSize, bool grow)
: mObjSize(objSize),
mPoolSize(poolSize),
mGrow(grow)
{
m_freeList.reserve(poolSize);
m_memBlocks.reserve(8);

add_memory_block();
}


void alloc_pool::add_memory_block()
{
uint8_t* p = new uint8_t[mObjSize * mPoolSize];
m_memBlocks.push_back(p);

for (int i=0;i<mPoolSize;i++)
{
m_freeList.push_back(p + (mPoolSize-1-i) * mObjSize);
}
}

alloc_pool::~alloc_pool()
{
FOR_LOOP(uint8_t*, p, m_memBlocks) {
delete[] p;
}
}


void* alloc_pool::new_obj(const size_t size)
{
if (size != mObjSize) {
return ::operator new(size);
}

if (m_freeList.size()==0) {
if (mGrow) {
add_memory_block();
if (DEBUG_MEMORY) { fprintf(stderr,"additional block allocated in memory pool\n"); }
}
else {
return NULL;
}
}

assert(!m_freeList.empty());

void* p = m_freeList.back();
m_freeList.pop_back();

return p;
}


void alloc_pool::delete_obj(void* obj)
{
int memBlockSize = mObjSize * mPoolSize;

FOR_LOOP(uint8_t*, memBlk, m_memBlocks) {
if (memBlk <= obj && obj < memBlk + memBlockSize) {
m_freeList.push_back(obj);
return;
}
}

::operator delete(obj);
}
1 change: 1 addition & 0 deletions arm/.deps/libde265_arm_la-arm.Plo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy
1 change: 1 addition & 0 deletions arm/.deps/libde265_arm_neon_la-asm.Plo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy
1 change: 1 addition & 0 deletions arm/.deps/libde265_arm_neon_la-cpudetect.Plo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy
1 change: 1 addition & 0 deletions arm/.deps/libde265_arm_neon_la-hevcdsp_qpel_neon.Plo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy
1 change: 1 addition & 0 deletions arm/.deps/libde265_arm_neon_la-neon.Plo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy
Loading

0 comments on commit 0a30abd

Please sign in to comment.