Merge pull request #1547 from Mixaill/libtheora-refactor

[libtheora] update to master, refactor
This commit is contained in:
Alexander Karatarakis 2017-08-10 13:44:15 -07:00 committed by GitHub
commit 530761c2e7
5 changed files with 210 additions and 62 deletions

View File

@ -0,0 +1,53 @@
From 47eb8d07a8caaa6cc1e6e906a7cd5b44ee0fb624 Mon Sep 17 00:00:00 2001
From: Mikhail Paulyshka <me@mixaill.tk>
Date: Thu, 27 Jul 2017 04:24:36 +0300
Subject: [PATCH] remove redundant assignments
---
lib/tokenize.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/tokenize.c b/lib/tokenize.c
index 57b7aa8..3f53fb5 100644
--- a/lib/tokenize.c
+++ b/lib/tokenize.c
@@ -487,11 +487,11 @@ int oc_enc_tokenize_ac(oc_enc_ctx *_enc,int _pli,ptrdiff_t _fragi,
zzj=64;
for(zzi=OC_MINI(_zzi,63);zzi>0;zzi--){
ogg_uint32_t best_cost;
- int best_bits=best_bits;
- int best_next=best_next;
- int best_token=best_token;
- int best_eb=best_eb;
- int best_qc=best_qc;
+ int best_bits;
+ int best_next;
+ int best_token;
+ int best_eb;
+ int best_qc;
ogg_uint32_t d2;
int dq;
int qc_m;
@@ -1091,8 +1091,8 @@ void oc_enc_tokenize_dc_frag_list(oc_enc_ctx *_enc,int _pli,
int neobs1;
int token;
int eb;
- int token1=token1;
- int eb1=eb1;
+ int token1;
+ int eb1;
/*Return immediately if there are no coded fragments; otherwise we'd flush
any trailing EOB run into the AC 1 list and never read it back out.*/
if(_ncoded_fragis<=0)return;
@@ -1328,7 +1328,7 @@ void oc_enc_tokenize_finish(oc_enc_ctx *_enc){
int new_eb;
int zzj;
int plj;
- ptrdiff_t ti=ti;
+ ptrdiff_t ti;
int run_count;
/*Make sure this coefficient has tokens at all.*/
if(_enc->ndct_tokens[pli][zzi]<=0)continue;
--
2.12.2.windows.2

View File

@ -1,67 +1,91 @@
project(theora)
cmake_minimum_required(VERSION 3.0)
project(theora LANGUAGES C)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
FIND_PACKAGE(OGG REQUIRED)
file(GLOB HEADERS
"include/theora/codec.h"
"include/theora/theora.h"
"include/theora/theoradec.h"
"include/theora/codec.h"
"include/theora/theora.h"
"include/theora/theoradec.h"
"include/theora/theoraenc.h"
)
include_directories("include")
include_directories(${OGG_INCLUDE_DIR})
file(GLOB SOURCES
"lib/analyze.c"
"lib/encapiwrapper.c"
"lib/encfrag.c"
"lib/encinfo.c"
"lib/encode.c"
#"lib/encoder_disabled.c"
"lib/enquant.c"
"lib/fdct.c"
"lib/huffenc.c"
"lib/mathops.c"
"lib/mcenc.c"
"lib/rate.c"
"lib/tokenize.c"
"lib/x86_vc/mmxencfrag.c"
"lib/x86_vc/mmxfdct.c"
"lib/x86_vc/x86cpu.c"
"lib/x86_vc/x86enc.c"
"lib/apiwrapper.c"
"lib/bitpack.c"
"lib/decapiwrapper.c"
"lib/decinfo.c"
"lib/decode.c"
"lib/dequant.c"
"lib/fragment.c"
"lib/huffdec.c"
"lib/idct.c"
"lib/info.c"
"lib/internal.c"
"lib/quant.c"
"lib/state.c"
"lib/x86_vc/mmxfrag.c"
"lib/x86_vc/mmxidct.c"
"lib/x86_vc/mmxstate.c"
"lib/x86_vc/x86state.c"
"win32/xmingw32/libtheoradec-all.def"
set(LIBTHEORA_COMMON
"lib/apiwrapper.c"
"lib/bitpack.c"
"lib/dequant.c"
"lib/fragment.c"
"lib/idct.c"
"lib/info.c"
"lib/internal.c"
"lib/state.c"
"lib/quant.c"
"lib/x86_vc/mmxfrag.c"
"lib/x86_vc/mmxidct.c"
"lib/x86_vc/mmxstate.c"
"lib/x86_vc/x86cpu.c"
"lib/x86_vc/x86state.c"
)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_BIND_TO_CURRENT_CRT_VERSION)
if (${BUILD_SHARED_LIBS})
add_definitions(-DLIBTHEORA_EXPORTS)
set(LIBTHEORA_ENC
"lib/analyze.c"
"lib/encapiwrapper.c"
"lib/encfrag.c"
"lib/encinfo.c"
"lib/encode.c"
"lib/enquant.c"
"lib/fdct.c"
"lib/huffenc.c"
"lib/mathops.c"
"lib/mcenc.c"
"lib/rate.c"
"lib/tokenize.c"
"lib/x86_vc/mmxencfrag.c"
"lib/x86_vc/mmxfdct.c"
"lib/x86_vc/x86enc.c"
)
set(LIBTHEORA_DEC
"lib/decapiwrapper.c"
"lib/decinfo.c"
"lib/decode.c"
"lib/huffdec.c"
)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
option(USE_X86 "Use x86 optimization" OFF)
if(USE_X86)
add_definitions(-DOC_X86_ASM)
endif()
add_library(theora ${SOURCES} ${HEADERS})
if (${BUILD_SHARED_LIBS})
add_definitions(-DLIBTHEORA_EXPORTS)
endif()
add_library(theora-common OBJECT ${LIBTHEORA_COMMON} ${HEADERS})
add_library(theora-enc OBJECT ${LIBTHEORA_ENC} ${HEADERS})
add_library(theora-dec OBJECT ${LIBTHEORA_DEC} ${HEADERS})
add_library(theora $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> $<TARGET_OBJECTS:theora-dec> "libtheora.def")
target_link_libraries(theora ${OGG_LIBRARY})
add_library(theoraenc $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> "win32/xmingw32/libtheoraenc-all.def")
target_link_libraries(theoraenc ${OGG_LIBRARY})
add_library(theoradec $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-dec> "win32/xmingw32/libtheoradec-all.def")
target_link_libraries(theoradec ${OGG_LIBRARY})
install(FILES ${HEADERS} DESTINATION include/theora)
install(TARGETS theora
install(TARGETS theora theoraenc theoradec
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
ARCHIVE DESTINATION lib

View File

@ -1,4 +1,4 @@
Source: libtheora
Version: 1.1.1
Version: 1.2.0alpha1-20170719~vcpkg1
Description: Theora is a free and open video compression format from the Xiph.org Foundation.
Build-Depends: libogg

View File

@ -0,0 +1,61 @@
EXPORTS
; Old alpha API
theora_version_string
theora_version_number
theora_decode_header
theora_decode_init
theora_decode_packetin
theora_decode_YUVout
theora_control
theora_packet_isheader
theora_packet_iskeyframe
theora_granule_shift
theora_granule_frame
theora_granule_time
theora_info_init
theora_info_clear
theora_clear
theora_comment_init
theora_comment_add
theora_comment_add_tag
theora_comment_query
theora_comment_query_count
theora_comment_clear
; New theora-exp API
th_version_string
th_version_number
th_decode_headerin
th_decode_alloc
th_setup_free
th_decode_ctl
th_decode_packetin
th_decode_ycbcr_out
th_decode_free
th_packet_isheader
th_packet_iskeyframe
th_granule_frame
th_granule_time
th_info_init
th_info_clear
th_comment_init
th_comment_add
th_comment_add_tag
th_comment_query
th_comment_query_count
th_comment_clear
; Old alpha API
theora_encode_init
theora_encode_YUVin
theora_encode_packetout
theora_encode_header
theora_encode_comment
theora_encode_tables
; New theora-exp API
th_encode_alloc
th_encode_ctl
th_encode_flushheader
th_encode_ycbcr_in
th_encode_packetout
th_encode_free
TH_VP31_QUANT_INFO
TH_VP31_HUFF_CODES

View File

@ -1,31 +1,41 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libtheora-1.1.1)
vcpkg_download_distfile(ARCHIVE
URLS "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
FILENAME "libtheora-1.1.1.tar.bz2"
SHA512 9ab9b3af1c35d16a7d6d84f61f59ef3180132e30c27bdd7c0fa2683e0d00e2c791accbc7fd2c90718cc947d8bd10ee4a5940fb55f90f1fd7b0ed30583a47dbbd
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xiph/theora
REF fa5707d68c2a4338d58aa8b6afc95539ba89fecb
SHA512 e33da23a17e93709dfe4421b512cedbd9aab0d706f5650e0436f9c8e1cde76b902c3338d46750bb86d83e1bceb111ee84e90df36fb59b5c2e7f7aee1610752b2
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp.patch
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/libtheora.def DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindOGG.cmake DESTINATION ${SOURCE_PATH})
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(THEORA_X86_OPT ON)
else()
set(THEORA_X86_OPT OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DUSE_X86=${THEORA_X86_OPT}
)
vcpkg_build_cmake()
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libtheora)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libtheora/LICENSE ${CURRENT_PACKAGES_DIR}/share/libtheora/copyright)