forked from bartvdbraak/blender
Merged changes in the trunk up to revision 48227.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/editors/space_file/filelist.c
This commit is contained in:
commit
1f7ae143a2
@ -159,7 +159,7 @@ unset(PLATFORM_DEFAULT)
|
|||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
||||||
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
||||||
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
|
option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
|
||||||
|
|
||||||
# freebsd doesn't seems to support XDND
|
# freebsd doesn't seems to support XDND
|
||||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
@ -167,9 +167,20 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# not an option for other OS's
|
# not an option for other OS's
|
||||||
set(WITH_BUILTIN_GLEW ON)
|
set(WITH_SYSTEM_GLEW OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# (unix defaults to System OpenJPEG On)
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
set(PLATFORM_DEFAULT ON)
|
||||||
|
else()
|
||||||
|
set(PLATFORM_DEFAULT OFF)
|
||||||
|
endif()
|
||||||
|
option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" ${PLATFORM_DEFAULT})
|
||||||
|
unset(PLATFORM_DEFAULT)
|
||||||
|
|
||||||
|
|
||||||
# Modifiers
|
# Modifiers
|
||||||
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
|
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
|
||||||
option(WITH_MOD_SMOKE "Enable Smoke Modifier (Smoke Simulation)" ON)
|
option(WITH_MOD_SMOKE "Enable Smoke Modifier (Smoke Simulation)" ON)
|
||||||
@ -1485,10 +1496,11 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
if(WITH_IMAGE_OPENJPEG)
|
if(WITH_IMAGE_OPENJPEG)
|
||||||
if(UNIX AND NOT APPLE)
|
if(WITH_SYSTEM_OPENJPEG)
|
||||||
# dealt with above
|
# dealt with above
|
||||||
else()
|
else()
|
||||||
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
|
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
|
||||||
|
add_definitions(-DOPJ_STATIC)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -1539,20 +1551,20 @@ endif()
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Configure GLEW
|
# Configure GLEW
|
||||||
|
|
||||||
if(WITH_BUILTIN_GLEW)
|
if(WITH_SYSTEM_GLEW)
|
||||||
# set(GLEW_LIBRARY "") # unused
|
|
||||||
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
|
|
||||||
else()
|
|
||||||
find_package(GLEW)
|
find_package(GLEW)
|
||||||
|
|
||||||
if(NOT GLEW_FOUND)
|
if(NOT GLEW_FOUND)
|
||||||
message(FATAL_ERROR "GLEW is required to build blender, install it or use WITH_BUILTIN_GLEW")
|
message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
GLEW_LIBRARY
|
GLEW_LIBRARY
|
||||||
GLEW_INCLUDE_PATH
|
GLEW_INCLUDE_PATH
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
# set(GLEW_LIBRARY "") # unused
|
||||||
|
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@ -1790,8 +1802,9 @@ if(FIRST_RUN)
|
|||||||
info_cfg_option(WITH_INSTALL_PORTABLE)
|
info_cfg_option(WITH_INSTALL_PORTABLE)
|
||||||
info_cfg_option(WITH_X11_XF86VMODE)
|
info_cfg_option(WITH_X11_XF86VMODE)
|
||||||
info_cfg_option(WITH_X11_XINPUT)
|
info_cfg_option(WITH_X11_XINPUT)
|
||||||
info_cfg_option(WITH_BUILTIN_GLEW)
|
|
||||||
info_cfg_option(WITH_MEM_JEMALLOC)
|
info_cfg_option(WITH_MEM_JEMALLOC)
|
||||||
|
info_cfg_option(WITH_SYSTEM_GLEW)
|
||||||
|
info_cfg_option(WITH_SYSTEM_OPENJPEG)
|
||||||
|
|
||||||
info_cfg_text("Image Formats:")
|
info_cfg_text("Image Formats:")
|
||||||
info_cfg_option(WITH_IMAGE_CINEON)
|
info_cfg_option(WITH_IMAGE_CINEON)
|
||||||
|
@ -240,6 +240,7 @@ print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBU
|
|||||||
if 'blenderlite' in B.targets:
|
if 'blenderlite' in B.targets:
|
||||||
target_env_defs = {}
|
target_env_defs = {}
|
||||||
target_env_defs['WITH_BF_GAMEENGINE'] = False
|
target_env_defs['WITH_BF_GAMEENGINE'] = False
|
||||||
|
target_env_defs['WITH_BF_CYCLES'] = False
|
||||||
target_env_defs['WITH_BF_OPENAL'] = False
|
target_env_defs['WITH_BF_OPENAL'] = False
|
||||||
target_env_defs['WITH_BF_OPENEXR'] = False
|
target_env_defs['WITH_BF_OPENEXR'] = False
|
||||||
target_env_defs['WITH_BF_OPENMP'] = False
|
target_env_defs['WITH_BF_OPENMP'] = False
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
|
set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
|
||||||
|
set(WITH_SYSTEM_GLEW ON CACHE FORCE BOOL)
|
||||||
|
|
||||||
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
|
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
|
||||||
set(WITH_BUILTIN_GLEW OFF CACHE FORCE BOOL)
|
|
||||||
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
||||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||||
|
@ -193,7 +193,7 @@ macro(SETUP_LIBDIRS)
|
|||||||
if(WITH_OPENIMAGEIO)
|
if(WITH_OPENIMAGEIO)
|
||||||
link_directories(${OPENIMAGEIO_LIBPATH})
|
link_directories(${OPENIMAGEIO_LIBPATH})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
|
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
|
||||||
link_directories(${OPENJPEG_LIBPATH})
|
link_directories(${OPENJPEG_LIBPATH})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CODEC_QUICKTIME)
|
if(WITH_CODEC_QUICKTIME)
|
||||||
@ -253,7 +253,7 @@ macro(setup_liblinks
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WITH_BUILTIN_GLEW)
|
if(WITH_SYSTEM_GLEW)
|
||||||
target_link_libraries(${target} ${GLEW_LIBRARY})
|
target_link_libraries(${target} ${GLEW_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ macro(setup_liblinks
|
|||||||
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
|
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
|
||||||
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
|
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
|
@ -181,7 +181,7 @@ CXX = 'g++'
|
|||||||
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||||
CXXFLAGS = []
|
CXXFLAGS = []
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC']
|
CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
|
||||||
REL_CFLAGS = []
|
REL_CFLAGS = []
|
||||||
REL_CXXFLAGS = []
|
REL_CXXFLAGS = []
|
||||||
REL_CCFLAGS = ['-DNDEBUG', '-O2']
|
REL_CCFLAGS = ['-DNDEBUG', '-O2']
|
||||||
|
@ -188,7 +188,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
|
|||||||
|
|
||||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
|
||||||
REL_CFLAGS = []
|
REL_CFLAGS = []
|
||||||
REL_CXXFLAGS = []
|
REL_CXXFLAGS = []
|
||||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||||
|
@ -179,7 +179,7 @@ CXX = 'g++'
|
|||||||
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||||
CXXFLAGS = [ '-fpermissive' ]
|
CXXFLAGS = [ '-fpermissive' ]
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC']
|
CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
|
||||||
REL_CFLAGS = []
|
REL_CFLAGS = []
|
||||||
REL_CXXFLAGS = []
|
REL_CXXFLAGS = []
|
||||||
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-ftree-vectorize']
|
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-ftree-vectorize']
|
||||||
|
@ -186,7 +186,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
|
|||||||
|
|
||||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
|
||||||
REL_CFLAGS = []
|
REL_CFLAGS = []
|
||||||
REL_CXXFLAGS = []
|
REL_CXXFLAGS = []
|
||||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||||
|
@ -15,4 +15,3 @@ you would pass {'active_object': object}.
|
|||||||
import bpy
|
import bpy
|
||||||
override = {'selected_bases': list(bpy.context.scene.object_bases)}
|
override = {'selected_bases': list(bpy.context.scene.object_bases)}
|
||||||
bpy.ops.object.delete(override)
|
bpy.ops.object.delete(override)
|
||||||
|
|
||||||
|
@ -15,4 +15,3 @@ for window in bpy.context.window_manager.windows:
|
|||||||
override = {'window': window, 'screen': screen, 'area': area}
|
override = {'window': window, 'screen': screen, 'area': area}
|
||||||
bpy.ops.screen.screen_full_area(override)
|
bpy.ops.screen.screen_full_area(override)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Basic Object Operations Example
|
Basic Object Operations Example
|
||||||
+++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++
|
||||||
This script demonstrates basic operations on object like creating new
|
This script demonstrates basic operations on object like creating new
|
||||||
object, placing it into scene, selecting it and making it active
|
object, placing it into scene, selecting it and making it active.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@ -11,15 +11,15 @@ from mathutils import Matrix
|
|||||||
scene = bpy.context.scene
|
scene = bpy.context.scene
|
||||||
|
|
||||||
# Create new lamp datablock
|
# Create new lamp datablock
|
||||||
lamp_data = bpy.data.lamps.new(name="New Lamp", type="POINT")
|
lamp_data = bpy.data.lamps.new(name="New Lamp", type='POINT')
|
||||||
|
|
||||||
# Create new object with out lamp datablock
|
# Create new object with our lamp datablock
|
||||||
lamp_object = bpy.data.objects.new(name="New Lamp", object_data=lamp_data)
|
lamp_object = bpy.data.objects.new(name="New Lamp", object_data=lamp_data)
|
||||||
|
|
||||||
# Link lamp object to the scene so it'll appear in this scene
|
# Link lamp object to the scene so it'll appear in this scene
|
||||||
scene.objects.link(lamp_object)
|
scene.objects.link(lamp_object)
|
||||||
|
|
||||||
# Place lamp to specified location
|
# Place lamp to a specified location
|
||||||
lamp_object.location = (5.0, 5.0, 5.0)
|
lamp_object.location = (5.0, 5.0, 5.0)
|
||||||
|
|
||||||
# And finally select it make active
|
# And finally select it make active
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Simple Object Panel
|
Simple Object Panel
|
||||||
+++++++++++++++++++
|
+++++++++++++++++++
|
||||||
This panel has a :class:`Panel.poll` and :class:`Panel.draw_header` function,
|
This panel has a :class:`Panel.poll` and :class:`Panel.draw_header` function,
|
||||||
even though the contents is basic this closely resemples blenders panels.
|
even though the contents is basic this closely resembles blenders panels.
|
||||||
"""
|
"""
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
@ -40,7 +40,7 @@ if(WITH_BINRELOC)
|
|||||||
add_subdirectory(binreloc)
|
add_subdirectory(binreloc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_BUILTIN_GLEW)
|
if(NOT WITH_SYSTEM_GLEW)
|
||||||
add_subdirectory(glew)
|
add_subdirectory(glew)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ if(WITH_GAMEENGINE)
|
|||||||
add_subdirectory(recastnavigation)
|
add_subdirectory(recastnavigation)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_IMAGE_OPENJPEG AND (NOT UNIX OR APPLE))
|
if(WITH_IMAGE_OPENJPEG AND (NOT WITH_SYSTEM_OPENJPEG))
|
||||||
add_subdirectory(libopenjpeg)
|
add_subdirectory(libopenjpeg)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
8
extern/libopenjpeg/CMakeLists.txt
vendored
8
extern/libopenjpeg/CMakeLists.txt
vendored
@ -54,6 +54,11 @@ set(SRC
|
|||||||
t2.c
|
t2.c
|
||||||
tcd.c
|
tcd.c
|
||||||
tgt.c
|
tgt.c
|
||||||
|
cidx_manager.c
|
||||||
|
phix_manager.c
|
||||||
|
ppix_manager.c
|
||||||
|
thix_manager.c
|
||||||
|
tpix_manager.c
|
||||||
|
|
||||||
bio.h
|
bio.h
|
||||||
cio.h
|
cio.h
|
||||||
@ -78,6 +83,9 @@ set(SRC
|
|||||||
t2.h
|
t2.h
|
||||||
tcd.h
|
tcd.h
|
||||||
tgt.h
|
tgt.h
|
||||||
|
cidx_manager.h
|
||||||
|
indexbox_manager.h
|
||||||
|
opj_config.h
|
||||||
)
|
)
|
||||||
|
|
||||||
blender_add_lib(extern_openjpeg "${SRC}" "${INC}" "${INC_SYS}")
|
blender_add_lib(extern_openjpeg "${SRC}" "${INC}" "${INC_SYS}")
|
||||||
|
213
extern/libopenjpeg/cidx_manager.c
vendored
Normal file
213
extern/libopenjpeg/cidx_manager.c
vendored
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
* $Id: cidx_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "opj_includes.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write CPTR Codestream finder box
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] clen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
*/
|
||||||
|
void write_cptr(int coff, int clen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write main header index table (box)
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of mainmhix box
|
||||||
|
*/
|
||||||
|
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if EPH option is used
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] markers marker information
|
||||||
|
* @param[in] marknum number of markers
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return true if EPH is used
|
||||||
|
*/
|
||||||
|
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen)
|
||||||
|
{
|
||||||
|
int len, i, lenp;
|
||||||
|
opj_jp2_box_t *box;
|
||||||
|
int num_box = 0;
|
||||||
|
opj_bool EPHused;
|
||||||
|
(void)image; /* unused ? */
|
||||||
|
|
||||||
|
lenp = -1;
|
||||||
|
box = (opj_jp2_box_t *)opj_calloc( 32, sizeof(opj_jp2_box_t));
|
||||||
|
|
||||||
|
for (i=0;i<2;i++){
|
||||||
|
|
||||||
|
if(i)
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_CIDX, 4); /* CIDX */
|
||||||
|
write_cptr( offset, cstr_info.codestream_size, cio);
|
||||||
|
|
||||||
|
write_manf( i, num_box, box, cio);
|
||||||
|
|
||||||
|
num_box = 0;
|
||||||
|
box[num_box].length = write_mainmhix( offset, cstr_info, cio);
|
||||||
|
box[num_box].type = JPIP_MHIX;
|
||||||
|
num_box++;
|
||||||
|
|
||||||
|
box[num_box].length = write_tpix( offset, cstr_info, j2klen, cio);
|
||||||
|
box[num_box].type = JPIP_TPIX;
|
||||||
|
num_box++;
|
||||||
|
|
||||||
|
box[num_box].length = write_thix( offset, cstr_info, cio);
|
||||||
|
box[num_box].type = JPIP_THIX;
|
||||||
|
num_box++;
|
||||||
|
|
||||||
|
EPHused = check_EPHuse( offset, cstr_info.marker, cstr_info.marknum, cio);
|
||||||
|
|
||||||
|
box[num_box].length = write_ppix( offset, cstr_info, EPHused, j2klen, cio);
|
||||||
|
box[num_box].type = JPIP_PPIX;
|
||||||
|
num_box++;
|
||||||
|
|
||||||
|
box[num_box].length = write_phix( offset, cstr_info, EPHused, j2klen, cio);
|
||||||
|
box[num_box].type = JPIP_PHIX;
|
||||||
|
num_box++;
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_free( box);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_cptr(int coff, int clen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_CPTR, 4); /* T */
|
||||||
|
cio_write( cio, 0, 2); /* DR A PRECISER !! */
|
||||||
|
cio_write( cio, 0, 2); /* CONT */
|
||||||
|
cio_write( cio, coff, 8); /* COFF A PRECISER !! */
|
||||||
|
cio_write( cio, clen, 8); /* CLEN */
|
||||||
|
len = cio_tell( cio) - lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_MANF,4); /* T */
|
||||||
|
|
||||||
|
if (second){ /* Write only during the second pass */
|
||||||
|
for( i=0; i<v; i++){
|
||||||
|
cio_write( cio, box[i].length, 4); /* Box length */
|
||||||
|
cio_write( cio, box[i].type, 4); /* Box type */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio) - lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_MHIX, 4); /* MHIX */
|
||||||
|
|
||||||
|
cio_write( cio, cstr_info.main_head_end-cstr_info.main_head_start+1, 8); /* TLEN */
|
||||||
|
|
||||||
|
for(i = 1; i < cstr_info.marknum; i++){ /* Marker restricted to 1 apparition, skip SOC marker */
|
||||||
|
cio_write( cio, cstr_info.marker[i].type, 2);
|
||||||
|
cio_write( cio, 0, 2);
|
||||||
|
cio_write( cio, cstr_info.marker[i].pos-coff, 8);
|
||||||
|
cio_write( cio, cstr_info.marker[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio) - lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
opj_bool EPHused = OPJ_FALSE;
|
||||||
|
int i=0;
|
||||||
|
int org_pos;
|
||||||
|
unsigned int Scod;
|
||||||
|
|
||||||
|
for(i = 0; i < marknum; i++){
|
||||||
|
if( markers[i].type == J2K_MS_COD){
|
||||||
|
org_pos = cio_tell( cio);
|
||||||
|
cio_seek( cio, coff+markers[i].pos+2);
|
||||||
|
|
||||||
|
Scod = cio_read( cio, 1);
|
||||||
|
if( ((Scod >> 2) & 1))
|
||||||
|
EPHused = OPJ_TRUE;
|
||||||
|
cio_seek( cio, org_pos);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EPHused;
|
||||||
|
}
|
56
extern/libopenjpeg/cidx_manager.h
vendored
Normal file
56
extern/libopenjpeg/cidx_manager.h
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* $Id: cidx_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.h from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CIDX_MANAGER_H_
|
||||||
|
# define CIDX_MANAGER_H_
|
||||||
|
|
||||||
|
#include "openjpeg.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write Codestream index box (superbox)
|
||||||
|
*
|
||||||
|
* @param[in] offset offset of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @param[in] image image data
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @return length of cidx box
|
||||||
|
*/
|
||||||
|
int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !CIDX_MANAGER_H_ */
|
8
extern/libopenjpeg/cio.c
vendored
8
extern/libopenjpeg/cio.c
vendored
@ -126,13 +126,13 @@ unsigned char *cio_getbp(opj_cio_t *cio) {
|
|||||||
/*
|
/*
|
||||||
* Write a byte.
|
* Write a byte.
|
||||||
*/
|
*/
|
||||||
bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
opj_bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
||||||
if (cio->bp >= cio->end) {
|
if (cio->bp >= cio->end) {
|
||||||
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
*cio->bp++ = v;
|
*cio->bp++ = v;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -152,7 +152,7 @@ unsigned char cio_bytein(opj_cio_t *cio) {
|
|||||||
* v : value to write
|
* v : value to write
|
||||||
* n : number of bytes to write
|
* n : number of bytes to write
|
||||||
*/
|
*/
|
||||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n) {
|
unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
|
||||||
int i;
|
int i;
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
|
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
|
||||||
|
2
extern/libopenjpeg/cio.h
vendored
2
extern/libopenjpeg/cio.h
vendored
@ -63,7 +63,7 @@ Write some bytes
|
|||||||
@param n Number of bytes to write
|
@param n Number of bytes to write
|
||||||
@return Returns the number of bytes written or 0 if an error occured
|
@return Returns the number of bytes written or 0 if an error occured
|
||||||
*/
|
*/
|
||||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n);
|
unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n);
|
||||||
/**
|
/**
|
||||||
Read some bytes
|
Read some bytes
|
||||||
@param cio CIO handle
|
@param cio CIO handle
|
||||||
|
83
extern/libopenjpeg/dwt.c
vendored
83
extern/libopenjpeg/dwt.c
vendored
@ -64,12 +64,12 @@ typedef struct v4dwt_local {
|
|||||||
int cas ;
|
int cas ;
|
||||||
} v4dwt_t ;
|
} v4dwt_t ;
|
||||||
|
|
||||||
static const float dwt_alpha = 1.586134342f; // 12994
|
static const float dwt_alpha = 1.586134342f; /* 12994 */
|
||||||
static const float dwt_beta = 0.052980118f; // 434
|
static const float dwt_beta = 0.052980118f; /* 434 */
|
||||||
static const float dwt_gamma = -0.882911075f; // -7233
|
static const float dwt_gamma = -0.882911075f; /* -7233 */
|
||||||
static const float dwt_delta = -0.443506852f; // -3633
|
static const float dwt_delta = -0.443506852f; /* -3633 */
|
||||||
|
|
||||||
static const float K = 1.230174105f; // 10078
|
static const float K = 1.230174105f; /* 10078 */
|
||||||
/* FIXME: What is this constant? */
|
/* FIXME: What is this constant? */
|
||||||
static const float c13318 = 1.625732422f;
|
static const float c13318 = 1.625732422f;
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ static void dwt_decode_tile(opj_tcd_tilecomp_t* tilec, int numres, DWT1DFN dwt_1
|
|||||||
|
|
||||||
int w = tilec->x1 - tilec->x0;
|
int w = tilec->x1 - tilec->x0;
|
||||||
|
|
||||||
h.mem = opj_aligned_malloc(dwt_decode_max_resolution(tr, numres) * sizeof(int));
|
h.mem = (int*)opj_aligned_malloc(dwt_decode_max_resolution(tr, numres) * sizeof(int));
|
||||||
v.mem = h.mem;
|
v.mem = h.mem;
|
||||||
|
|
||||||
while( --numres) {
|
while( --numres) {
|
||||||
@ -570,6 +570,20 @@ static void v4dwt_interleave_h(v4dwt_t* restrict w, float* restrict a, int x, in
|
|||||||
int count = w->sn;
|
int count = w->sn;
|
||||||
int i, k;
|
int i, k;
|
||||||
for(k = 0; k < 2; ++k){
|
for(k = 0; k < 2; ++k){
|
||||||
|
if (count + 3 * x < size && ((size_t) a & 0x0f) == 0 && ((size_t) bi & 0x0f) == 0 && (x & 0x0f) == 0) {
|
||||||
|
/* Fast code path */
|
||||||
|
for(i = 0; i < count; ++i){
|
||||||
|
int j = i;
|
||||||
|
bi[i*8 ] = a[j];
|
||||||
|
j += x;
|
||||||
|
bi[i*8 + 1] = a[j];
|
||||||
|
j += x;
|
||||||
|
bi[i*8 + 2] = a[j];
|
||||||
|
j += x;
|
||||||
|
bi[i*8 + 3] = a[j];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Slow code path */
|
||||||
for(i = 0; i < count; ++i){
|
for(i = 0; i < count; ++i){
|
||||||
int j = i;
|
int j = i;
|
||||||
bi[i*8 ] = a[j];
|
bi[i*8 ] = a[j];
|
||||||
@ -583,6 +597,7 @@ static void v4dwt_interleave_h(v4dwt_t* restrict w, float* restrict a, int x, in
|
|||||||
if(j > size) continue;
|
if(j > size) continue;
|
||||||
bi[i*8 + 3] = a[j];
|
bi[i*8 + 3] = a[j];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bi = (float*) (w->wavelet + 1 - w->cas);
|
bi = (float*) (w->wavelet + 1 - w->cas);
|
||||||
a += w->sn;
|
a += w->sn;
|
||||||
size -= w->sn;
|
size -= w->sn;
|
||||||
@ -608,9 +623,21 @@ static void v4dwt_interleave_v(v4dwt_t* restrict v , float* restrict a , int x){
|
|||||||
static void v4dwt_decode_step1_sse(v4* w, int count, const __m128 c){
|
static void v4dwt_decode_step1_sse(v4* w, int count, const __m128 c){
|
||||||
__m128* restrict vw = (__m128*) w;
|
__m128* restrict vw = (__m128*) w;
|
||||||
int i;
|
int i;
|
||||||
|
/* 4x unrolled loop */
|
||||||
|
for(i = 0; i < count >> 2; ++i){
|
||||||
|
*vw = _mm_mul_ps(*vw, c);
|
||||||
|
vw += 2;
|
||||||
|
*vw = _mm_mul_ps(*vw, c);
|
||||||
|
vw += 2;
|
||||||
|
*vw = _mm_mul_ps(*vw, c);
|
||||||
|
vw += 2;
|
||||||
|
*vw = _mm_mul_ps(*vw, c);
|
||||||
|
vw += 2;
|
||||||
|
}
|
||||||
|
count &= 3;
|
||||||
for(i = 0; i < count; ++i){
|
for(i = 0; i < count; ++i){
|
||||||
__m128 tmp = vw[i*2];
|
*vw = _mm_mul_ps(*vw, c);
|
||||||
vw[i*2] = _mm_mul_ps(tmp, c);
|
vw += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,14 +645,16 @@ static void v4dwt_decode_step2_sse(v4* l, v4* w, int k, int m, __m128 c){
|
|||||||
__m128* restrict vl = (__m128*) l;
|
__m128* restrict vl = (__m128*) l;
|
||||||
__m128* restrict vw = (__m128*) w;
|
__m128* restrict vw = (__m128*) w;
|
||||||
int i;
|
int i;
|
||||||
|
__m128 tmp1, tmp2, tmp3;
|
||||||
|
tmp1 = vl[0];
|
||||||
for(i = 0; i < m; ++i){
|
for(i = 0; i < m; ++i){
|
||||||
__m128 tmp1 = vl[ 0];
|
tmp2 = vw[-1];
|
||||||
__m128 tmp2 = vw[-1];
|
tmp3 = vw[ 0];
|
||||||
__m128 tmp3 = vw[ 0];
|
|
||||||
vw[-1] = _mm_add_ps(tmp2, _mm_mul_ps(_mm_add_ps(tmp1, tmp3), c));
|
vw[-1] = _mm_add_ps(tmp2, _mm_mul_ps(_mm_add_ps(tmp1, tmp3), c));
|
||||||
vl = vw;
|
tmp1 = tmp3;
|
||||||
vw += 2;
|
vw += 2;
|
||||||
}
|
}
|
||||||
|
vl = vw - 2;
|
||||||
if(m >= k){
|
if(m >= k){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -773,19 +802,24 @@ void dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){
|
|||||||
h.dn = rw - h.sn;
|
h.dn = rw - h.sn;
|
||||||
h.cas = res->x0 % 2;
|
h.cas = res->x0 % 2;
|
||||||
|
|
||||||
for(j = rh; j > 0; j -= 4){
|
for(j = rh; j > 3; j -= 4){
|
||||||
|
int k;
|
||||||
v4dwt_interleave_h(&h, aj, w, bufsize);
|
v4dwt_interleave_h(&h, aj, w, bufsize);
|
||||||
v4dwt_decode(&h);
|
v4dwt_decode(&h);
|
||||||
if(j >= 4){
|
|
||||||
int k;
|
|
||||||
for(k = rw; --k >= 0;){
|
for(k = rw; --k >= 0;){
|
||||||
aj[k ] = h.wavelet[k].f[0];
|
aj[k ] = h.wavelet[k].f[0];
|
||||||
aj[k+w ] = h.wavelet[k].f[1];
|
aj[k+w ] = h.wavelet[k].f[1];
|
||||||
aj[k+w*2] = h.wavelet[k].f[2];
|
aj[k+w*2] = h.wavelet[k].f[2];
|
||||||
aj[k+w*3] = h.wavelet[k].f[3];
|
aj[k+w*3] = h.wavelet[k].f[3];
|
||||||
}
|
}
|
||||||
}else{
|
aj += w*4;
|
||||||
|
bufsize -= w*4;
|
||||||
|
}
|
||||||
|
if (rh & 0x03) {
|
||||||
int k;
|
int k;
|
||||||
|
j = rh & 0x03;
|
||||||
|
v4dwt_interleave_h(&h, aj, w, bufsize);
|
||||||
|
v4dwt_decode(&h);
|
||||||
for(k = rw; --k >= 0;){
|
for(k = rw; --k >= 0;){
|
||||||
switch(j) {
|
switch(j) {
|
||||||
case 3: aj[k+w*2] = h.wavelet[k].f[2];
|
case 3: aj[k+w*2] = h.wavelet[k].f[2];
|
||||||
@ -794,30 +828,29 @@ void dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aj += w*4;
|
|
||||||
bufsize -= w*4;
|
|
||||||
}
|
|
||||||
|
|
||||||
v.dn = rh - v.sn;
|
v.dn = rh - v.sn;
|
||||||
v.cas = res->y0 % 2;
|
v.cas = res->y0 % 2;
|
||||||
|
|
||||||
aj = (float*) tilec->data;
|
aj = (float*) tilec->data;
|
||||||
for(j = rw; j > 0; j -= 4){
|
for(j = rw; j > 3; j -= 4){
|
||||||
|
int k;
|
||||||
v4dwt_interleave_v(&v, aj, w);
|
v4dwt_interleave_v(&v, aj, w);
|
||||||
v4dwt_decode(&v);
|
v4dwt_decode(&v);
|
||||||
if(j >= 4){
|
|
||||||
int k;
|
|
||||||
for(k = 0; k < rh; ++k){
|
for(k = 0; k < rh; ++k){
|
||||||
memcpy(&aj[k*w], &v.wavelet[k], 4 * sizeof(float));
|
memcpy(&aj[k*w], &v.wavelet[k], 4 * sizeof(float));
|
||||||
}
|
}
|
||||||
}else{
|
aj += 4;
|
||||||
|
}
|
||||||
|
if (rw & 0x03){
|
||||||
int k;
|
int k;
|
||||||
|
j = rw & 0x03;
|
||||||
|
v4dwt_interleave_v(&v, aj, w);
|
||||||
|
v4dwt_decode(&v);
|
||||||
for(k = 0; k < rh; ++k){
|
for(k = 0; k < rh; ++k){
|
||||||
memcpy(&aj[k*w], &v.wavelet[k], j * sizeof(float));
|
memcpy(&aj[k*w], &v.wavelet[k], j * sizeof(float));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aj += 4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
opj_aligned_free(h.wavelet);
|
opj_aligned_free(h.wavelet);
|
||||||
|
19
extern/libopenjpeg/event.c
vendored
19
extern/libopenjpeg/event.c
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -29,8 +29,9 @@
|
|||||||
/* ==========================================================
|
/* ==========================================================
|
||||||
Utility functions
|
Utility functions
|
||||||
==========================================================*/
|
==========================================================*/
|
||||||
#if 0
|
|
||||||
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
#ifdef OPJ_CODE_NOT_USED
|
||||||
|
#ifndef _WIN32
|
||||||
static char*
|
static char*
|
||||||
i2a(unsigned i, char *a, unsigned r) {
|
i2a(unsigned i, char *a, unsigned r) {
|
||||||
if (i/r > 0) a = i2a(i/r,a,r);
|
if (i/r > 0) a = i2a(i/r,a,r);
|
||||||
@ -57,8 +58,8 @@ _itoa(int i, char *a, int r) {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !WIN32 */
|
#endif /* !_WIN32 */
|
||||||
#endif /* unused - campbell */
|
#endif
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
|
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
|
||||||
@ -72,7 +73,7 @@ opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||||
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||||
opj_msg_callback msg_handler = NULL;
|
opj_msg_callback msg_handler = NULL;
|
||||||
|
|
||||||
@ -92,10 +93,10 @@ bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(msg_handler == NULL) {
|
if(msg_handler == NULL) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fmt != NULL) && (event_mgr != NULL)) {
|
if ((fmt != NULL) && (event_mgr != NULL)) {
|
||||||
@ -116,6 +117,6 @@ bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
|||||||
msg_handler(message, cinfo->client_data);
|
msg_handler(message, cinfo->client_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
extern/libopenjpeg/event.h
vendored
4
extern/libopenjpeg/event.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -49,7 +49,7 @@ Write formatted data to a string and send the string to a user callback.
|
|||||||
@param fmt Format-control string (plus optionnal arguments)
|
@param fmt Format-control string (plus optionnal arguments)
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
5
extern/libopenjpeg/image.c
vendored
5
extern/libopenjpeg/image.c
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#include "opj_includes.h"
|
#include "opj_includes.h"
|
||||||
|
|
||||||
opj_image_t* opj_image_create0(void) {
|
opj_image_t* opj_image_create0(void) {
|
||||||
opj_image_t *image = (opj_image_t*)opj_malloc(sizeof(opj_image_t));
|
opj_image_t *image = (opj_image_t*)opj_calloc(1, sizeof(opj_image_t));
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,4 +86,3 @@ void OPJ_CALLCONV opj_image_destroy(opj_image_t *image) {
|
|||||||
opj_free(image);
|
opj_free(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
extern/libopenjpeg/image.h
vendored
2
extern/libopenjpeg/image.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
118
extern/libopenjpeg/indexbox_manager.h
vendored
Normal file
118
extern/libopenjpeg/indexbox_manager.h
vendored
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.c from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INDEXBOX_MANAGER_H_
|
||||||
|
# define INDEXBOX_MANAGER_H_
|
||||||
|
|
||||||
|
#include "openjpeg.h"
|
||||||
|
#include "j2k.h" /* needed to use jp2.h */
|
||||||
|
#include "jp2.h"
|
||||||
|
|
||||||
|
#define JPIP_CIDX 0x63696478 /* Codestream index */
|
||||||
|
#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
|
||||||
|
#define JPIP_MANF 0x6d616e66 /* Manifest Box */
|
||||||
|
#define JPIP_FAIX 0x66616978 /* Fragment array Index box */
|
||||||
|
#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
|
||||||
|
#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
|
||||||
|
#define JPIP_THIX 0x74686978 /* Tile header Index Table box */
|
||||||
|
#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
|
||||||
|
#define JPIP_PHIX 0x70686978 /* Packet Header index Table */
|
||||||
|
#define JPIP_FIDX 0x66696478 /* File Index */
|
||||||
|
#define JPIP_FPTR 0x66707472 /* File Finder */
|
||||||
|
#define JPIP_PRXY 0x70727879 /* Proxy boxes */
|
||||||
|
#define JPIP_IPTR 0x69707472 /* Index finder box */
|
||||||
|
#define JPIP_PHLD 0x70686c64 /* Place holder */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write tile-part Index table box (superbox)
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of tpix box
|
||||||
|
*/
|
||||||
|
int write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write tile header index table box (superbox)
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information pointer
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of thix box
|
||||||
|
*/
|
||||||
|
int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write precinct packet index table box (superbox)
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] EPHused true if EPH option used
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of ppix box
|
||||||
|
*/
|
||||||
|
int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write packet header index table box (superbox)
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] EPHused true if EPH option used
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of ppix box
|
||||||
|
*/
|
||||||
|
int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wriet manifest box (box)
|
||||||
|
*
|
||||||
|
* @param[in] second number to be visited
|
||||||
|
* @param[in] v number of boxes
|
||||||
|
* @param[in] box box to be manifested
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
*/
|
||||||
|
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !INDEXBOX_MANAGER_H_ */
|
246
extern/libopenjpeg/j2k.c
vendored
246
extern/libopenjpeg/j2k.c
vendored
@ -6,6 +6,7 @@
|
|||||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -228,6 +229,23 @@ Read an unknown marker
|
|||||||
@param j2k J2K handle
|
@param j2k J2K handle
|
||||||
*/
|
*/
|
||||||
static void j2k_read_unk(opj_j2k_t *j2k);
|
static void j2k_read_unk(opj_j2k_t *j2k);
|
||||||
|
/**
|
||||||
|
Add main header marker information
|
||||||
|
@param cstr_info Codestream information structure
|
||||||
|
@param type marker type
|
||||||
|
@param pos byte offset of marker segment
|
||||||
|
@param len length of marker segment
|
||||||
|
*/
|
||||||
|
static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
|
||||||
|
/**
|
||||||
|
Add tile header marker information
|
||||||
|
@param tileno tile index number
|
||||||
|
@param cstr_info Codestream information structure
|
||||||
|
@param type marker type
|
||||||
|
@param pos byte offset of marker segment
|
||||||
|
@param len length of marker segment
|
||||||
|
*/
|
||||||
|
static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
@ -236,7 +254,7 @@ static void j2k_read_unk(opj_j2k_t *j2k);
|
|||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
typedef struct j2k_prog_order{
|
typedef struct j2k_prog_order{
|
||||||
OPJ_PROG_ORDER enum_prog;
|
OPJ_PROG_ORDER enum_prog;
|
||||||
char str_prog[4];
|
char str_prog[5];
|
||||||
}j2k_prog_order_t;
|
}j2k_prog_order_t;
|
||||||
|
|
||||||
j2k_prog_order_t j2k_prog_order_list[] = {
|
j2k_prog_order_t j2k_prog_order_list[] = {
|
||||||
@ -245,7 +263,7 @@ j2k_prog_order_t j2k_prog_order_list[] = {
|
|||||||
{PCRL, "PCRL"},
|
{PCRL, "PCRL"},
|
||||||
{RLCP, "RLCP"},
|
{RLCP, "RLCP"},
|
||||||
{RPCL, "RPCL"},
|
{RPCL, "RPCL"},
|
||||||
{-1, ""}
|
{(OPJ_PROG_ORDER)-1, ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
char *j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){
|
char *j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){
|
||||||
@ -258,79 +276,6 @@ char *j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){
|
|||||||
return po->str_prog;
|
return po->str_prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void j2k_dump_image(FILE *fd, opj_image_t * img) {
|
|
||||||
int compno;
|
|
||||||
fprintf(fd, "image {\n");
|
|
||||||
fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
|
|
||||||
fprintf(fd, " numcomps=%d\n", img->numcomps);
|
|
||||||
for (compno = 0; compno < img->numcomps; compno++) {
|
|
||||||
opj_image_comp_t *comp = &img->comps[compno];
|
|
||||||
fprintf(fd, " comp %d {\n", compno);
|
|
||||||
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
|
||||||
fprintf(fd, " prec=%d\n", comp->prec);
|
|
||||||
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
|
||||||
fprintf(fd, " }\n");
|
|
||||||
}
|
|
||||||
fprintf(fd, "}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
|
|
||||||
int tileno, compno, layno, bandno, resno, numbands;
|
|
||||||
fprintf(fd, "coding parameters {\n");
|
|
||||||
fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
|
|
||||||
fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
|
|
||||||
fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
|
|
||||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
|
||||||
opj_tcp_t *tcp = &cp->tcps[tileno];
|
|
||||||
fprintf(fd, " tile %d {\n", tileno);
|
|
||||||
fprintf(fd, " csty=%x\n", tcp->csty);
|
|
||||||
fprintf(fd, " prg=%d\n", tcp->prg);
|
|
||||||
fprintf(fd, " numlayers=%d\n", tcp->numlayers);
|
|
||||||
fprintf(fd, " mct=%d\n", tcp->mct);
|
|
||||||
fprintf(fd, " rates=");
|
|
||||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
|
||||||
fprintf(fd, "%.1f ", tcp->rates[layno]);
|
|
||||||
}
|
|
||||||
fprintf(fd, "\n");
|
|
||||||
for (compno = 0; compno < img->numcomps; compno++) {
|
|
||||||
opj_tccp_t *tccp = &tcp->tccps[compno];
|
|
||||||
fprintf(fd, " comp %d {\n", compno);
|
|
||||||
fprintf(fd, " csty=%x\n", tccp->csty);
|
|
||||||
fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
|
|
||||||
fprintf(fd, " cblkw=%d\n", tccp->cblkw);
|
|
||||||
fprintf(fd, " cblkh=%d\n", tccp->cblkh);
|
|
||||||
fprintf(fd, " cblksty=%x\n", tccp->cblksty);
|
|
||||||
fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
|
|
||||||
fprintf(fd, " qntsty=%d\n", tccp->qntsty);
|
|
||||||
fprintf(fd, " numgbits=%d\n", tccp->numgbits);
|
|
||||||
fprintf(fd, " roishift=%d\n", tccp->roishift);
|
|
||||||
fprintf(fd, " stepsizes=");
|
|
||||||
numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
|
|
||||||
for (bandno = 0; bandno < numbands; bandno++) {
|
|
||||||
fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
|
|
||||||
tccp->stepsizes[bandno].expn);
|
|
||||||
}
|
|
||||||
fprintf(fd, "\n");
|
|
||||||
|
|
||||||
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
|
||||||
fprintf(fd, " prcw=");
|
|
||||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
|
||||||
fprintf(fd, "%d ", tccp->prcw[resno]);
|
|
||||||
}
|
|
||||||
fprintf(fd, "\n");
|
|
||||||
fprintf(fd, " prch=");
|
|
||||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
|
||||||
fprintf(fd, "%d ", tccp->prch[resno]);
|
|
||||||
}
|
|
||||||
fprintf(fd, "\n");
|
|
||||||
}
|
|
||||||
fprintf(fd, " }\n");
|
|
||||||
}
|
|
||||||
fprintf(fd, " }\n");
|
|
||||||
}
|
|
||||||
fprintf(fd, "}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
static int j2k_get_num_tp(opj_cp_t *cp,int pino,int tileno){
|
static int j2k_get_num_tp(opj_cp_t *cp,int pino,int tileno){
|
||||||
char *prog;
|
char *prog;
|
||||||
@ -370,6 +315,9 @@ static int j2k_get_num_tp(opj_cp_t *cp,int pino,int tileno){
|
|||||||
/** mem allocation for TLM marker*/
|
/** mem allocation for TLM marker*/
|
||||||
int j2k_calculate_tp(opj_cp_t *cp,int img_numcomp,opj_image_t *image,opj_j2k_t *j2k ){
|
int j2k_calculate_tp(opj_cp_t *cp,int img_numcomp,opj_image_t *image,opj_j2k_t *j2k ){
|
||||||
int pino,tileno,totnum_tp=0;
|
int pino,tileno,totnum_tp=0;
|
||||||
|
|
||||||
|
OPJ_ARG_NOT_USED(img_numcomp);
|
||||||
|
|
||||||
j2k->cur_totnum_tp = (int *) opj_malloc(cp->tw * cp->th * sizeof(int));
|
j2k->cur_totnum_tp = (int *) opj_malloc(cp->tw * cp->th * sizeof(int));
|
||||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
||||||
int cur_totnum_tp = 0;
|
int cur_totnum_tp = 0;
|
||||||
@ -398,12 +346,14 @@ static void j2k_write_soc(opj_j2k_t *j2k) {
|
|||||||
opj_cio_t *cio = j2k->cio;
|
opj_cio_t *cio = j2k->cio;
|
||||||
cio_write(cio, J2K_MS_SOC, 2);
|
cio_write(cio, J2K_MS_SOC, 2);
|
||||||
|
|
||||||
|
if(j2k->cstr_info)
|
||||||
|
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_SOC, cio_tell(cio), 0);
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
|
|
||||||
/* update markers struct */
|
/* update markers struct */
|
||||||
j2k_add_marker(j2k->cstr_info, J2K_MS_SOC, cio_tell(cio) - 2, 2);
|
j2k_add_marker(j2k->cstr_info, J2K_MS_SOC, cio_tell(cio) - 2, 2);
|
||||||
|
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
}
|
}
|
||||||
@ -447,6 +397,9 @@ static void j2k_write_siz(opj_j2k_t *j2k) {
|
|||||||
cio_seek(cio, lenp);
|
cio_seek(cio, lenp);
|
||||||
cio_write(cio, len, 2); /* Lsiz */
|
cio_write(cio, len, 2); /* Lsiz */
|
||||||
cio_seek(cio, lenp + len);
|
cio_seek(cio, lenp + len);
|
||||||
|
|
||||||
|
if(j2k->cstr_info)
|
||||||
|
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_SIZ, lenp, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void j2k_read_siz(opj_j2k_t *j2k) {
|
static void j2k_read_siz(opj_j2k_t *j2k) {
|
||||||
@ -467,6 +420,13 @@ static void j2k_read_siz(opj_j2k_t *j2k) {
|
|||||||
cp->tx0 = cio_read(cio, 4); /* XT0siz */
|
cp->tx0 = cio_read(cio, 4); /* XT0siz */
|
||||||
cp->ty0 = cio_read(cio, 4); /* YT0siz */
|
cp->ty0 = cio_read(cio, 4); /* YT0siz */
|
||||||
|
|
||||||
|
if ((image->x0<0)||(image->x1<0)||(image->y0<0)||(image->y1<0)) {
|
||||||
|
opj_event_msg(j2k->cinfo, EVT_ERROR,
|
||||||
|
"%s: invalid image size (x0:%d, x1:%d, y0:%d, y1:%d)\n",
|
||||||
|
image->x0,image->x1,image->y0,image->y1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
image->numcomps = cio_read(cio, 2); /* Csiz */
|
image->numcomps = cio_read(cio, 2); /* Csiz */
|
||||||
|
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
@ -670,6 +630,11 @@ static void j2k_write_com(opj_j2k_t *j2k) {
|
|||||||
cio_seek(cio, lenp);
|
cio_seek(cio, lenp);
|
||||||
cio_write(cio, len, 2);
|
cio_write(cio, len, 2);
|
||||||
cio_seek(cio, lenp + len);
|
cio_seek(cio, lenp + len);
|
||||||
|
|
||||||
|
|
||||||
|
if(j2k->cstr_info)
|
||||||
|
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_COM, lenp, len);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,7 +678,7 @@ static void j2k_read_cox(opj_j2k_t *j2k, int compno) {
|
|||||||
|
|
||||||
tccp->numresolutions = cio_read(cio, 1) + 1; /* SPcox (D) */
|
tccp->numresolutions = cio_read(cio, 1) + 1; /* SPcox (D) */
|
||||||
|
|
||||||
// If user wants to remove more resolutions than the codestream contains, return error
|
/* If user wants to remove more resolutions than the codestream contains, return error*/
|
||||||
if (cp->reduce >= tccp->numresolutions) {
|
if (cp->reduce >= tccp->numresolutions) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Error decoding component %d.\nThe number of resolutions to remove is higher than the number "
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Error decoding component %d.\nThe number of resolutions to remove is higher than the number "
|
||||||
"of resolutions of this component\nModify the cp_reduce parameter.\n\n", compno);
|
"of resolutions of this component\nModify the cp_reduce parameter.\n\n", compno);
|
||||||
@ -773,6 +738,10 @@ static void j2k_write_cod(opj_j2k_t *j2k) {
|
|||||||
cio_seek(cio, lenp);
|
cio_seek(cio, lenp);
|
||||||
cio_write(cio, len, 2); /* Lcod */
|
cio_write(cio, len, 2); /* Lcod */
|
||||||
cio_seek(cio, lenp + len);
|
cio_seek(cio, lenp + len);
|
||||||
|
|
||||||
|
if(j2k->cstr_info)
|
||||||
|
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_COD, lenp, len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void j2k_read_cod(opj_j2k_t *j2k) {
|
static void j2k_read_cod(opj_j2k_t *j2k) {
|
||||||
@ -901,6 +870,15 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* We check whether there are too many subbands */
|
||||||
|
if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) {
|
||||||
|
opj_event_msg(j2k->cinfo, EVT_WARNING ,
|
||||||
|
"bad number of subbands in Sqcx (%d) regarding to J2K_MAXBANDS (%d) \n"
|
||||||
|
"- limiting number of bands to J2K_MAXBANDS and try to move to the next markers\n", numbands, J2K_MAXBANDS);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
for (bandno = 0; bandno < numbands; bandno++) {
|
for (bandno = 0; bandno < numbands; bandno++) {
|
||||||
@ -913,9 +891,11 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
|
|||||||
expn = tmp >> 11;
|
expn = tmp >> 11;
|
||||||
mant = tmp & 0x7ff;
|
mant = tmp & 0x7ff;
|
||||||
}
|
}
|
||||||
|
if (bandno < J2K_MAXBANDS){
|
||||||
tccp->stepsizes[bandno].expn = expn;
|
tccp->stepsizes[bandno].expn = expn;
|
||||||
tccp->stepsizes[bandno].mant = mant;
|
tccp->stepsizes[bandno].mant = mant;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add Antonin : if scalar_derived -> compute other stepsizes */
|
/* Add Antonin : if scalar_derived -> compute other stepsizes */
|
||||||
if (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
|
if (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
|
||||||
@ -942,6 +922,9 @@ static void j2k_write_qcd(opj_j2k_t *j2k) {
|
|||||||
cio_seek(cio, lenp);
|
cio_seek(cio, lenp);
|
||||||
cio_write(cio, len, 2); /* Lqcd */
|
cio_write(cio, len, 2); /* Lqcd */
|
||||||
cio_seek(cio, lenp + len);
|
cio_seek(cio, lenp + len);
|
||||||
|
|
||||||
|
if(j2k->cstr_info)
|
||||||
|
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_QCD, lenp, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void j2k_read_qcd(opj_j2k_t *j2k) {
|
static void j2k_read_qcd(opj_j2k_t *j2k) {
|
||||||
@ -1263,6 +1246,10 @@ static void j2k_write_sot(opj_j2k_t *j2k) {
|
|||||||
j2k_add_marker(j2k->cstr_info, J2K_MS_SOT, j2k->sot_start, len + 2);
|
j2k_add_marker(j2k->cstr_info, J2K_MS_SOT, j2k->sot_start, len + 2);
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
|
|
||||||
|
if( j2k->cstr_info && j2k->cur_tp_num==0){
|
||||||
|
j2k_add_tlmarker( j2k->curtileno, j2k->cstr_info, J2K_MS_SOT, lenp, len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void j2k_read_sot(opj_j2k_t *j2k) {
|
static void j2k_read_sot(opj_j2k_t *j2k) {
|
||||||
@ -1347,6 +1334,11 @@ static void j2k_read_sot(opj_j2k_t *j2k) {
|
|||||||
partno = cio_read(cio, 1);
|
partno = cio_read(cio, 1);
|
||||||
numparts = cio_read(cio, 1);
|
numparts = cio_read(cio, 1);
|
||||||
|
|
||||||
|
if (partno >= numparts) {
|
||||||
|
opj_event_msg(j2k->cinfo, EVT_WARNING, "SOT marker inconsistency in tile %d: tile-part index greater (%d) than number of tile-parts (%d)\n", tileno, partno, numparts);
|
||||||
|
numparts = partno+1;
|
||||||
|
}
|
||||||
|
|
||||||
j2k->curtileno = tileno;
|
j2k->curtileno = tileno;
|
||||||
j2k->cur_tp_num = partno;
|
j2k->cur_tp_num = partno;
|
||||||
j2k->eot = cio_getbp(cio) - 12 + totlen;
|
j2k->eot = cio_getbp(cio) - 12 + totlen;
|
||||||
@ -1361,15 +1353,14 @@ static void j2k_read_sot(opj_j2k_t *j2k) {
|
|||||||
j2k->cstr_info->tile[tileno].tileno = tileno;
|
j2k->cstr_info->tile[tileno].tileno = tileno;
|
||||||
j2k->cstr_info->tile[tileno].start_pos = cio_tell(cio) - 12;
|
j2k->cstr_info->tile[tileno].start_pos = cio_tell(cio) - 12;
|
||||||
j2k->cstr_info->tile[tileno].end_pos = j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
|
j2k->cstr_info->tile[tileno].end_pos = j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
|
||||||
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
} else {
|
||||||
if (numparts)
|
|
||||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(numparts * sizeof(opj_tp_info_t));
|
|
||||||
else
|
|
||||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(10 * sizeof(opj_tp_info_t)); // Fixme (10)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
j2k->cstr_info->tile[tileno].end_pos += totlen;
|
j2k->cstr_info->tile[tileno].end_pos += totlen;
|
||||||
}
|
}
|
||||||
|
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
||||||
|
if (numparts)
|
||||||
|
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_realloc(j2k->cstr_info->tile[tileno].tp, numparts * sizeof(opj_tp_info_t));
|
||||||
|
else
|
||||||
|
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_realloc(j2k->cstr_info->tile[tileno].tp, 10 * sizeof(opj_tp_info_t)); /* Fixme (10)*/
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = cio_tell(cio) - 12;
|
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = cio_tell(cio) - 12;
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
|
j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
|
||||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
|
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
|
||||||
@ -1405,6 +1396,11 @@ static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder) {
|
|||||||
tcd->cur_tp_num = j2k->cur_tp_num;
|
tcd->cur_tp_num = j2k->cur_tp_num;
|
||||||
|
|
||||||
cio_write(cio, J2K_MS_SOD, 2);
|
cio_write(cio, J2K_MS_SOD, 2);
|
||||||
|
|
||||||
|
if( j2k->cstr_info && j2k->cur_tp_num==0){
|
||||||
|
j2k_add_tlmarker( j2k->curtileno, j2k->cstr_info, J2K_MS_SOD, cio_tell(cio), 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (j2k->curtileno == 0) {
|
if (j2k->curtileno == 0) {
|
||||||
j2k->sod_start = cio_tell(cio) + j2k->pos_correction;
|
j2k->sod_start = cio_tell(cio) + j2k->pos_correction;
|
||||||
}
|
}
|
||||||
@ -1431,7 +1427,11 @@ static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder) {
|
|||||||
|
|
||||||
tcp = &cp->tcps[j2k->curtileno];
|
tcp = &cp->tcps[j2k->curtileno];
|
||||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
for (layno = 0; layno < tcp->numlayers; layno++) {
|
||||||
tcp->rates[layno] -= tcp->rates[layno] ? (j2k->sod_start / (cp->th * cp->tw)) : 0;
|
if (tcp->rates[layno]>(j2k->sod_start / (cp->th * cp->tw))) {
|
||||||
|
tcp->rates[layno]-=(j2k->sod_start / (cp->th * cp->tw));
|
||||||
|
} else if (tcp->rates[layno]) {
|
||||||
|
tcp->rates[layno]=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(j2k->cur_tp_num == 0){
|
if(j2k->cur_tp_num == 0){
|
||||||
tcd->tcd_image->tiles->packno = 0;
|
tcd->tcd_image->tiles->packno = 0;
|
||||||
@ -1554,7 +1554,7 @@ static void j2k_write_eoc(opj_j2k_t *j2k) {
|
|||||||
|
|
||||||
static void j2k_read_eoc(opj_j2k_t *j2k) {
|
static void j2k_read_eoc(opj_j2k_t *j2k) {
|
||||||
int i, tileno;
|
int i, tileno;
|
||||||
bool success;
|
opj_bool success;
|
||||||
|
|
||||||
/* if packets should be decoded */
|
/* if packets should be decoded */
|
||||||
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
|
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
|
||||||
@ -1567,7 +1567,7 @@ static void j2k_read_eoc(opj_j2k_t *j2k) {
|
|||||||
opj_free(j2k->tile_data[tileno]);
|
opj_free(j2k->tile_data[tileno]);
|
||||||
j2k->tile_data[tileno] = NULL;
|
j2k->tile_data[tileno] = NULL;
|
||||||
tcd_free_decode_tile(tcd, i);
|
tcd_free_decode_tile(tcd, i);
|
||||||
if (success == false) {
|
if (success == OPJ_FALSE) {
|
||||||
j2k->state |= J2K_STATE_ERR;
|
j2k->state |= J2K_STATE_ERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1822,7 +1822,7 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
|||||||
if (j2k->cp->correct) {
|
if (j2k->cp->correct) {
|
||||||
|
|
||||||
int orig_pos = cio_tell(cio);
|
int orig_pos = cio_tell(cio);
|
||||||
bool status;
|
opj_bool status;
|
||||||
|
|
||||||
/* call the corrector */
|
/* call the corrector */
|
||||||
status = jpwl_correct(j2k);
|
status = jpwl_correct(j2k);
|
||||||
@ -1861,13 +1861,13 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
e = j2k_dec_mstab_lookup(id);
|
e = j2k_dec_mstab_lookup(id);
|
||||||
// Check if the marker is known
|
/* Check if the marker is known*/
|
||||||
if (!(j2k->state & e->states)) {
|
if (!(j2k->state & e->states)) {
|
||||||
opj_image_destroy(image);
|
opj_image_destroy(image);
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
|
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Check if the decoding is limited to the main header
|
/* Check if the decoding is limited to the main header*/
|
||||||
if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
|
if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
|
||||||
opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
|
opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
|
||||||
return image;
|
return image;
|
||||||
@ -1893,7 +1893,6 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
|||||||
if (j2k->state != J2K_STATE_MT) {
|
if (j2k->state != J2K_STATE_MT) {
|
||||||
opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
|
opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1905,9 +1904,10 @@ opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestre
|
|||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
opj_jpt_msg_header_t header;
|
opj_jpt_msg_header_t header;
|
||||||
int position;
|
int position;
|
||||||
|
|
||||||
opj_common_ptr cinfo = j2k->cinfo;
|
opj_common_ptr cinfo = j2k->cinfo;
|
||||||
|
|
||||||
|
OPJ_ARG_NOT_USED(cstr_info);
|
||||||
|
|
||||||
j2k->cio = cio;
|
j2k->cio = cio;
|
||||||
|
|
||||||
/* create an empty image */
|
/* create an empty image */
|
||||||
@ -2098,12 +2098,12 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* set JPWL on */
|
/* set JPWL on */
|
||||||
cp->epc_on = true;
|
cp->epc_on = OPJ_TRUE;
|
||||||
cp->info_on = false; /* no informative technique */
|
cp->info_on = OPJ_FALSE; /* no informative technique */
|
||||||
|
|
||||||
/* set EPB on */
|
/* set EPB on */
|
||||||
if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
|
if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
|
||||||
cp->epb_on = true;
|
cp->epb_on = OPJ_TRUE;
|
||||||
|
|
||||||
cp->hprot_MH = parameters->jpwl_hprot_MH;
|
cp->hprot_MH = parameters->jpwl_hprot_MH;
|
||||||
for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
|
for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
|
||||||
@ -2124,7 +2124,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
|
|
||||||
/* set ESD writing */
|
/* set ESD writing */
|
||||||
if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
|
if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
|
||||||
cp->esd_on = true;
|
cp->esd_on = OPJ_TRUE;
|
||||||
|
|
||||||
cp->sens_size = parameters->jpwl_sens_size;
|
cp->sens_size = parameters->jpwl_sens_size;
|
||||||
cp->sens_addr = parameters->jpwl_sens_addr;
|
cp->sens_addr = parameters->jpwl_sens_addr;
|
||||||
@ -2138,10 +2138,10 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* always set RED writing to false: we are at the encoder */
|
/* always set RED writing to false: we are at the encoder */
|
||||||
cp->red_on = false;
|
cp->red_on = OPJ_FALSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cp->epc_on = false;
|
cp->epc_on = OPJ_FALSE;
|
||||||
}
|
}
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
@ -2214,10 +2214,10 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
|
|
||||||
if(parameters->cp_cinema)
|
if(parameters->cp_cinema)
|
||||||
{
|
{
|
||||||
//Precinct size for lowest frequency subband=128
|
/*Precinct size for lowest frequency subband=128*/
|
||||||
tccp->prcw[0] = 7;
|
tccp->prcw[0] = 7;
|
||||||
tccp->prch[0] = 7;
|
tccp->prch[0] = 7;
|
||||||
//Precinct size at all other resolutions = 256
|
/*Precinct size at all other resolutions = 256*/
|
||||||
for (j = 1; j < tccp->numresolutions; j++) {
|
for (j = 1; j < tccp->numresolutions; j++) {
|
||||||
tccp->prcw[j] = 8;
|
tccp->prcw[j] = 8;
|
||||||
tccp->prch[j] = 8;
|
tccp->prch[j] = 8;
|
||||||
@ -2259,7 +2259,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
/*printf("\nsize precinct for level %d : %d,%d\n", j,tccp->prcw[j], tccp->prch[j]); */
|
/*printf("\nsize precinct for level %d : %d,%d\n", j,tccp->prcw[j], tccp->prch[j]); */
|
||||||
} //end for
|
} /*end for*/
|
||||||
} else {
|
} else {
|
||||||
for (j = 0; j < tccp->numresolutions; j++) {
|
for (j = 0; j < tccp->numresolutions; j++) {
|
||||||
tccp->prcw[j] = 15;
|
tccp->prcw[j] = 15;
|
||||||
@ -2273,7 +2273,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||||
int tileno, compno;
|
int tileno, compno;
|
||||||
opj_cp_t *cp = NULL;
|
opj_cp_t *cp = NULL;
|
||||||
|
|
||||||
@ -2284,8 +2284,6 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
|||||||
|
|
||||||
cp = j2k->cp;
|
cp = j2k->cp;
|
||||||
|
|
||||||
/* j2k_dump_cp(stdout, image, cp); */
|
|
||||||
|
|
||||||
/* INDEX >> */
|
/* INDEX >> */
|
||||||
j2k->cstr_info = cstr_info;
|
j2k->cstr_info = cstr_info;
|
||||||
if (cstr_info) {
|
if (cstr_info) {
|
||||||
@ -2382,6 +2380,9 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
|||||||
/* INDEX >> */
|
/* INDEX >> */
|
||||||
if(cstr_info) {
|
if(cstr_info) {
|
||||||
cstr_info->tile[j2k->curtileno].start_pos = cio_tell(cio) + j2k->pos_correction;
|
cstr_info->tile[j2k->curtileno].start_pos = cio_tell(cio) + j2k->pos_correction;
|
||||||
|
cstr_info->tile[j2k->curtileno].maxmarknum = 10;
|
||||||
|
cstr_info->tile[j2k->curtileno].marker = (opj_marker_info_t *) opj_malloc(cstr_info->tile[j2k->curtileno].maxmarknum * sizeof(opj_marker_info_t));
|
||||||
|
cstr_info->tile[j2k->curtileno].marknum = 0;
|
||||||
}
|
}
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
|
|
||||||
@ -2488,11 +2489,46 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
|||||||
}
|
}
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
|
||||||
|
|
||||||
|
if (!cstr_info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* expand the list? */
|
||||||
|
if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) {
|
||||||
|
cstr_info->maxmarknum = 100 + (int) ((float) cstr_info->maxmarknum * 1.0F);
|
||||||
|
cstr_info->marker = (opj_marker_info_t*)opj_realloc(cstr_info->marker, cstr_info->maxmarknum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add the marker */
|
||||||
|
cstr_info->marker[cstr_info->marknum].type = type;
|
||||||
|
cstr_info->marker[cstr_info->marknum].pos = pos;
|
||||||
|
cstr_info->marker[cstr_info->marknum].len = len;
|
||||||
|
cstr_info->marknum++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
|
||||||
|
|
||||||
|
opj_marker_info_t *marker;
|
||||||
|
|
||||||
|
if (!cstr_info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* expand the list? */
|
||||||
|
if ((cstr_info->tile[tileno].marknum + 1) > cstr_info->tile[tileno].maxmarknum) {
|
||||||
|
cstr_info->tile[tileno].maxmarknum = 100 + (int) ((float) cstr_info->tile[tileno].maxmarknum * 1.0F);
|
||||||
|
cstr_info->tile[tileno].marker = (opj_marker_info_t*)opj_realloc(cstr_info->tile[tileno].marker, cstr_info->maxmarknum);
|
||||||
|
}
|
||||||
|
|
||||||
|
marker = &(cstr_info->tile[tileno].marker[cstr_info->tile[tileno].marknum]);
|
||||||
|
|
||||||
|
/* add the marker */
|
||||||
|
marker->type = type;
|
||||||
|
marker->pos = pos;
|
||||||
|
marker->len = len;
|
||||||
|
cstr_info->tile[tileno].marknum++;
|
||||||
|
}
|
||||||
|
26
extern/libopenjpeg/j2k.h
vendored
26
extern/libopenjpeg/j2k.h
vendored
@ -45,12 +45,12 @@ The functions in J2K.C have for goal to read/write the several parts of the code
|
|||||||
#define J2K_CP_CSTY_SOP 0x02
|
#define J2K_CP_CSTY_SOP 0x02
|
||||||
#define J2K_CP_CSTY_EPH 0x04
|
#define J2K_CP_CSTY_EPH 0x04
|
||||||
#define J2K_CCP_CSTY_PRT 0x01
|
#define J2K_CCP_CSTY_PRT 0x01
|
||||||
#define J2K_CCP_CBLKSTY_LAZY 0x01
|
#define J2K_CCP_CBLKSTY_LAZY 0x01 /**< Selective arithmetic coding bypass */
|
||||||
#define J2K_CCP_CBLKSTY_RESET 0x02
|
#define J2K_CCP_CBLKSTY_RESET 0x02 /**< Reset context probabilities on coding pass boundaries */
|
||||||
#define J2K_CCP_CBLKSTY_TERMALL 0x04
|
#define J2K_CCP_CBLKSTY_TERMALL 0x04 /**< Termination on each coding pass */
|
||||||
#define J2K_CCP_CBLKSTY_VSC 0x08
|
#define J2K_CCP_CBLKSTY_VSC 0x08 /**< Vertically stripe causal context */
|
||||||
#define J2K_CCP_CBLKSTY_PTERM 0x10
|
#define J2K_CCP_CBLKSTY_PTERM 0x10 /**< Predictable termination */
|
||||||
#define J2K_CCP_CBLKSTY_SEGSYM 0x20
|
#define J2K_CCP_CBLKSTY_SEGSYM 0x20 /**< Segmentation symbols are used */
|
||||||
#define J2K_CCP_QNTSTY_NOQNT 0
|
#define J2K_CCP_QNTSTY_NOQNT 0
|
||||||
#define J2K_CCP_QNTSTY_SIQNT 1
|
#define J2K_CCP_QNTSTY_SIQNT 1
|
||||||
#define J2K_CCP_QNTSTY_SEQNT 2
|
#define J2K_CCP_QNTSTY_SEQNT 2
|
||||||
@ -265,15 +265,15 @@ typedef struct opj_cp {
|
|||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
/** enables writing of EPC in MH, thus activating JPWL */
|
/** enables writing of EPC in MH, thus activating JPWL */
|
||||||
bool epc_on;
|
opj_bool epc_on;
|
||||||
/** enables writing of EPB, in case of activated JPWL */
|
/** enables writing of EPB, in case of activated JPWL */
|
||||||
bool epb_on;
|
opj_bool epb_on;
|
||||||
/** enables writing of ESD, in case of activated JPWL */
|
/** enables writing of ESD, in case of activated JPWL */
|
||||||
bool esd_on;
|
opj_bool esd_on;
|
||||||
/** enables writing of informative techniques of ESD, in case of activated JPWL */
|
/** enables writing of informative techniques of ESD, in case of activated JPWL */
|
||||||
bool info_on;
|
opj_bool info_on;
|
||||||
/** enables writing of RED, in case of activated JPWL */
|
/** enables writing of RED, in case of activated JPWL */
|
||||||
bool red_on;
|
opj_bool red_on;
|
||||||
/** error protection method for MH (0,1,16,32,37-128) */
|
/** error protection method for MH (0,1,16,32,37-128) */
|
||||||
int hprot_MH;
|
int hprot_MH;
|
||||||
/** tile number of header protection specification (>=0) */
|
/** tile number of header protection specification (>=0) */
|
||||||
@ -299,7 +299,7 @@ typedef struct opj_cp {
|
|||||||
/** sensitivity methods for TPHs (-1,0-7) */
|
/** sensitivity methods for TPHs (-1,0-7) */
|
||||||
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
||||||
/** enables JPWL correction at the decoder */
|
/** enables JPWL correction at the decoder */
|
||||||
bool correct;
|
opj_bool correct;
|
||||||
/** expected number of components at the decoder */
|
/** expected number of components at the decoder */
|
||||||
int exp_comps;
|
int exp_comps;
|
||||||
/** maximum number of tiles at the decoder */
|
/** maximum number of tiles at the decoder */
|
||||||
@ -436,7 +436,7 @@ Encode an image into a JPEG-2000 codestream
|
|||||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
10
extern/libopenjpeg/j2k_lib.c
vendored
10
extern/libopenjpeg/j2k_lib.c
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -24,18 +24,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#endif /* WIN32 */
|
#endif /* _WIN32 */
|
||||||
#include "opj_includes.h"
|
#include "opj_includes.h"
|
||||||
|
|
||||||
double opj_clock(void) {
|
double opj_clock(void) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* WIN32: use QueryPerformance (very accurate) */
|
/* _WIN32: use QueryPerformance (very accurate) */
|
||||||
LARGE_INTEGER freq , t ;
|
LARGE_INTEGER freq , t ;
|
||||||
/* freq is the clock speed of the CPU */
|
/* freq is the clock speed of the CPU */
|
||||||
QueryPerformanceFrequency(&freq) ;
|
QueryPerformanceFrequency(&freq) ;
|
||||||
|
2
extern/libopenjpeg/j2k_lib.h
vendored
2
extern/libopenjpeg/j2k_lib.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
821
extern/libopenjpeg/jp2.c
vendored
821
extern/libopenjpeg/jp2.c
vendored
File diff suppressed because it is too large
Load Diff
65
extern/libopenjpeg/jp2.h
vendored
65
extern/libopenjpeg/jp2.h
vendored
@ -46,11 +46,64 @@
|
|||||||
#define JP2_COLR 0x636f6c72 /**< Colour specification box */
|
#define JP2_COLR 0x636f6c72 /**< Colour specification box */
|
||||||
#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */
|
#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */
|
||||||
#define JP2_URL 0x75726c20 /**< URL box */
|
#define JP2_URL 0x75726c20 /**< URL box */
|
||||||
#define JP2_DBTL 0x6474626c /**< ??? */
|
#define JP2_DTBL 0x6474626c /**< Data Reference box */
|
||||||
#define JP2_BPCC 0x62706363 /**< Bits per component box */
|
#define JP2_BPCC 0x62706363 /**< Bits per component box */
|
||||||
#define JP2_JP2 0x6a703220 /**< File type fields */
|
#define JP2_JP2 0x6a703220 /**< File type fields */
|
||||||
|
#define JP2_PCLR 0x70636c72 /**< Palette box */
|
||||||
|
#define JP2_CMAP 0x636d6170 /**< Component Mapping box */
|
||||||
|
#define JP2_CDEF 0x63646566 /**< Channel Definition box */
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
Channel description: channel index, type, assocation
|
||||||
|
*/
|
||||||
|
typedef struct opj_jp2_cdef_info
|
||||||
|
{
|
||||||
|
unsigned short cn, typ, asoc;
|
||||||
|
} opj_jp2_cdef_info_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Channel descriptions and number of descriptions
|
||||||
|
*/
|
||||||
|
typedef struct opj_jp2_cdef
|
||||||
|
{
|
||||||
|
opj_jp2_cdef_info_t *info;
|
||||||
|
unsigned short n;
|
||||||
|
} opj_jp2_cdef_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Component mappings: channel index, mapping type, palette index
|
||||||
|
*/
|
||||||
|
typedef struct opj_jp2_cmap_comp
|
||||||
|
{
|
||||||
|
unsigned short cmp;
|
||||||
|
unsigned char mtyp, pcol;
|
||||||
|
} opj_jp2_cmap_comp_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Palette data: table entries, palette columns
|
||||||
|
*/
|
||||||
|
typedef struct opj_jp2_pclr
|
||||||
|
{
|
||||||
|
unsigned int *entries;
|
||||||
|
unsigned char *channel_sign;
|
||||||
|
unsigned char *channel_size;
|
||||||
|
opj_jp2_cmap_comp_t *cmap;
|
||||||
|
unsigned short nr_entries, nr_channels;
|
||||||
|
} opj_jp2_pclr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collector for ICC profile, palette, component mapping, channel description
|
||||||
|
*/
|
||||||
|
typedef struct opj_jp2_color
|
||||||
|
{
|
||||||
|
unsigned char *icc_profile_buf;
|
||||||
|
int icc_profile_len;
|
||||||
|
|
||||||
|
opj_jp2_cdef_t *jp2_cdef;
|
||||||
|
opj_jp2_pclr_t *jp2_pclr;
|
||||||
|
unsigned char jp2_has_colr;
|
||||||
|
} opj_jp2_color_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
JP2 component
|
JP2 component
|
||||||
@ -87,6 +140,8 @@ typedef struct opj_jp2 {
|
|||||||
opj_jp2_comps_t *comps;
|
opj_jp2_comps_t *comps;
|
||||||
unsigned int j2k_codestream_offset;
|
unsigned int j2k_codestream_offset;
|
||||||
unsigned int j2k_codestream_length;
|
unsigned int j2k_codestream_length;
|
||||||
|
opj_bool jpip_on;
|
||||||
|
opj_bool ignore_pclr_cmap_cdef;
|
||||||
} opj_jp2_t;
|
} opj_jp2_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,9 +166,10 @@ void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
|
|||||||
Read the JP2H box - JP2 Header box (used in MJ2)
|
Read the JP2H box - JP2 Header box (used in MJ2)
|
||||||
@param jp2 JP2 handle
|
@param jp2 JP2 handle
|
||||||
@param cio Input buffer stream
|
@param cio Input buffer stream
|
||||||
|
@param ext Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
|
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color);
|
||||||
/**
|
/**
|
||||||
Creates a JP2 decompression structure
|
Creates a JP2 decompression structure
|
||||||
@param cinfo Codec context info
|
@param cinfo Codec context info
|
||||||
@ -139,7 +195,7 @@ Decode an image from a JPEG-2000 file stream
|
|||||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||||
@return Returns a decoded image if successful, returns NULL otherwise
|
@return Returns a decoded image if successful, returns NULL otherwise
|
||||||
*/
|
*/
|
||||||
opj_image_t* jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
|
opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
|
||||||
/**
|
/**
|
||||||
Creates a JP2 compression structure
|
Creates a JP2 compression structure
|
||||||
@param cinfo Codec context info
|
@param cinfo Codec context info
|
||||||
@ -167,7 +223,8 @@ Encode an image into a JPEG-2000 file stream
|
|||||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
42
extern/libopenjpeg/mct.c
vendored
42
extern/libopenjpeg/mct.c
vendored
@ -29,6 +29,10 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __SSE__
|
||||||
|
#include <xmmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "opj_includes.h"
|
#include "opj_includes.h"
|
||||||
|
|
||||||
/* <summary> */
|
/* <summary> */
|
||||||
@ -127,6 +131,44 @@ void mct_decode_real(
|
|||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
#ifdef __SSE__
|
||||||
|
__m128 vrv, vgu, vgv, vbu;
|
||||||
|
vrv = _mm_set1_ps(1.402f);
|
||||||
|
vgu = _mm_set1_ps(0.34413f);
|
||||||
|
vgv = _mm_set1_ps(0.71414f);
|
||||||
|
vbu = _mm_set1_ps(1.772f);
|
||||||
|
for (i = 0; i < (n >> 3); ++i) {
|
||||||
|
__m128 vy, vu, vv;
|
||||||
|
__m128 vr, vg, vb;
|
||||||
|
|
||||||
|
vy = _mm_load_ps(c0);
|
||||||
|
vu = _mm_load_ps(c1);
|
||||||
|
vv = _mm_load_ps(c2);
|
||||||
|
vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
|
||||||
|
vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
|
||||||
|
vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
|
||||||
|
_mm_store_ps(c0, vr);
|
||||||
|
_mm_store_ps(c1, vg);
|
||||||
|
_mm_store_ps(c2, vb);
|
||||||
|
c0 += 4;
|
||||||
|
c1 += 4;
|
||||||
|
c2 += 4;
|
||||||
|
|
||||||
|
vy = _mm_load_ps(c0);
|
||||||
|
vu = _mm_load_ps(c1);
|
||||||
|
vv = _mm_load_ps(c2);
|
||||||
|
vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
|
||||||
|
vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
|
||||||
|
vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
|
||||||
|
_mm_store_ps(c0, vr);
|
||||||
|
_mm_store_ps(c1, vg);
|
||||||
|
_mm_store_ps(c2, vb);
|
||||||
|
c0 += 4;
|
||||||
|
c1 += 4;
|
||||||
|
c2 += 4;
|
||||||
|
}
|
||||||
|
n &= 7;
|
||||||
|
#endif
|
||||||
for(i = 0; i < n; ++i) {
|
for(i = 0; i < n; ++i) {
|
||||||
float y = c0[i];
|
float y = c0[i];
|
||||||
float u = c1[i];
|
float u = c1[i];
|
||||||
|
74
extern/libopenjpeg/mqc.c
vendored
74
extern/libopenjpeg/mqc.c
vendored
@ -68,24 +68,23 @@ FIXME: documentation ???
|
|||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
static int mqc_mpsexchange(opj_mqc_t *mqc);
|
static INLINE int mqc_mpsexchange(opj_mqc_t *const mqc);
|
||||||
/**
|
/**
|
||||||
FIXME: documentation ???
|
FIXME: documentation ???
|
||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
static int mqc_lpsexchange(opj_mqc_t *mqc);
|
static INLINE int mqc_lpsexchange(opj_mqc_t *const mqc);
|
||||||
/**
|
/**
|
||||||
Input a byte
|
Input a byte
|
||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
*/
|
*/
|
||||||
static void mqc_bytein(opj_mqc_t *mqc);
|
static INLINE void mqc_bytein(opj_mqc_t *const mqc);
|
||||||
/**
|
/**
|
||||||
Renormalize mqc->a and mqc->c while decoding
|
Renormalize mqc->a and mqc->c while decoding
|
||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
*/
|
*/
|
||||||
static void mqc_renormd(opj_mqc_t *mqc);
|
static INLINE void mqc_renormd(opj_mqc_t *const mqc);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
@ -271,7 +270,7 @@ static void mqc_setbits(opj_mqc_t *mqc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mqc_mpsexchange(opj_mqc_t *mqc) {
|
static INLINE int mqc_mpsexchange(opj_mqc_t *const mqc) {
|
||||||
int d;
|
int d;
|
||||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||||
d = 1 - (*mqc->curctx)->mps;
|
d = 1 - (*mqc->curctx)->mps;
|
||||||
@ -284,7 +283,7 @@ static int mqc_mpsexchange(opj_mqc_t *mqc) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mqc_lpsexchange(opj_mqc_t *mqc) {
|
static INLINE int mqc_lpsexchange(opj_mqc_t *const mqc) {
|
||||||
int d;
|
int d;
|
||||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||||
mqc->a = (*mqc->curctx)->qeval;
|
mqc->a = (*mqc->curctx)->qeval;
|
||||||
@ -299,7 +298,15 @@ static int mqc_lpsexchange(opj_mqc_t *mqc) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mqc_bytein(opj_mqc_t *mqc) {
|
#ifdef MQC_PERF_OPT
|
||||||
|
static INLINE void mqc_bytein(opj_mqc_t *const mqc) {
|
||||||
|
unsigned int i = *((unsigned int *) mqc->bp);
|
||||||
|
mqc->c += i & 0xffff00;
|
||||||
|
mqc->ct = i & 0x0f;
|
||||||
|
mqc->bp += (i >> 2) & 0x04;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static void mqc_bytein(opj_mqc_t *const mqc) {
|
||||||
if (mqc->bp != mqc->end) {
|
if (mqc->bp != mqc->end) {
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
if (mqc->bp + 1 != mqc->end) {
|
if (mqc->bp + 1 != mqc->end) {
|
||||||
@ -326,8 +333,9 @@ static void mqc_bytein(opj_mqc_t *mqc) {
|
|||||||
mqc->ct = 8;
|
mqc->ct = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void mqc_renormd(opj_mqc_t *mqc) {
|
static INLINE void mqc_renormd(opj_mqc_t *const mqc) {
|
||||||
do {
|
do {
|
||||||
if (mqc->ct == 0) {
|
if (mqc->ct == 0) {
|
||||||
mqc_bytein(mqc);
|
mqc_bytein(mqc);
|
||||||
@ -346,11 +354,19 @@ static void mqc_renormd(opj_mqc_t *mqc) {
|
|||||||
|
|
||||||
opj_mqc_t* mqc_create(void) {
|
opj_mqc_t* mqc_create(void) {
|
||||||
opj_mqc_t *mqc = (opj_mqc_t*)opj_malloc(sizeof(opj_mqc_t));
|
opj_mqc_t *mqc = (opj_mqc_t*)opj_malloc(sizeof(opj_mqc_t));
|
||||||
|
#ifdef MQC_PERF_OPT
|
||||||
|
mqc->buffer = NULL;
|
||||||
|
#endif
|
||||||
return mqc;
|
return mqc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqc_destroy(opj_mqc_t *mqc) {
|
void mqc_destroy(opj_mqc_t *mqc) {
|
||||||
if(mqc) {
|
if(mqc) {
|
||||||
|
#ifdef MQC_PERF_OPT
|
||||||
|
if (mqc->buffer) {
|
||||||
|
opj_free(mqc->buffer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
opj_free(mqc);
|
opj_free(mqc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -499,13 +515,51 @@ void mqc_init_dec(opj_mqc_t *mqc, unsigned char *bp, int len) {
|
|||||||
mqc->bp = bp;
|
mqc->bp = bp;
|
||||||
if (len==0) mqc->c = 0xff << 16;
|
if (len==0) mqc->c = 0xff << 16;
|
||||||
else mqc->c = *mqc->bp << 16;
|
else mqc->c = *mqc->bp << 16;
|
||||||
|
|
||||||
|
#ifdef MQC_PERF_OPT
|
||||||
|
{
|
||||||
|
unsigned int c;
|
||||||
|
unsigned int *ip;
|
||||||
|
unsigned char *end = mqc->end - 1;
|
||||||
|
mqc->buffer = opj_realloc(mqc->buffer, (len + 1) * sizeof(unsigned int));
|
||||||
|
ip = (unsigned int *) mqc->buffer;
|
||||||
|
|
||||||
|
while (bp < end) {
|
||||||
|
c = *(bp + 1);
|
||||||
|
if (*bp == 0xff) {
|
||||||
|
if (c > 0x8f) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
*ip = 0x00000017 | (c << 9);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*ip = 0x00000018 | (c << 8);
|
||||||
|
}
|
||||||
|
bp++;
|
||||||
|
ip++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle last byte of data */
|
||||||
|
c = 0xff;
|
||||||
|
if (*bp == 0xff) {
|
||||||
|
*ip = 0x0000ff18;
|
||||||
|
} else {
|
||||||
|
bp++;
|
||||||
|
*ip = 0x00000018 | (c << 8);
|
||||||
|
}
|
||||||
|
ip++;
|
||||||
|
|
||||||
|
*ip = 0x0000ff08;
|
||||||
|
mqc->bp = mqc->buffer;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
mqc_bytein(mqc);
|
mqc_bytein(mqc);
|
||||||
mqc->c <<= 7;
|
mqc->c <<= 7;
|
||||||
mqc->ct -= 7;
|
mqc->ct -= 7;
|
||||||
mqc->a = 0x8000;
|
mqc->a = 0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqc_decode(opj_mqc_t *mqc) {
|
int mqc_decode(opj_mqc_t *const mqc) {
|
||||||
int d;
|
int d;
|
||||||
mqc->a -= (*mqc->curctx)->qeval;
|
mqc->a -= (*mqc->curctx)->qeval;
|
||||||
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
|
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
|
||||||
|
5
extern/libopenjpeg/mqc.h
vendored
5
extern/libopenjpeg/mqc.h
vendored
@ -70,6 +70,9 @@ typedef struct opj_mqc {
|
|||||||
unsigned char *end;
|
unsigned char *end;
|
||||||
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
|
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
|
||||||
opj_mqc_state_t **curctx;
|
opj_mqc_state_t **curctx;
|
||||||
|
#ifdef MQC_PERF_OPT
|
||||||
|
unsigned char *buffer;
|
||||||
|
#endif
|
||||||
} opj_mqc_t;
|
} opj_mqc_t;
|
||||||
|
|
||||||
/** @name Exported functions */
|
/** @name Exported functions */
|
||||||
@ -188,7 +191,7 @@ Decode a symbol
|
|||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
@return Returns the decoded symbol (0 or 1)
|
@return Returns the decoded symbol (0 or 1)
|
||||||
*/
|
*/
|
||||||
int mqc_decode(opj_mqc_t *mqc);
|
int mqc_decode(opj_mqc_t *const mqc);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
48
extern/libopenjpeg/openjpeg.c
vendored
48
extern/libopenjpeg/openjpeg.c
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -24,17 +24,22 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif /* WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
#include "opj_config.h"
|
||||||
#include "opj_includes.h"
|
#include "opj_includes.h"
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifndef OPJ_STATIC
|
#ifndef OPJ_STATIC
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||||
|
|
||||||
|
OPJ_ARG_NOT_USED(lpReserved);
|
||||||
|
OPJ_ARG_NOT_USED(hModule);
|
||||||
|
|
||||||
switch (ul_reason_for_call) {
|
switch (ul_reason_for_call) {
|
||||||
case DLL_PROCESS_ATTACH :
|
case DLL_PROCESS_ATTACH :
|
||||||
break;
|
break;
|
||||||
@ -48,19 +53,19 @@ DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* OPJ_STATIC */
|
#endif /* OPJ_STATIC */
|
||||||
#endif /* WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
const char* OPJ_CALLCONV opj_version(void) {
|
const char* OPJ_CALLCONV opj_version(void) {
|
||||||
return OPENJPEG_VERSION;
|
return PACKAGE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
||||||
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_malloc(sizeof(opj_dinfo_t));
|
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t));
|
||||||
if(!dinfo) return NULL;
|
if(!dinfo) return NULL;
|
||||||
dinfo->is_decompressor = true;
|
dinfo->is_decompressor = OPJ_TRUE;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case CODEC_J2K:
|
case CODEC_J2K:
|
||||||
case CODEC_JPT:
|
case CODEC_JPT:
|
||||||
@ -120,9 +125,10 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
|
|||||||
|
|
||||||
parameters->decod_format = -1;
|
parameters->decod_format = -1;
|
||||||
parameters->cod_format = -1;
|
parameters->cod_format = -1;
|
||||||
|
parameters->flags = 0;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters->jpwl_correct = false;
|
parameters->jpwl_correct = OPJ_FALSE;
|
||||||
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
|
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
|
||||||
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
|
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
@ -159,7 +165,7 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
|
|||||||
case CODEC_JPT:
|
case CODEC_JPT:
|
||||||
return j2k_decode_jpt_stream((opj_j2k_t*)dinfo->j2k_handle, cio, cstr_info);
|
return j2k_decode_jpt_stream((opj_j2k_t*)dinfo->j2k_handle, cio, cstr_info);
|
||||||
case CODEC_JP2:
|
case CODEC_JP2:
|
||||||
return jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio, cstr_info);
|
return opj_jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio, cstr_info);
|
||||||
case CODEC_UNKNOWN:
|
case CODEC_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -169,9 +175,9 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
|
|||||||
}
|
}
|
||||||
|
|
||||||
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
||||||
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_malloc(sizeof(opj_cinfo_t));
|
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(1, sizeof(opj_cinfo_t));
|
||||||
if(!cinfo) return NULL;
|
if(!cinfo) return NULL;
|
||||||
cinfo->is_decompressor = false;
|
cinfo->is_decompressor = OPJ_FALSE;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case CODEC_J2K:
|
case CODEC_J2K:
|
||||||
/* get a J2K coder handle */
|
/* get a J2K coder handle */
|
||||||
@ -238,9 +244,15 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *paramete
|
|||||||
parameters->tp_on = 0;
|
parameters->tp_on = 0;
|
||||||
parameters->decod_format = -1;
|
parameters->decod_format = -1;
|
||||||
parameters->cod_format = -1;
|
parameters->cod_format = -1;
|
||||||
|
parameters->tcp_rates[0] = 0;
|
||||||
|
parameters->tcp_numlayers = 0;
|
||||||
|
parameters->cp_disto_alloc = 0;
|
||||||
|
parameters->cp_fixed_alloc = 0;
|
||||||
|
parameters->cp_fixed_quality = 0;
|
||||||
|
parameters->jpip_on = OPJ_FALSE;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters->jpwl_epc_on = false;
|
parameters->jpwl_epc_on = OPJ_FALSE;
|
||||||
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
|
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -290,7 +302,7 @@ void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *param
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
|
opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
|
||||||
if (index != NULL)
|
if (index != NULL)
|
||||||
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
|
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
|
||||||
"To extract the index, use the opj_encode_with_info() function.\n"
|
"To extract the index, use the opj_encode_with_info() function.\n"
|
||||||
@ -298,20 +310,20 @@ bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *im
|
|||||||
return opj_encode_with_info(cinfo, cio, image, NULL);
|
return opj_encode_with_info(cinfo, cio, image, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||||
if(cinfo && cio && image) {
|
if(cinfo && cio && image) {
|
||||||
switch(cinfo->codec_format) {
|
switch(cinfo->codec_format) {
|
||||||
case CODEC_J2K:
|
case CODEC_J2K:
|
||||||
return j2k_encode((opj_j2k_t*)cinfo->j2k_handle, cio, image, cstr_info);
|
return j2k_encode((opj_j2k_t*)cinfo->j2k_handle, cio, image, cstr_info);
|
||||||
case CODEC_JP2:
|
case CODEC_JP2:
|
||||||
return jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, cstr_info);
|
return opj_jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, cstr_info);
|
||||||
case CODEC_JPT:
|
case CODEC_JPT:
|
||||||
case CODEC_UNKNOWN:
|
case CODEC_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
||||||
@ -322,8 +334,10 @@ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
|||||||
opj_free(tile_info->thresh);
|
opj_free(tile_info->thresh);
|
||||||
opj_free(tile_info->packet);
|
opj_free(tile_info->packet);
|
||||||
opj_free(tile_info->tp);
|
opj_free(tile_info->tp);
|
||||||
|
opj_free(tile_info->marker);
|
||||||
}
|
}
|
||||||
opj_free(cstr_info->tile);
|
opj_free(cstr_info->tile);
|
||||||
opj_free(cstr_info->marker);
|
opj_free(cstr_info->marker);
|
||||||
|
opj_free(cstr_info->numdecompos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
106
extern/libopenjpeg/openjpeg.h
vendored
106
extern/libopenjpeg/openjpeg.h
vendored
@ -6,6 +6,7 @@
|
|||||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -32,7 +33,6 @@
|
|||||||
#ifndef OPENJPEG_H
|
#ifndef OPENJPEG_H
|
||||||
#define OPENJPEG_H
|
#define OPENJPEG_H
|
||||||
|
|
||||||
#define OPENJPEG_VERSION "1.3.0"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================
|
==========================================================
|
||||||
@ -40,34 +40,32 @@
|
|||||||
==========================================================
|
==========================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(OPJ_STATIC) || !defined(_WIN32)
|
||||||
#define OPJ_API
|
#define OPJ_API
|
||||||
#define OPJ_CALLCONV
|
#define OPJ_CALLCONV
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#if defined(HAVE_STDBOOL_H)
|
|
||||||
/*
|
|
||||||
The C language implementation does correctly provide the standard header
|
|
||||||
file "stdbool.h".
|
|
||||||
*/
|
|
||||||
#include <stdbool.h>
|
|
||||||
#else
|
#else
|
||||||
|
#define OPJ_CALLCONV __stdcall
|
||||||
/*
|
/*
|
||||||
The C language implementation does not provide the standard header file
|
The following ifdef block is the standard way of creating macros which make exporting
|
||||||
"stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
|
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
|
||||||
braindamage below.
|
symbol defined on the command line. this symbol should not be defined on any project
|
||||||
|
that uses this DLL. This way any other project whose source files include this file see
|
||||||
|
OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||||
|
defined with this macro as being exported.
|
||||||
*/
|
*/
|
||||||
#if !defined(bool)
|
#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
|
||||||
#define bool int
|
#define OPJ_API __declspec(dllexport)
|
||||||
#endif
|
#else
|
||||||
#if !defined(true)
|
#define OPJ_API __declspec(dllimport)
|
||||||
#define true 1
|
#endif /* OPJ_EXPORTS */
|
||||||
#endif
|
#endif /* !OPJ_STATIC || !_WIN32 */
|
||||||
#if !defined(false)
|
|
||||||
#define false 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
typedef int opj_bool;
|
||||||
|
#define OPJ_TRUE 1
|
||||||
|
#define OPJ_FALSE 0
|
||||||
|
|
||||||
|
/* Avoid compile-time warning because parameter is not used */
|
||||||
|
#define OPJ_ARG_NOT_USED(x) (void)(x)
|
||||||
/*
|
/*
|
||||||
==========================================================
|
==========================================================
|
||||||
Useful constant definitions
|
Useful constant definitions
|
||||||
@ -130,7 +128,8 @@ typedef enum PROG_ORDER {
|
|||||||
Supported image color spaces
|
Supported image color spaces
|
||||||
*/
|
*/
|
||||||
typedef enum COLOR_SPACE {
|
typedef enum COLOR_SPACE {
|
||||||
CLRSPC_UNKNOWN = -1, /**< place-holder */
|
CLRSPC_UNKNOWN = -1, /**< not supported by the library */
|
||||||
|
CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */
|
||||||
CLRSPC_SRGB = 1, /**< sRGB */
|
CLRSPC_SRGB = 1, /**< sRGB */
|
||||||
CLRSPC_GRAY = 2, /**< grayscale */
|
CLRSPC_GRAY = 2, /**< grayscale */
|
||||||
CLRSPC_SYCC = 3 /**< YUV */
|
CLRSPC_SYCC = 3 /**< YUV */
|
||||||
@ -226,7 +225,7 @@ Compression parameters
|
|||||||
*/
|
*/
|
||||||
typedef struct opj_cparameters {
|
typedef struct opj_cparameters {
|
||||||
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
|
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
|
||||||
bool tile_size_on;
|
opj_bool tile_size_on;
|
||||||
/** XTOsiz */
|
/** XTOsiz */
|
||||||
int cp_tx0;
|
int cp_tx0;
|
||||||
/** YTOsiz */
|
/** YTOsiz */
|
||||||
@ -308,7 +307,7 @@ typedef struct opj_cparameters {
|
|||||||
/**@name JPWL encoding parameters */
|
/**@name JPWL encoding parameters */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** enables writing of EPC in MH, thus activating JPWL */
|
/** enables writing of EPC in MH, thus activating JPWL */
|
||||||
bool jpwl_epc_on;
|
opj_bool jpwl_epc_on;
|
||||||
/** error protection method for MH (0,1,16,32,37-128) */
|
/** error protection method for MH (0,1,16,32,37-128) */
|
||||||
int jpwl_hprot_MH;
|
int jpwl_hprot_MH;
|
||||||
/** tile number of header protection specification (>=0) */
|
/** tile number of header protection specification (>=0) */
|
||||||
@ -348,8 +347,12 @@ typedef struct opj_cparameters {
|
|||||||
char tp_flag;
|
char tp_flag;
|
||||||
/** MCT (multiple component transform) */
|
/** MCT (multiple component transform) */
|
||||||
char tcp_mct;
|
char tcp_mct;
|
||||||
|
/** Enable JPIP indexing*/
|
||||||
|
opj_bool jpip_on;
|
||||||
} opj_cparameters_t;
|
} opj_cparameters_t;
|
||||||
|
|
||||||
|
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decompression parameters
|
Decompression parameters
|
||||||
*/
|
*/
|
||||||
@ -386,7 +389,7 @@ typedef struct opj_dparameters {
|
|||||||
/**@name JPWL decoding parameters */
|
/**@name JPWL decoding parameters */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** activates the JPWL correction capabilities */
|
/** activates the JPWL correction capabilities */
|
||||||
bool jpwl_correct;
|
opj_bool jpwl_correct;
|
||||||
/** expected number of components */
|
/** expected number of components */
|
||||||
int jpwl_exp_comps;
|
int jpwl_exp_comps;
|
||||||
/** maximum number of tiles */
|
/** maximum number of tiles */
|
||||||
@ -402,6 +405,7 @@ typedef struct opj_dparameters {
|
|||||||
*/
|
*/
|
||||||
OPJ_LIMIT_DECODING cp_limit_decoding;
|
OPJ_LIMIT_DECODING cp_limit_decoding;
|
||||||
|
|
||||||
|
unsigned int flags;
|
||||||
} opj_dparameters_t;
|
} opj_dparameters_t;
|
||||||
|
|
||||||
/** Common fields between JPEG-2000 compression and decompression master structs. */
|
/** Common fields between JPEG-2000 compression and decompression master structs. */
|
||||||
@ -409,7 +413,7 @@ typedef struct opj_dparameters {
|
|||||||
#define opj_common_fields \
|
#define opj_common_fields \
|
||||||
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
|
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
|
||||||
void * client_data; /**< Available for use by application */\
|
void * client_data; /**< Available for use by application */\
|
||||||
bool is_decompressor; /**< So common code can tell which is which */\
|
opj_bool is_decompressor; /**< So common code can tell which is which */\
|
||||||
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
|
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
|
||||||
void *j2k_handle; /**< pointer to the J2K codec */\
|
void *j2k_handle; /**< pointer to the J2K codec */\
|
||||||
void *jp2_handle; /**< pointer to the JP2 codec */\
|
void *jp2_handle; /**< pointer to the JP2 codec */\
|
||||||
@ -537,6 +541,10 @@ typedef struct opj_image {
|
|||||||
OPJ_COLOR_SPACE color_space;
|
OPJ_COLOR_SPACE color_space;
|
||||||
/** image components */
|
/** image components */
|
||||||
opj_image_comp_t *comps;
|
opj_image_comp_t *comps;
|
||||||
|
/** 'restricted' ICC profile */
|
||||||
|
unsigned char *icc_profile_buf;
|
||||||
|
/** size of ICC profile */
|
||||||
|
int icc_profile_len;
|
||||||
} opj_image_t;
|
} opj_image_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -583,6 +591,21 @@ typedef struct opj_packet_info {
|
|||||||
double disto;
|
double disto;
|
||||||
} opj_packet_info_t;
|
} opj_packet_info_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* UniPG>> */
|
||||||
|
/**
|
||||||
|
Marker structure
|
||||||
|
*/
|
||||||
|
typedef struct opj_marker_info_t {
|
||||||
|
/** marker type */
|
||||||
|
unsigned short int type;
|
||||||
|
/** position in codestream */
|
||||||
|
int pos;
|
||||||
|
/** length, marker val included */
|
||||||
|
int len;
|
||||||
|
} opj_marker_info_t;
|
||||||
|
/* <<UniPG */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Index structure : Information concerning tile-parts
|
Index structure : Information concerning tile-parts
|
||||||
*/
|
*/
|
||||||
@ -627,26 +650,18 @@ typedef struct opj_tile_info {
|
|||||||
int numpix;
|
int numpix;
|
||||||
/** add fixed_quality */
|
/** add fixed_quality */
|
||||||
double distotile;
|
double distotile;
|
||||||
|
/** number of markers */
|
||||||
|
int marknum;
|
||||||
|
/** list of markers */
|
||||||
|
opj_marker_info_t *marker;
|
||||||
|
/** actual size of markers array */
|
||||||
|
int maxmarknum;
|
||||||
/** number of tile parts */
|
/** number of tile parts */
|
||||||
int num_tps;
|
int num_tps;
|
||||||
/** information concerning tile parts */
|
/** information concerning tile parts */
|
||||||
opj_tp_info_t *tp;
|
opj_tp_info_t *tp;
|
||||||
} opj_tile_info_t;
|
} opj_tile_info_t;
|
||||||
|
|
||||||
/* UniPG>> */
|
|
||||||
/**
|
|
||||||
Marker structure
|
|
||||||
*/
|
|
||||||
typedef struct opj_marker_info_t {
|
|
||||||
/** marker type */
|
|
||||||
unsigned short int type;
|
|
||||||
/** position in codestream */
|
|
||||||
int pos;
|
|
||||||
/** length, marker val included */
|
|
||||||
int len;
|
|
||||||
} opj_marker_info_t;
|
|
||||||
/* <<UniPG */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Index structure of the codestream
|
Index structure of the codestream
|
||||||
*/
|
*/
|
||||||
@ -865,13 +880,13 @@ Setup the encoder parameters using the current image and using user parameters.
|
|||||||
OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image);
|
OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image);
|
||||||
/**
|
/**
|
||||||
Encode an image into a JPEG-2000 codestream
|
Encode an image into a JPEG-2000 codestream
|
||||||
@param cinfo compressor handle
|
3@param cinfo compressor handle
|
||||||
@param cio Output buffer stream
|
@param cio Output buffer stream
|
||||||
@param image Image to encode
|
@param image Image to encode
|
||||||
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
|
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
|
OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
|
||||||
/**
|
/**
|
||||||
Encode an image into a JPEG-2000 codestream and extract the codestream information
|
Encode an image into a JPEG-2000 codestream and extract the codestream information
|
||||||
@param cinfo compressor handle
|
@param cinfo compressor handle
|
||||||
@ -880,13 +895,14 @@ Encode an image into a JPEG-2000 codestream and extract the codestream informati
|
|||||||
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
|
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
|
||||||
@return Returns true if successful, returns false otherwise
|
@return Returns true if successful, returns false otherwise
|
||||||
*/
|
*/
|
||||||
OPJ_API bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||||
/**
|
/**
|
||||||
Destroy Codestream information after compression or decompression
|
Destroy Codestream information after compression or decompression
|
||||||
@param cstr_info Codestream information structure
|
@param cstr_info Codestream information structure
|
||||||
*/
|
*/
|
||||||
OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
|
OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
38
extern/libopenjpeg/opj_config.h
vendored
Normal file
38
extern/libopenjpeg/opj_config.h
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* for BLENDER - we hand-maintain this,
|
||||||
|
* for the original OpenJpeg package it is generated,
|
||||||
|
* the endian check is a blender define */
|
||||||
|
|
||||||
|
/* create config.h for CMake */
|
||||||
|
#define PACKAGE_VERSION "1.5.0"
|
||||||
|
|
||||||
|
#define HAVE_INTTYPES_H
|
||||||
|
#define HAVE_MEMORY_H
|
||||||
|
#define HAVE_STDINT_H
|
||||||
|
#define HAVE_STDLIB_H
|
||||||
|
#define HAVE_STRINGS_H
|
||||||
|
#define HAVE_STRING_H
|
||||||
|
#define HAVE_SYS_STAT_H
|
||||||
|
#define HAVE_SYS_TYPES_H
|
||||||
|
#define HAVE_UNISTD_H
|
||||||
|
/* #define HAVE_LIBPNG */
|
||||||
|
/* #define HAVE_PNG_H */
|
||||||
|
/* #define HAVE_LIBTIFF */
|
||||||
|
/* #define HAVE_TIFF_H */
|
||||||
|
|
||||||
|
/* #undef HAVE_LIBLCMS1 */
|
||||||
|
/* #undef HAVE_LIBLCMS2 */
|
||||||
|
/* #undef HAVE_LCMS1_H */
|
||||||
|
/* #undef HAVE_LCMS2_H */
|
||||||
|
|
||||||
|
/* Byte order. */
|
||||||
|
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
|
||||||
|
__LITTLE_ENDIAN__ to match the endianness of the architecture being
|
||||||
|
compiled for. This is not necessarily the same as the architecture of the
|
||||||
|
machine doing the building. In order to support Universal Binaries on
|
||||||
|
Mac OS X, we prefer those defines to decide the endianness.
|
||||||
|
On other platforms we use the result of the TRY_RUN. */
|
||||||
|
#if defined(__BIG_ENDIAN__)
|
||||||
|
# define OPJ_BIG_ENDIAN
|
||||||
|
#else
|
||||||
|
# undef OPJ_BIG_ENDIAN
|
||||||
|
#endif
|
25
extern/libopenjpeg/opj_includes.h
vendored
25
extern/libopenjpeg/opj_includes.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -65,7 +65,7 @@ Most compilers implement their own version of this keyword ...
|
|||||||
*/
|
*/
|
||||||
#ifndef INLINE
|
#ifndef INLINE
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define INLINE __inline
|
#define INLINE __forceinline
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define INLINE __inline__
|
#define INLINE __inline__
|
||||||
#elif defined(__MWERKS__)
|
#elif defined(__MWERKS__)
|
||||||
@ -86,15 +86,12 @@ Most compilers implement their own version of this keyword ...
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MSVC does not have lrintf */
|
/* MSVC and Borland C do not have lrintf */
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
#ifdef _M_X64
|
|
||||||
#include <emmintrin.h>
|
|
||||||
static INLINE long lrintf(float f) {
|
|
||||||
return _mm_cvtss_si32(_mm_load_ss(&f));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static INLINE long lrintf(float f){
|
static INLINE long lrintf(float f){
|
||||||
|
#ifdef _M_X64
|
||||||
|
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||||
|
#else
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_asm{
|
_asm{
|
||||||
@ -103,13 +100,14 @@ static INLINE long lrintf(float f){
|
|||||||
};
|
};
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "j2k_lib.h"
|
#include "j2k_lib.h"
|
||||||
#include "opj_malloc.h"
|
#include "opj_malloc.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "bio.h"
|
||||||
#include "cio.h"
|
#include "cio.h"
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
@ -130,9 +128,12 @@ static INLINE long lrintf(float f){
|
|||||||
#include "int.h"
|
#include "int.h"
|
||||||
#include "fix.h"
|
#include "fix.h"
|
||||||
|
|
||||||
|
#include "cidx_manager.h"
|
||||||
|
#include "indexbox_manager.h"
|
||||||
|
|
||||||
/* JPWL>> */
|
/* JPWL>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
#include "../jpwl/jpwl.h"
|
#include "./jpwl/jpwl.h"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<JPWL */
|
/* <<JPWL */
|
||||||
|
|
||||||
|
46
extern/libopenjpeg/opj_malloc.h
vendored
46
extern/libopenjpeg/opj_malloc.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@ -45,7 +45,11 @@ Allocate an uninitialized memory block
|
|||||||
@param size Bytes to allocate
|
@param size Bytes to allocate
|
||||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||||
*/
|
*/
|
||||||
|
#ifdef ALLOC_PERF_OPT
|
||||||
|
void * OPJ_CALLCONV opj_malloc(size_t size);
|
||||||
|
#else
|
||||||
#define opj_malloc(size) malloc(size)
|
#define opj_malloc(size) malloc(size)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate a memory block with elements initialized to 0
|
Allocate a memory block with elements initialized to 0
|
||||||
@ -53,7 +57,11 @@ Allocate a memory block with elements initialized to 0
|
|||||||
@param size Bytes per block to allocate
|
@param size Bytes per block to allocate
|
||||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||||
*/
|
*/
|
||||||
|
#ifdef ALLOC_PERF_OPT
|
||||||
|
void * OPJ_CALLCONV opj_calloc(size_t _NumOfElements, size_t _SizeOfElements);
|
||||||
|
#else
|
||||||
#define opj_calloc(num, size) calloc(num, size)
|
#define opj_calloc(num, size) calloc(num, size)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate memory aligned to a 16 byte boundry
|
Allocate memory aligned to a 16 byte boundry
|
||||||
@ -61,7 +69,7 @@ Allocate memory aligned to a 16 byte boundry
|
|||||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||||
*/
|
*/
|
||||||
/* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */
|
/* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */
|
/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <mm_malloc.h>
|
#include <mm_malloc.h>
|
||||||
@ -72,23 +80,16 @@ Allocate memory aligned to a 16 byte boundry
|
|||||||
#define HAVE_MM_MALLOC
|
#define HAVE_MM_MALLOC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else /* Not WIN32 */
|
#else /* Not _WIN32 */
|
||||||
#if defined(__sun)
|
#if defined(__sun)
|
||||||
#define HAVE_MEMALIGN
|
#define HAVE_MEMALIGN
|
||||||
#elif defined(__GNUC__)
|
/* Linux x86_64 and OSX always align allocations to 16 bytes */
|
||||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
#elif !defined(__amd64__) && !defined(__APPLE__)
|
||||||
#define HAVE_MEMALIGN
|
#define HAVE_MEMALIGN
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
/* Linux x86_64 and OSX always align allocations to 16 bytes */
|
|
||||||
#elif !defined(__amd64__) && !defined(__APPLE__)
|
|
||||||
/* FIXME: Yes, this is a big assumption */
|
|
||||||
#define HAVE_POSIX_MEMALIGN
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define opj_aligned_malloc(size) malloc(size)
|
#define opj_aligned_malloc(size) malloc(size)
|
||||||
#define opj_aligned_free(m) free(m)
|
#define opj_aligned_free(m) free(m)
|
||||||
|
|
||||||
@ -120,19 +121,34 @@ Allocate memory aligned to a 16 byte boundry
|
|||||||
#define opj_aligned_free(m) free(m)
|
#define opj_aligned_free(m) free(m)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ALLOC_PERF_OPT
|
||||||
|
#undef opj_aligned_malloc
|
||||||
|
#define opj_aligned_malloc(size) opj_malloc(size)
|
||||||
|
#undef opj_aligned_free
|
||||||
|
#define opj_aligned_free(m) opj_free(m)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reallocate memory blocks.
|
Reallocate memory blocks.
|
||||||
@param memblock Pointer to previously allocated memory block
|
@param m Pointer to previously allocated memory block
|
||||||
@param size New size in bytes
|
@param s New size in bytes
|
||||||
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
||||||
*/
|
*/
|
||||||
|
#ifdef ALLOC_PERF_OPT
|
||||||
|
void * OPJ_CALLCONV opj_realloc(void * m, size_t s);
|
||||||
|
#else
|
||||||
#define opj_realloc(m, s) realloc(m, s)
|
#define opj_realloc(m, s) realloc(m, s)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deallocates or frees a memory block.
|
Deallocates or frees a memory block.
|
||||||
@param memblock Previously allocated memory block to be freed
|
@param m Previously allocated memory block to be freed
|
||||||
*/
|
*/
|
||||||
|
#ifdef ALLOC_PERF_OPT
|
||||||
|
void OPJ_CALLCONV opj_free(void * m);
|
||||||
|
#else
|
||||||
#define opj_free(m) free(m)
|
#define opj_free(m) free(m)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC poison malloc calloc realloc free
|
#pragma GCC poison malloc calloc realloc free
|
||||||
|
170
extern/libopenjpeg/phix_manager.c
vendored
Normal file
170
extern/libopenjpeg/phix_manager.c
vendored
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* $Id: phix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.c from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "opj_includes.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write faix box of phix
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] compno component number
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] EPHused true if if EPH option used
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of faix box
|
||||||
|
*/
|
||||||
|
int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp=0, compno, i;
|
||||||
|
opj_jp2_box_t *box;
|
||||||
|
|
||||||
|
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||||
|
|
||||||
|
for( i=0;i<2;i++){
|
||||||
|
if (i) cio_seek( cio, lenp);
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_PHIX, 4); /* PHIX */
|
||||||
|
|
||||||
|
write_manf( i, cstr_info.numcomps, box, cio);
|
||||||
|
|
||||||
|
for( compno=0; compno<cstr_info.numcomps; compno++){
|
||||||
|
box[compno].length = write_phixfaix( coff, compno, cstr_info, EPHused, j2klen, cio);
|
||||||
|
box[compno].type = JPIP_FAIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_free(box);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp, tileno, version, i, nmax, size_of_coding; /* 4 or 8 */
|
||||||
|
opj_tile_info_t *tile_Idx;
|
||||||
|
opj_packet_info_t packet;
|
||||||
|
int resno, precno, layno, num_packet;
|
||||||
|
int numOfres, numOfprec, numOflayers;
|
||||||
|
packet.end_ph_pos = packet.start_pos = -1;
|
||||||
|
(void)EPHused; /* unused ? */
|
||||||
|
|
||||||
|
if( j2klen > pow( 2, 32)){
|
||||||
|
size_of_coding = 8;
|
||||||
|
version = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
size_of_coding = 4;
|
||||||
|
version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||||
|
cio_write( cio, version,1); /* Version 0 = 4 bytes */
|
||||||
|
|
||||||
|
nmax = 0;
|
||||||
|
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
|
||||||
|
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
|
||||||
|
|
||||||
|
cio_write( cio, nmax, size_of_coding); /* NMAX */
|
||||||
|
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||||
|
|
||||||
|
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
|
||||||
|
tile_Idx = &cstr_info.tile[ tileno];
|
||||||
|
|
||||||
|
num_packet = 0;
|
||||||
|
numOfres = cstr_info.numdecompos[compno] + 1;
|
||||||
|
|
||||||
|
for( resno=0; resno<numOfres ; resno++){
|
||||||
|
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
|
||||||
|
for( precno=0; precno<numOfprec; precno++){
|
||||||
|
numOflayers = cstr_info.numlayers;
|
||||||
|
for( layno=0; layno<numOflayers; layno++){
|
||||||
|
|
||||||
|
switch ( cstr_info.prog){
|
||||||
|
case LRCP:
|
||||||
|
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||||
|
break;
|
||||||
|
case RLCP:
|
||||||
|
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||||
|
break;
|
||||||
|
case RPCL:
|
||||||
|
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
|
||||||
|
break;
|
||||||
|
case PCRL:
|
||||||
|
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
|
||||||
|
break;
|
||||||
|
case CPRL:
|
||||||
|
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "failed to ppix indexing\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, packet.end_ph_pos-packet.start_pos+1, size_of_coding); /* length */
|
||||||
|
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PADDING */
|
||||||
|
while( num_packet < nmax){
|
||||||
|
cio_write( cio, 0, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, 0, size_of_coding); /* length */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
64
extern/libopenjpeg/pi.c
vendored
64
extern/libopenjpeg/pi.c
vendored
@ -43,31 +43,31 @@ Get next packet in layer-resolution-component-precinct order.
|
|||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@return returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
static bool pi_next_lrcp(opj_pi_iterator_t * pi);
|
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi);
|
||||||
/**
|
/**
|
||||||
Get next packet in resolution-layer-component-precinct order.
|
Get next packet in resolution-layer-component-precinct order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@return returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
static bool pi_next_rlcp(opj_pi_iterator_t * pi);
|
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi);
|
||||||
/**
|
/**
|
||||||
Get next packet in resolution-precinct-component-layer order.
|
Get next packet in resolution-precinct-component-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@return returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
static bool pi_next_rpcl(opj_pi_iterator_t * pi);
|
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi);
|
||||||
/**
|
/**
|
||||||
Get next packet in precinct-component-resolution-layer order.
|
Get next packet in precinct-component-resolution-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@return returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
static bool pi_next_pcrl(opj_pi_iterator_t * pi);
|
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi);
|
||||||
/**
|
/**
|
||||||
Get next packet in component-precinct-resolution-layer order.
|
Get next packet in component-precinct-resolution-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@return returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
static bool pi_next_cprl(opj_pi_iterator_t * pi);
|
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi);
|
|||||||
==========================================================
|
==========================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||||
opj_pi_comp_t *comp = NULL;
|
opj_pi_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@ -108,7 +108,7 @@ static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
|||||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||||
if (!pi->include[index]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
LABEL_SKIP:;
|
||||||
}
|
}
|
||||||
@ -116,10 +116,10 @@ LABEL_SKIP:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||||
opj_pi_comp_t *comp = NULL;
|
opj_pi_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@ -147,7 +147,7 @@ static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
|||||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||||
if (!pi->include[index]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
LABEL_SKIP:;
|
||||||
}
|
}
|
||||||
@ -155,10 +155,10 @@ LABEL_SKIP:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pi_next_rpcl(opj_pi_iterator_t * pi) {
|
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi) {
|
||||||
opj_pi_comp_t *comp = NULL;
|
opj_pi_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@ -209,14 +209,14 @@ if (!pi->tp_on){
|
|||||||
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
||||||
rpx = res->pdx + levelno;
|
rpx = res->pdx + levelno;
|
||||||
rpy = res->pdy + levelno;
|
rpy = res->pdy + levelno;
|
||||||
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpx))))){
|
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res->pw==0)||(res->pw==0)) continue;
|
if ((res->pw==0)||(res->ph==0)) continue;
|
||||||
|
|
||||||
if ((trx0==trx1)||(try0==try1)) continue;
|
if ((trx0==trx1)||(try0==try1)) continue;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ if (!pi->tp_on){
|
|||||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||||
if (!pi->include[index]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
LABEL_SKIP:;
|
||||||
}
|
}
|
||||||
@ -238,10 +238,10 @@ LABEL_SKIP:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||||
opj_pi_comp_t *comp = NULL;
|
opj_pi_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@ -290,14 +290,14 @@ static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
|||||||
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
||||||
rpx = res->pdx + levelno;
|
rpx = res->pdx + levelno;
|
||||||
rpy = res->pdy + levelno;
|
rpy = res->pdy + levelno;
|
||||||
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpx))))){
|
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res->pw==0)||(res->pw==0)) continue;
|
if ((res->pw==0)||(res->ph==0)) continue;
|
||||||
|
|
||||||
if ((trx0==trx1)||(try0==try1)) continue;
|
if ((trx0==trx1)||(try0==try1)) continue;
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
|||||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||||
if (!pi->include[index]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
LABEL_SKIP:;
|
||||||
}
|
}
|
||||||
@ -319,10 +319,10 @@ LABEL_SKIP:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||||
opj_pi_comp_t *comp = NULL;
|
opj_pi_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@ -369,14 +369,14 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
|||||||
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
|
||||||
rpx = res->pdx + levelno;
|
rpx = res->pdx + levelno;
|
||||||
rpy = res->pdy + levelno;
|
rpy = res->pdy + levelno;
|
||||||
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpx))))){
|
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res->pw==0)||(res->pw==0)) continue;
|
if ((res->pw==0)||(res->ph==0)) continue;
|
||||||
|
|
||||||
if ((trx0==trx1)||(try0==try1)) continue;
|
if ((trx0==trx1)||(try0==try1)) continue;
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
|||||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||||
if (!pi->include[index]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
LABEL_SKIP:;
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ LABEL_SKIP:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -707,7 +707,7 @@ void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pi_next(opj_pi_iterator_t * pi) {
|
opj_bool pi_next(opj_pi_iterator_t * pi) {
|
||||||
switch (pi->poc.prg) {
|
switch (pi->poc.prg) {
|
||||||
case LRCP:
|
case LRCP:
|
||||||
return pi_next_lrcp(pi);
|
return pi_next_lrcp(pi);
|
||||||
@ -720,13 +720,13 @@ bool pi_next(opj_pi_iterator_t * pi) {
|
|||||||
case CPRL:
|
case CPRL:
|
||||||
return pi_next_cprl(pi);
|
return pi_next_cprl(pi);
|
||||||
case PROG_UNKNOWN:
|
case PROG_UNKNOWN:
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
|
opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
|
||||||
char prog[4];
|
char prog[4];
|
||||||
int i;
|
int i;
|
||||||
int incr_top=1,resetX=0;
|
int incr_top=1,resetX=0;
|
||||||
@ -748,7 +748,7 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
|
|||||||
case RPCL: strncpy(prog, "RPCL",4);
|
case RPCL: strncpy(prog, "RPCL",4);
|
||||||
break;
|
break;
|
||||||
case PROG_UNKNOWN:
|
case PROG_UNKNOWN:
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))){
|
if(!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))){
|
||||||
@ -958,6 +958,6 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
extern/libopenjpeg/pi.h
vendored
6
extern/libopenjpeg/pi.h
vendored
@ -115,12 +115,14 @@ Modify the packet iterator for enabling tile part generation
|
|||||||
@param pi Handle to the packet iterator generated in pi_initialise_encode
|
@param pi Handle to the packet iterator generated in pi_initialise_encode
|
||||||
@param cp Coding parameters
|
@param cp Coding parameters
|
||||||
@param tileno Number that identifies the tile for which to list the packets
|
@param tileno Number that identifies the tile for which to list the packets
|
||||||
|
@param pino Iterator index for pi
|
||||||
@param tpnum Tile part number of the current tile
|
@param tpnum Tile part number of the current tile
|
||||||
@param tppos The position of the tile part flag in the progression order
|
@param tppos The position of the tile part flag in the progression order
|
||||||
|
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
|
||||||
@param cur_totnum_tp The total number of tile parts in the current tile
|
@param cur_totnum_tp The total number of tile parts in the current tile
|
||||||
@return Returns true if an error is detected
|
@return Returns true if an error is detected
|
||||||
*/
|
*/
|
||||||
bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
|
opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
|
||||||
/**
|
/**
|
||||||
Create a packet iterator for Decoder
|
Create a packet iterator for Decoder
|
||||||
@param image Raw image for which the packets will be listed
|
@param image Raw image for which the packets will be listed
|
||||||
@ -145,7 +147,7 @@ Modify the packet iterator to point to the next packet
|
|||||||
@param pi Packet iterator to modify
|
@param pi Packet iterator to modify
|
||||||
@return Returns false if pi pointed to the last packet or else returns true
|
@return Returns false if pi pointed to the last packet or else returns true
|
||||||
*/
|
*/
|
||||||
bool pi_next(opj_pi_iterator_t * pi);
|
opj_bool pi_next(opj_pi_iterator_t * pi);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
173
extern/libopenjpeg/ppix_manager.c
vendored
Normal file
173
extern/libopenjpeg/ppix_manager.c
vendored
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ppix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.c from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "opj_includes.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write faix box of ppix
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] compno component number
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] EPHused true if if EPH option used
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of faix box
|
||||||
|
*/
|
||||||
|
int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp, compno, i;
|
||||||
|
opj_jp2_box_t *box;
|
||||||
|
|
||||||
|
/* printf("cstr_info.packno %d\n", cstr_info.packno); //NMAX? */
|
||||||
|
|
||||||
|
lenp = -1;
|
||||||
|
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||||
|
|
||||||
|
for (i=0;i<2;i++){
|
||||||
|
if (i) cio_seek( cio, lenp);
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_PPIX, 4); /* PPIX */
|
||||||
|
|
||||||
|
write_manf( i, cstr_info.numcomps, box, cio);
|
||||||
|
|
||||||
|
for (compno=0; compno<cstr_info.numcomps; compno++){
|
||||||
|
box[compno].length = write_ppixfaix( coff, compno, cstr_info, EPHused, j2klen, cio);
|
||||||
|
box[compno].type = JPIP_FAIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_free(box);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp, tileno, version, i, nmax, size_of_coding; /* 4 or 8*/
|
||||||
|
opj_tile_info_t *tile_Idx;
|
||||||
|
opj_packet_info_t packet;
|
||||||
|
int resno, precno, layno, num_packet;
|
||||||
|
int numOfres, numOfprec, numOflayers;
|
||||||
|
packet.end_pos = packet.end_ph_pos = packet.start_pos = -1;
|
||||||
|
(void)EPHused; /* unused ? */
|
||||||
|
|
||||||
|
if( j2klen > pow( 2, 32)){
|
||||||
|
size_of_coding = 8;
|
||||||
|
version = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
size_of_coding = 4;
|
||||||
|
version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||||
|
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
|
||||||
|
|
||||||
|
nmax = 0;
|
||||||
|
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
|
||||||
|
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
|
||||||
|
|
||||||
|
cio_write( cio, nmax, size_of_coding); /* NMAX */
|
||||||
|
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||||
|
|
||||||
|
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
|
||||||
|
tile_Idx = &cstr_info.tile[ tileno];
|
||||||
|
|
||||||
|
num_packet=0;
|
||||||
|
numOfres = cstr_info.numdecompos[compno] + 1;
|
||||||
|
|
||||||
|
for( resno=0; resno<numOfres ; resno++){
|
||||||
|
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
|
||||||
|
for( precno=0; precno<numOfprec; precno++){
|
||||||
|
numOflayers = cstr_info.numlayers;
|
||||||
|
for( layno=0; layno<numOflayers; layno++){
|
||||||
|
|
||||||
|
switch ( cstr_info.prog){
|
||||||
|
case LRCP:
|
||||||
|
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||||
|
break;
|
||||||
|
case RLCP:
|
||||||
|
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||||
|
break;
|
||||||
|
case RPCL:
|
||||||
|
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
|
||||||
|
break;
|
||||||
|
case PCRL:
|
||||||
|
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
|
||||||
|
break;
|
||||||
|
case CPRL:
|
||||||
|
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "failed to ppix indexing\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, packet.end_pos-packet.start_pos+1, size_of_coding); /* length */
|
||||||
|
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while( num_packet < nmax){ /* PADDING */
|
||||||
|
cio_write( cio, 0, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, 0, size_of_coding); /* length */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
486
extern/libopenjpeg/t1.c
vendored
486
extern/libopenjpeg/t1.c
vendored
@ -62,13 +62,25 @@ static void t1_enc_sigpass_step(
|
|||||||
/**
|
/**
|
||||||
Decode significant pass
|
Decode significant pass
|
||||||
*/
|
*/
|
||||||
static void t1_dec_sigpass_step(
|
static INLINE void t1_dec_sigpass_step_raw(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf,
|
||||||
|
int vsc);
|
||||||
|
static INLINE void t1_dec_sigpass_step_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf);
|
||||||
|
static INLINE void t1_dec_sigpass_step_mqc_vsc(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
int orient,
|
int orient,
|
||||||
int oneplushalf,
|
int oneplushalf,
|
||||||
char type,
|
|
||||||
int vsc);
|
int vsc);
|
||||||
/**
|
/**
|
||||||
Encode significant pass
|
Encode significant pass
|
||||||
@ -83,12 +95,19 @@ static void t1_enc_sigpass(
|
|||||||
/**
|
/**
|
||||||
Decode significant pass
|
Decode significant pass
|
||||||
*/
|
*/
|
||||||
static void t1_dec_sigpass(
|
static void t1_dec_sigpass_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int bpno,
|
int bpno,
|
||||||
int orient,
|
int orient,
|
||||||
char type,
|
|
||||||
int cblksty);
|
int cblksty);
|
||||||
|
static void t1_dec_sigpass_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno,
|
||||||
|
int orient);
|
||||||
|
static void t1_dec_sigpass_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno,
|
||||||
|
int orient);
|
||||||
/**
|
/**
|
||||||
Encode refinement pass
|
Encode refinement pass
|
||||||
*/
|
*/
|
||||||
@ -104,14 +123,27 @@ static void t1_enc_refpass_step(
|
|||||||
/**
|
/**
|
||||||
Decode refinement pass
|
Decode refinement pass
|
||||||
*/
|
*/
|
||||||
static void t1_dec_refpass_step(
|
static INLINE void t1_dec_refpass_step_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
int poshalf,
|
int poshalf,
|
||||||
int neghalf,
|
int neghalf,
|
||||||
char type,
|
|
||||||
int vsc);
|
int vsc);
|
||||||
|
static INLINE void t1_dec_refpass_step_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int poshalf,
|
||||||
|
int neghalf);
|
||||||
|
static INLINE void t1_dec_refpass_step_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int poshalf,
|
||||||
|
int neghalf,
|
||||||
|
int vsc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Encode refinement pass
|
Encode refinement pass
|
||||||
*/
|
*/
|
||||||
@ -124,11 +156,16 @@ static void t1_enc_refpass(
|
|||||||
/**
|
/**
|
||||||
Decode refinement pass
|
Decode refinement pass
|
||||||
*/
|
*/
|
||||||
static void t1_dec_refpass(
|
static void t1_dec_refpass_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int bpno,
|
int bpno,
|
||||||
char type,
|
|
||||||
int cblksty);
|
int cblksty);
|
||||||
|
static void t1_dec_refpass_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno);
|
||||||
|
static void t1_dec_refpass_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno);
|
||||||
/**
|
/**
|
||||||
Encode clean-up pass
|
Encode clean-up pass
|
||||||
*/
|
*/
|
||||||
@ -145,7 +182,19 @@ static void t1_enc_clnpass_step(
|
|||||||
/**
|
/**
|
||||||
Decode clean-up pass
|
Decode clean-up pass
|
||||||
*/
|
*/
|
||||||
|
static void t1_dec_clnpass_step_partial(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf);
|
||||||
static void t1_dec_clnpass_step(
|
static void t1_dec_clnpass_step(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf);
|
||||||
|
static void t1_dec_clnpass_step_vsc(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
@ -178,7 +227,8 @@ static double t1_getwmsedec(
|
|||||||
int bpno,
|
int bpno,
|
||||||
int qmfbid,
|
int qmfbid,
|
||||||
double stepsize,
|
double stepsize,
|
||||||
int numcomps);
|
int numcomps,
|
||||||
|
int mct);
|
||||||
/**
|
/**
|
||||||
Encode 1 code-block
|
Encode 1 code-block
|
||||||
@param t1 T1 handle
|
@param t1 T1 handle
|
||||||
@ -190,6 +240,7 @@ Encode 1 code-block
|
|||||||
@param stepsize
|
@param stepsize
|
||||||
@param cblksty Code-block style
|
@param cblksty Code-block style
|
||||||
@param numcomps
|
@param numcomps
|
||||||
|
@param mct
|
||||||
@param tile
|
@param tile
|
||||||
*/
|
*/
|
||||||
static void t1_encode_cblk(
|
static void t1_encode_cblk(
|
||||||
@ -202,6 +253,7 @@ static void t1_encode_cblk(
|
|||||||
double stepsize,
|
double stepsize,
|
||||||
int cblksty,
|
int cblksty,
|
||||||
int numcomps,
|
int numcomps,
|
||||||
|
int mct,
|
||||||
opj_tcd_tile_t * tile);
|
opj_tcd_tile_t * tile);
|
||||||
/**
|
/**
|
||||||
Decode 1 code-block
|
Decode 1 code-block
|
||||||
@ -321,29 +373,43 @@ static void t1_enc_sigpass_step(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void t1_dec_sigpass_step(
|
static INLINE void t1_dec_sigpass_step_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
int orient,
|
int orient,
|
||||||
int oneplushalf,
|
int oneplushalf,
|
||||||
char type,
|
|
||||||
int vsc)
|
int vsc)
|
||||||
{
|
{
|
||||||
int v, flag;
|
int v, flag;
|
||||||
|
|
||||||
opj_raw_t *raw = t1->raw; /* RAW component */
|
opj_raw_t *raw = t1->raw; /* RAW component */
|
||||||
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
|
||||||
|
OPJ_ARG_NOT_USED(orient);
|
||||||
|
|
||||||
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
||||||
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
|
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
|
||||||
if (type == T1_TYPE_RAW) {
|
|
||||||
if (raw_decode(raw)) {
|
if (raw_decode(raw)) {
|
||||||
v = raw_decode(raw); /* ESSAI */
|
v = raw_decode(raw); /* ESSAI */
|
||||||
*datap = v ? -oneplushalf : oneplushalf;
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
}
|
}
|
||||||
} else {
|
*flagsp |= T1_VISIT;
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static INLINE void t1_dec_sigpass_step_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf)
|
||||||
|
{
|
||||||
|
int v, flag;
|
||||||
|
|
||||||
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
|
|
||||||
|
flag = *flagsp;
|
||||||
|
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
|
||||||
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
||||||
if (mqc_decode(mqc)) {
|
if (mqc_decode(mqc)) {
|
||||||
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
||||||
@ -351,6 +417,30 @@ static void t1_dec_sigpass_step(
|
|||||||
*datap = v ? -oneplushalf : oneplushalf;
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
}
|
}
|
||||||
|
*flagsp |= T1_VISIT;
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static INLINE void t1_dec_sigpass_step_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf,
|
||||||
|
int vsc)
|
||||||
|
{
|
||||||
|
int v, flag;
|
||||||
|
|
||||||
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
|
|
||||||
|
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
||||||
|
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
||||||
|
if (mqc_decode(mqc)) {
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
||||||
|
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||||
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
}
|
}
|
||||||
*flagsp |= T1_VISIT;
|
*flagsp |= T1_VISIT;
|
||||||
}
|
}
|
||||||
@ -386,11 +476,10 @@ static void t1_enc_sigpass(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void t1_dec_sigpass(
|
static void t1_dec_sigpass_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int bpno,
|
int bpno,
|
||||||
int orient,
|
int orient,
|
||||||
char type,
|
|
||||||
int cblksty)
|
int cblksty)
|
||||||
{
|
{
|
||||||
int i, j, k, one, half, oneplushalf, vsc;
|
int i, j, k, one, half, oneplushalf, vsc;
|
||||||
@ -401,13 +490,79 @@ static void t1_dec_sigpass(
|
|||||||
for (i = 0; i < t1->w; ++i) {
|
for (i = 0; i < t1->w; ++i) {
|
||||||
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
||||||
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
||||||
t1_dec_sigpass_step(
|
t1_dec_sigpass_step_raw(
|
||||||
|
t1,
|
||||||
|
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
||||||
|
&t1->data[(j * t1->w) + i],
|
||||||
|
orient,
|
||||||
|
oneplushalf,
|
||||||
|
vsc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static void t1_dec_sigpass_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno,
|
||||||
|
int orient)
|
||||||
|
{
|
||||||
|
int i, j, k, one, half, oneplushalf;
|
||||||
|
int *data1 = t1->data;
|
||||||
|
flag_t *flags1 = &t1->flags[1];
|
||||||
|
one = 1 << bpno;
|
||||||
|
half = one >> 1;
|
||||||
|
oneplushalf = one | half;
|
||||||
|
for (k = 0; k < (t1->h & ~3); k += 4) {
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
data1 += t1->w << 2;
|
||||||
|
flags1 += t1->flags_stride << 2;
|
||||||
|
}
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
for (j = k; j < t1->h; ++j) {
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static void t1_dec_sigpass_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno,
|
||||||
|
int orient)
|
||||||
|
{
|
||||||
|
int i, j, k, one, half, oneplushalf, vsc;
|
||||||
|
one = 1 << bpno;
|
||||||
|
half = one >> 1;
|
||||||
|
oneplushalf = one | half;
|
||||||
|
for (k = 0; k < t1->h; k += 4) {
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
||||||
|
vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0;
|
||||||
|
t1_dec_sigpass_step_mqc_vsc(
|
||||||
t1,
|
t1,
|
||||||
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
||||||
&t1->data[(j * t1->w) + i],
|
&t1->data[(j * t1->w) + i],
|
||||||
orient,
|
orient,
|
||||||
oneplushalf,
|
oneplushalf,
|
||||||
type,
|
|
||||||
vsc);
|
vsc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,28 +597,64 @@ static void t1_enc_refpass_step(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void t1_dec_refpass_step(
|
static INLINE void t1_dec_refpass_step_raw(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int poshalf,
|
||||||
|
int neghalf,
|
||||||
|
int vsc)
|
||||||
|
{
|
||||||
|
int v, t, flag;
|
||||||
|
|
||||||
|
opj_raw_t *raw = t1->raw; /* RAW component */
|
||||||
|
|
||||||
|
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
||||||
|
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
|
||||||
|
v = raw_decode(raw);
|
||||||
|
t = v ? poshalf : neghalf;
|
||||||
|
*datap += *datap < 0 ? -t : t;
|
||||||
|
*flagsp |= T1_REFINE;
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static INLINE void t1_dec_refpass_step_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int poshalf,
|
||||||
|
int neghalf)
|
||||||
|
{
|
||||||
|
int v, t, flag;
|
||||||
|
|
||||||
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
|
|
||||||
|
flag = *flagsp;
|
||||||
|
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_mag(flag)); /* ESSAI */
|
||||||
|
v = mqc_decode(mqc);
|
||||||
|
t = v ? poshalf : neghalf;
|
||||||
|
*datap += *datap < 0 ? -t : t;
|
||||||
|
*flagsp |= T1_REFINE;
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static INLINE void t1_dec_refpass_step_mqc_vsc(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
int poshalf,
|
int poshalf,
|
||||||
int neghalf,
|
int neghalf,
|
||||||
char type,
|
|
||||||
int vsc)
|
int vsc)
|
||||||
{
|
{
|
||||||
int v, t, flag;
|
int v, t, flag;
|
||||||
|
|
||||||
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
opj_raw_t *raw = t1->raw; /* RAW component */
|
|
||||||
|
|
||||||
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
||||||
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
|
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
|
||||||
mqc_setcurctx(mqc, t1_getctxno_mag(flag)); /* ESSAI */
|
mqc_setcurctx(mqc, t1_getctxno_mag(flag)); /* ESSAI */
|
||||||
if (type == T1_TYPE_RAW) {
|
|
||||||
v = raw_decode(raw);
|
|
||||||
} else {
|
|
||||||
v = mqc_decode(mqc);
|
v = mqc_decode(mqc);
|
||||||
}
|
|
||||||
t = v ? poshalf : neghalf;
|
t = v ? poshalf : neghalf;
|
||||||
*datap += *datap < 0 ? -t : t;
|
*datap += *datap < 0 ? -t : t;
|
||||||
*flagsp |= T1_REFINE;
|
*flagsp |= T1_REFINE;
|
||||||
@ -498,10 +689,9 @@ static void t1_enc_refpass(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void t1_dec_refpass(
|
static void t1_dec_refpass_raw(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int bpno,
|
int bpno,
|
||||||
char type,
|
|
||||||
int cblksty)
|
int cblksty)
|
||||||
{
|
{
|
||||||
int i, j, k, one, poshalf, neghalf;
|
int i, j, k, one, poshalf, neghalf;
|
||||||
@ -513,13 +703,78 @@ static void t1_dec_refpass(
|
|||||||
for (i = 0; i < t1->w; ++i) {
|
for (i = 0; i < t1->w; ++i) {
|
||||||
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
||||||
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
||||||
t1_dec_refpass_step(
|
t1_dec_refpass_step_raw(
|
||||||
|
t1,
|
||||||
|
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
||||||
|
&t1->data[(j * t1->w) + i],
|
||||||
|
poshalf,
|
||||||
|
neghalf,
|
||||||
|
vsc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static void t1_dec_refpass_mqc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno)
|
||||||
|
{
|
||||||
|
int i, j, k, one, poshalf, neghalf;
|
||||||
|
int *data1 = t1->data;
|
||||||
|
flag_t *flags1 = &t1->flags[1];
|
||||||
|
one = 1 << bpno;
|
||||||
|
poshalf = one >> 1;
|
||||||
|
neghalf = bpno > 0 ? -poshalf : -1;
|
||||||
|
for (k = 0; k < (t1->h & ~3); k += 4) {
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
data1 += t1->w << 2;
|
||||||
|
flags1 += t1->flags_stride << 2;
|
||||||
|
}
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
for (j = k; j < t1->h; ++j) {
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static void t1_dec_refpass_mqc_vsc(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
int bpno)
|
||||||
|
{
|
||||||
|
int i, j, k, one, poshalf, neghalf;
|
||||||
|
int vsc;
|
||||||
|
one = 1 << bpno;
|
||||||
|
poshalf = one >> 1;
|
||||||
|
neghalf = bpno > 0 ? -poshalf : -1;
|
||||||
|
for (k = 0; k < t1->h; k += 4) {
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
for (j = k; j < k + 4 && j < t1->h; ++j) {
|
||||||
|
vsc = ((j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
||||||
|
t1_dec_refpass_step_mqc_vsc(
|
||||||
t1,
|
t1,
|
||||||
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
||||||
&t1->data[(j * t1->w) + i],
|
&t1->data[(j * t1->w) + i],
|
||||||
poshalf,
|
poshalf,
|
||||||
neghalf,
|
neghalf,
|
||||||
type,
|
|
||||||
vsc);
|
vsc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -561,7 +816,51 @@ LABEL_PARTIAL:
|
|||||||
*flagsp &= ~T1_VISIT;
|
*flagsp &= ~T1_VISIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void t1_dec_clnpass_step_partial(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf)
|
||||||
|
{
|
||||||
|
int v, flag;
|
||||||
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
|
|
||||||
|
OPJ_ARG_NOT_USED(orient);
|
||||||
|
|
||||||
|
flag = *flagsp;
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
||||||
|
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||||
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
|
*flagsp &= ~T1_VISIT;
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
static void t1_dec_clnpass_step(
|
static void t1_dec_clnpass_step(
|
||||||
|
opj_t1_t *t1,
|
||||||
|
flag_t *flagsp,
|
||||||
|
int *datap,
|
||||||
|
int orient,
|
||||||
|
int oneplushalf)
|
||||||
|
{
|
||||||
|
int v, flag;
|
||||||
|
|
||||||
|
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||||
|
|
||||||
|
flag = *flagsp;
|
||||||
|
if (!(flag & (T1_SIG | T1_VISIT))) {
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
||||||
|
if (mqc_decode(mqc)) {
|
||||||
|
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
||||||
|
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||||
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*flagsp &= ~T1_VISIT;
|
||||||
|
} /* VSC and BYPASS by Antonin */
|
||||||
|
|
||||||
|
static void t1_dec_clnpass_step_vsc(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
flag_t *flagsp,
|
flag_t *flagsp,
|
||||||
int *datap,
|
int *datap,
|
||||||
@ -589,7 +888,7 @@ LABEL_PARTIAL:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*flagsp &= ~T1_VISIT;
|
*flagsp &= ~T1_VISIT;
|
||||||
} /* VSC and BYPASS by Antonin */
|
}
|
||||||
|
|
||||||
static void t1_enc_clnpass(
|
static void t1_enc_clnpass(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
@ -669,21 +968,15 @@ static void t1_dec_clnpass(
|
|||||||
one = 1 << bpno;
|
one = 1 << bpno;
|
||||||
half = one >> 1;
|
half = one >> 1;
|
||||||
oneplushalf = one | half;
|
oneplushalf = one | half;
|
||||||
|
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
|
||||||
for (k = 0; k < t1->h; k += 4) {
|
for (k = 0; k < t1->h; k += 4) {
|
||||||
for (i = 0; i < t1->w; ++i) {
|
for (i = 0; i < t1->w; ++i) {
|
||||||
if (k + 3 < t1->h) {
|
if (k + 3 < t1->h) {
|
||||||
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
|
|
||||||
agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|| (MACRO_t1_flags(1 + k + 3,1 + i)
|
|| (MACRO_t1_flags(1 + k + 3,1 + i)
|
||||||
& (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
|
& (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
|
||||||
} else {
|
|
||||||
agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
|
||||||
|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
|
||||||
|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
|
||||||
|| MACRO_t1_flags(1 + k + 3,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
agg = 0;
|
agg = 0;
|
||||||
}
|
}
|
||||||
@ -699,8 +992,8 @@ static void t1_dec_clnpass(
|
|||||||
runlen = 0;
|
runlen = 0;
|
||||||
}
|
}
|
||||||
for (j = k + runlen; j < k + 4 && j < t1->h; ++j) {
|
for (j = k + runlen; j < k + 4 && j < t1->h; ++j) {
|
||||||
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
|
vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0;
|
||||||
t1_dec_clnpass_step(
|
t1_dec_clnpass_step_vsc(
|
||||||
t1,
|
t1,
|
||||||
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
|
||||||
&t1->data[(j * t1->w) + i],
|
&t1->data[(j * t1->w) + i],
|
||||||
@ -711,6 +1004,65 @@ static void t1_dec_clnpass(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
int *data1 = t1->data;
|
||||||
|
flag_t *flags1 = &t1->flags[1];
|
||||||
|
for (k = 0; k < (t1->h & ~3); k += 4) {
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|
|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|
|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|
||||||
|
|| MACRO_t1_flags(1 + k + 3,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
|
||||||
|
if (agg) {
|
||||||
|
mqc_setcurctx(mqc, T1_CTXNO_AGG);
|
||||||
|
if (!mqc_decode(mqc)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
mqc_setcurctx(mqc, T1_CTXNO_UNI);
|
||||||
|
runlen = mqc_decode(mqc);
|
||||||
|
runlen = (runlen << 1) | mqc_decode(mqc);
|
||||||
|
flags2 += runlen * t1->flags_stride;
|
||||||
|
data2 += runlen * t1->w;
|
||||||
|
for (j = k + runlen; j < k + 4 && j < t1->h; ++j) {
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
if (agg && (j == k + runlen)) {
|
||||||
|
t1_dec_clnpass_step_partial(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
} else {
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
}
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data1 += t1->w << 2;
|
||||||
|
flags1 += t1->flags_stride << 2;
|
||||||
|
}
|
||||||
|
for (i = 0; i < t1->w; ++i) {
|
||||||
|
int *data2 = data1 + i;
|
||||||
|
flag_t *flags2 = flags1 + i;
|
||||||
|
for (j = k; j < t1->h; ++j) {
|
||||||
|
flags2 += t1->flags_stride;
|
||||||
|
t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf);
|
||||||
|
data2 += t1->w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (segsym) {
|
if (segsym) {
|
||||||
int v = 0;
|
int v = 0;
|
||||||
mqc_setcurctx(mqc, T1_CTXNO_UNI);
|
mqc_setcurctx(mqc, T1_CTXNO_UNI);
|
||||||
@ -736,14 +1088,15 @@ static double t1_getwmsedec(
|
|||||||
int bpno,
|
int bpno,
|
||||||
int qmfbid,
|
int qmfbid,
|
||||||
double stepsize,
|
double stepsize,
|
||||||
int numcomps)
|
int numcomps,
|
||||||
|
int mct)
|
||||||
{
|
{
|
||||||
double w1, w2, wmsedec;
|
double w1, w2, wmsedec;
|
||||||
if (qmfbid == 1) {
|
if (qmfbid == 1) {
|
||||||
w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0;
|
w1 = (mct && numcomps==3) ? mct_getnorm(compno) : 1.0;
|
||||||
w2 = dwt_getnorm(level, orient);
|
w2 = dwt_getnorm(level, orient);
|
||||||
} else { /* if (qmfbid == 0) */
|
} else { /* if (qmfbid == 0) */
|
||||||
w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0;
|
w1 = (mct && numcomps==3) ? mct_getnorm_real(compno) : 1.0;
|
||||||
w2 = dwt_getnorm_real(level, orient);
|
w2 = dwt_getnorm_real(level, orient);
|
||||||
}
|
}
|
||||||
wmsedec = w1 * w2 * stepsize * (1 << bpno);
|
wmsedec = w1 * w2 * stepsize * (1 << bpno);
|
||||||
@ -752,7 +1105,7 @@ static double t1_getwmsedec(
|
|||||||
return wmsedec;
|
return wmsedec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool allocate_buffers(
|
static opj_bool allocate_buffers(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int w,
|
int w,
|
||||||
int h)
|
int h)
|
||||||
@ -764,7 +1117,7 @@ static bool allocate_buffers(
|
|||||||
opj_aligned_free(t1->data);
|
opj_aligned_free(t1->data);
|
||||||
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
|
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
|
||||||
if(!t1->data){
|
if(!t1->data){
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
t1->datasize=datasize;
|
t1->datasize=datasize;
|
||||||
}
|
}
|
||||||
@ -777,7 +1130,7 @@ static bool allocate_buffers(
|
|||||||
opj_aligned_free(t1->flags);
|
opj_aligned_free(t1->flags);
|
||||||
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
|
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
|
||||||
if(!t1->flags){
|
if(!t1->flags){
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
t1->flagssize=flagssize;
|
t1->flagssize=flagssize;
|
||||||
}
|
}
|
||||||
@ -786,7 +1139,7 @@ static bool allocate_buffers(
|
|||||||
t1->w=w;
|
t1->w=w;
|
||||||
t1->h=h;
|
t1->h=h;
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** mod fixed_quality */
|
/** mod fixed_quality */
|
||||||
@ -800,6 +1153,7 @@ static void t1_encode_cblk(
|
|||||||
double stepsize,
|
double stepsize,
|
||||||
int cblksty,
|
int cblksty,
|
||||||
int numcomps,
|
int numcomps,
|
||||||
|
int mct,
|
||||||
opj_tcd_tile_t * tile)
|
opj_tcd_tile_t * tile)
|
||||||
{
|
{
|
||||||
double cumwmsedec = 0.0;
|
double cumwmsedec = 0.0;
|
||||||
@ -850,7 +1204,7 @@ static void t1_encode_cblk(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fixed_quality */
|
/* fixed_quality */
|
||||||
tempwmsedec = t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps);
|
tempwmsedec = t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps, mct);
|
||||||
cumwmsedec += tempwmsedec;
|
cumwmsedec += tempwmsedec;
|
||||||
tile->distotile += tempwmsedec;
|
tile->distotile += tempwmsedec;
|
||||||
|
|
||||||
@ -971,10 +1325,26 @@ static void t1_decode_cblk(
|
|||||||
for (passno = 0; passno < seg->numpasses; ++passno) {
|
for (passno = 0; passno < seg->numpasses; ++passno) {
|
||||||
switch (passtype) {
|
switch (passtype) {
|
||||||
case 0:
|
case 0:
|
||||||
t1_dec_sigpass(t1, bpno+1, orient, type, cblksty);
|
if (type == T1_TYPE_RAW) {
|
||||||
|
t1_dec_sigpass_raw(t1, bpno+1, orient, cblksty);
|
||||||
|
} else {
|
||||||
|
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
|
||||||
|
t1_dec_sigpass_mqc_vsc(t1, bpno+1, orient);
|
||||||
|
} else {
|
||||||
|
t1_dec_sigpass_mqc(t1, bpno+1, orient);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
t1_dec_refpass(t1, bpno+1, type, cblksty);
|
if (type == T1_TYPE_RAW) {
|
||||||
|
t1_dec_refpass_raw(t1, bpno+1, cblksty);
|
||||||
|
} else {
|
||||||
|
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
|
||||||
|
t1_dec_refpass_mqc_vsc(t1, bpno+1);
|
||||||
|
} else {
|
||||||
|
t1_dec_refpass_mqc(t1, bpno+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
t1_dec_clnpass(t1, bpno+1, orient, cblksty);
|
t1_dec_clnpass(t1, bpno+1, orient, cblksty);
|
||||||
@ -1045,6 +1415,7 @@ void t1_encode_cblks(
|
|||||||
|
|
||||||
for (bandno = 0; bandno < res->numbands; ++bandno) {
|
for (bandno = 0; bandno < res->numbands; ++bandno) {
|
||||||
opj_tcd_band_t* restrict band = &res->bands[bandno];
|
opj_tcd_band_t* restrict band = &res->bands[bandno];
|
||||||
|
int bandconst = 8192 * 8192 / ((int) floor(band->stepsize * 8192));
|
||||||
|
|
||||||
for (precno = 0; precno < res->pw * res->ph; ++precno) {
|
for (precno = 0; precno < res->pw * res->ph; ++precno) {
|
||||||
opj_tcd_precinct_t *prc = &band->precincts[precno];
|
opj_tcd_precinct_t *prc = &band->precincts[precno];
|
||||||
@ -1095,7 +1466,7 @@ void t1_encode_cblks(
|
|||||||
datap[(j * cblk_w) + i] =
|
datap[(j * cblk_w) + i] =
|
||||||
fix_mul(
|
fix_mul(
|
||||||
tmp,
|
tmp,
|
||||||
8192 * 8192 / ((int) floor(band->stepsize * 8192))) >> (11 - T1_NMSEDEC_FRACBITS);
|
bandconst) >> (11 - T1_NMSEDEC_FRACBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1110,6 +1481,7 @@ void t1_encode_cblks(
|
|||||||
band->stepsize,
|
band->stepsize,
|
||||||
tccp->cblksty,
|
tccp->cblksty,
|
||||||
tile->numcomps,
|
tile->numcomps,
|
||||||
|
tcp->mct,
|
||||||
tile);
|
tile);
|
||||||
|
|
||||||
} /* cblkno */
|
} /* cblkno */
|
||||||
@ -1140,7 +1512,6 @@ void t1_decode_cblks(
|
|||||||
for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
|
for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
|
||||||
opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
|
opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
|
||||||
int* restrict datap;
|
int* restrict datap;
|
||||||
void* restrict tiledp;
|
|
||||||
int cblk_w, cblk_h;
|
int cblk_w, cblk_h;
|
||||||
int x, y;
|
int x, y;
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -1181,8 +1552,8 @@ void t1_decode_cblks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tiledp=(void*)&tilec->data[(y * tile_w) + x];
|
|
||||||
if (tccp->qmfbid == 1) {
|
if (tccp->qmfbid == 1) {
|
||||||
|
int* restrict tiledp = &tilec->data[(y * tile_w) + x];
|
||||||
for (j = 0; j < cblk_h; ++j) {
|
for (j = 0; j < cblk_h; ++j) {
|
||||||
for (i = 0; i < cblk_w; ++i) {
|
for (i = 0; i < cblk_w; ++i) {
|
||||||
int tmp = datap[(j * cblk_w) + i];
|
int tmp = datap[(j * cblk_w) + i];
|
||||||
@ -1190,11 +1561,16 @@ void t1_decode_cblks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { /* if (tccp->qmfbid == 0) */
|
} else { /* if (tccp->qmfbid == 0) */
|
||||||
|
float* restrict tiledp = (float*) &tilec->data[(y * tile_w) + x];
|
||||||
for (j = 0; j < cblk_h; ++j) {
|
for (j = 0; j < cblk_h; ++j) {
|
||||||
|
float* restrict tiledp2 = tiledp;
|
||||||
for (i = 0; i < cblk_w; ++i) {
|
for (i = 0; i < cblk_w; ++i) {
|
||||||
float tmp = datap[(j * cblk_w) + i] * band->stepsize;
|
float tmp = *datap * band->stepsize;
|
||||||
((float*)tiledp)[(j * tile_w) + i] = tmp;
|
*tiledp2 = tmp;
|
||||||
|
datap++;
|
||||||
|
tiledp2++;
|
||||||
}
|
}
|
||||||
|
tiledp += tile_w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
opj_free(cblk->data);
|
opj_free(cblk->data);
|
||||||
|
4
extern/libopenjpeg/t1.h
vendored
4
extern/libopenjpeg/t1.h
vendored
@ -135,8 +135,8 @@ void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
|||||||
/**
|
/**
|
||||||
Decode the code-blocks of a tile
|
Decode the code-blocks of a tile
|
||||||
@param t1 T1 handle
|
@param t1 T1 handle
|
||||||
@param tile The tile to decode
|
@param tilec The tile to decode
|
||||||
@param tcp Tile coding parameters
|
@param tccp Tile coding parameters
|
||||||
*/
|
*/
|
||||||
void t1_decode_cblks(opj_t1_t* t1, opj_tcd_tilecomp_t* tilec, opj_tccp_t* tccp);
|
void t1_decode_cblks(opj_t1_t* t1, opj_tcd_tilecomp_t* tilec, opj_tccp_t* tccp);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
42
extern/libopenjpeg/t2.c
vendored
42
extern/libopenjpeg/t2.c
vendored
@ -59,7 +59,8 @@ Encode a packet of a tile to a destination buffer
|
|||||||
*/
|
*/
|
||||||
static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tileno);
|
static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tileno);
|
||||||
/**
|
/**
|
||||||
@param seg
|
@param cblk
|
||||||
|
@param index
|
||||||
@param cblksty
|
@param cblksty
|
||||||
@param first
|
@param first
|
||||||
*/
|
*/
|
||||||
@ -72,6 +73,7 @@ Decode a packet of a tile from a source buffer
|
|||||||
@param tile Tile for which to write the packets
|
@param tile Tile for which to write the packets
|
||||||
@param tcp Tile coding parameters
|
@param tcp Tile coding parameters
|
||||||
@param pi Packet identity
|
@param pi Packet identity
|
||||||
|
@param pack_info Packet information
|
||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
|
static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
|
||||||
@ -147,8 +149,8 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera
|
|||||||
c[1] = 145;
|
c[1] = 145;
|
||||||
c[2] = 0;
|
c[2] = 0;
|
||||||
c[3] = 4;
|
c[3] = 4;
|
||||||
c[4] = (tile->packno % 65536) / 256;
|
c[4] = (unsigned char)((tile->packno % 65536) / 256);
|
||||||
c[5] = (tile->packno % 65536) % 256;
|
c[5] = (unsigned char)((tile->packno % 65536) % 256);
|
||||||
c += 6;
|
c += 6;
|
||||||
}
|
}
|
||||||
/* </SOP> */
|
/* </SOP> */
|
||||||
@ -253,8 +255,8 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera
|
|||||||
/* </EPH> */
|
/* </EPH> */
|
||||||
|
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
// End of packet header position. Currently only represents the distance to start of packet
|
/* End of packet header position. Currently only represents the distance to start of packet
|
||||||
// Will be updated later by incrementing with packet start value
|
// Will be updated later by incrementing with packet start value */
|
||||||
if(cstr_info && cstr_info->index_write) {
|
if(cstr_info && cstr_info->index_write) {
|
||||||
opj_packet_info_t *info_PK = &cstr_info->tile[tileno].packet[cstr_info->packno];
|
opj_packet_info_t *info_PK = &cstr_info->tile[tileno].packet[cstr_info->packno];
|
||||||
info_PK->end_ph_pos = (int)(c - dest);
|
info_PK->end_ph_pos = (int)(c - dest);
|
||||||
@ -401,8 +403,8 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
// End of packet header position. Currently only represents the distance to start of packet
|
/* End of packet header position. Currently only represents the distance to start of packet
|
||||||
// Will be updated later by incrementing with packet start value
|
// Will be updated later by incrementing with packet start value*/
|
||||||
if(pack_info) {
|
if(pack_info) {
|
||||||
pack_info->end_ph_pos = (int)(c - src);
|
pack_info->end_ph_pos = (int)(c - src);
|
||||||
}
|
}
|
||||||
@ -494,14 +496,15 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
|||||||
if (tcp->csty & J2K_CP_CSTY_EPH) {
|
if (tcp->csty & J2K_CP_CSTY_EPH) {
|
||||||
if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
|
if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
|
||||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
|
opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
|
||||||
|
return -999;
|
||||||
} else {
|
} else {
|
||||||
hd += 2;
|
hd += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
// End of packet header position. Currently only represents the distance to start of packet
|
/* End of packet header position. Currently only represents the distance to start of packet
|
||||||
// Will be updated later by incrementing with packet start value
|
// Will be updated later by incrementing with packet start value*/
|
||||||
if(pack_info) {
|
if(pack_info) {
|
||||||
pack_info->end_ph_pos = (int)(hd - src);
|
pack_info->end_ph_pos = (int)(hd - src);
|
||||||
}
|
}
|
||||||
@ -565,7 +568,7 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
|||||||
|
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
cblk->data = (unsigned char*) opj_realloc(cblk->data, (cblk->len + seg->newlen) * sizeof(unsigned char*));
|
cblk->data = (unsigned char*) opj_realloc(cblk->data, (cblk->len + seg->newlen) * sizeof(unsigned char));
|
||||||
memcpy(cblk->data + cblk->len, c, seg->newlen);
|
memcpy(cblk->data + cblk->len, c, seg->newlen);
|
||||||
if (seg->numpasses == 0) {
|
if (seg->numpasses == 0) {
|
||||||
seg->data = &cblk->data;
|
seg->data = &cblk->data;
|
||||||
@ -614,6 +617,7 @@ int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlaye
|
|||||||
int tpnum = compno;
|
int tpnum = compno;
|
||||||
if (pi_create_encode(pi, cp,tileno,poc,tpnum,tppos,t2_mode,cur_totnum_tp)) {
|
if (pi_create_encode(pi, cp,tileno,poc,tpnum,tppos,t2_mode,cur_totnum_tp)) {
|
||||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Error initializing Packet Iterator\n");
|
opj_event_msg(t2->cinfo, EVT_ERROR, "Error initializing Packet Iterator\n");
|
||||||
|
pi_destroy(pi, cp, tileno);
|
||||||
return -999;
|
return -999;
|
||||||
}
|
}
|
||||||
while (pi_next(&pi[poc])) {
|
while (pi_next(&pi[poc])) {
|
||||||
@ -658,8 +662,8 @@ int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlaye
|
|||||||
info_PK->start_pos = ((cp->tp_on | tcp->POC)&& info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
info_PK->start_pos = ((cp->tp_on | tcp->POC)&& info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
||||||
}
|
}
|
||||||
info_PK->end_pos = info_PK->start_pos + e - 1;
|
info_PK->end_pos = info_PK->start_pos + e - 1;
|
||||||
info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance
|
info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
|
||||||
// to start of packet is incremented by value of start of packet
|
// to start of packet is incremented by value of start of packet*/
|
||||||
}
|
}
|
||||||
|
|
||||||
cstr_info->packno++;
|
cstr_info->packno++;
|
||||||
@ -710,7 +714,7 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
|||||||
} else {
|
} else {
|
||||||
e = 0;
|
e = 0;
|
||||||
}
|
}
|
||||||
|
if(e == -999) return -999;
|
||||||
/* progression in resolution */
|
/* progression in resolution */
|
||||||
image->comps[pi[pino].compno].resno_decoded =
|
image->comps[pi[pino].compno].resno_decoded =
|
||||||
(e > 0) ?
|
(e > 0) ?
|
||||||
@ -724,8 +728,9 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
|||||||
opj_packet_info_t *info_PK = &info_TL->packet[cstr_info->packno];
|
opj_packet_info_t *info_PK = &info_TL->packet[cstr_info->packno];
|
||||||
if (!cstr_info->packno) {
|
if (!cstr_info->packno) {
|
||||||
info_PK->start_pos = info_TL->end_header + 1;
|
info_PK->start_pos = info_TL->end_header + 1;
|
||||||
} else if (info_TL->packet[cstr_info->packno-1].end_pos >= (int)cstr_info->tile[tileno].tp[curtp].tp_end_pos){ // New tile part
|
} else if (info_TL->packet[cstr_info->packno-1].end_pos >= (int)cstr_info->tile[tileno].tp[curtp].tp_end_pos){ /* New tile part*/
|
||||||
info_TL->tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; // Number of packets in previous tile-part
|
info_TL->tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in previous tile-part*/
|
||||||
|
info_TL->tp[curtp].tp_start_pack = tp_start_packno;
|
||||||
tp_start_packno = cstr_info->packno;
|
tp_start_packno = cstr_info->packno;
|
||||||
curtp++;
|
curtp++;
|
||||||
info_PK->start_pos = cstr_info->tile[tileno].tp[curtp].tp_end_header+1;
|
info_PK->start_pos = cstr_info->tile[tileno].tp[curtp].tp_end_header+1;
|
||||||
@ -733,8 +738,8 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
|||||||
info_PK->start_pos = (cp->tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
info_PK->start_pos = (cp->tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
||||||
}
|
}
|
||||||
info_PK->end_pos = info_PK->start_pos + e - 1;
|
info_PK->end_pos = info_PK->start_pos + e - 1;
|
||||||
info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance
|
info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
|
||||||
// to start of packet is incremented by value of start of packet
|
// to start of packet is incremented by value of start of packet*/
|
||||||
cstr_info->packno++;
|
cstr_info->packno++;
|
||||||
}
|
}
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
@ -748,7 +753,8 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
|||||||
}
|
}
|
||||||
/* INDEX >> */
|
/* INDEX >> */
|
||||||
if(cstr_info) {
|
if(cstr_info) {
|
||||||
cstr_info->tile[tileno].tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; // Number of packets in last tile-part
|
cstr_info->tile[tileno].tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in last tile-part*/
|
||||||
|
cstr_info->tile[tileno].tp[curtp].tp_start_pack = tp_start_packno;
|
||||||
}
|
}
|
||||||
/* << INDEX */
|
/* << INDEX */
|
||||||
|
|
||||||
|
2
extern/libopenjpeg/t2.h
vendored
2
extern/libopenjpeg/t2.h
vendored
@ -67,6 +67,7 @@ Encode the packets of a tile to a destination buffer
|
|||||||
@param cstr_info Codestream information structure
|
@param cstr_info Codestream information structure
|
||||||
@param tpnum Tile part number of the current tile
|
@param tpnum Tile part number of the current tile
|
||||||
@param tppos The position of the tile part flag in the progression order
|
@param tppos The position of the tile part flag in the progression order
|
||||||
|
@param pino
|
||||||
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
|
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
|
||||||
@param cur_totnum_tp The total number of tile parts in the current tile
|
@param cur_totnum_tp The total number of tile parts in the current tile
|
||||||
*/
|
*/
|
||||||
@ -78,6 +79,7 @@ Decode the packets of a tile from a source buffer
|
|||||||
@param len length of the source buffer
|
@param len length of the source buffer
|
||||||
@param tileno number that identifies the tile for which to decode the packets
|
@param tileno number that identifies the tile for which to decode the packets
|
||||||
@param tile tile for which to decode the packets
|
@param tile tile for which to decode the packets
|
||||||
|
@param cstr_info Codestream information structure
|
||||||
*/
|
*/
|
||||||
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info);
|
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info);
|
||||||
|
|
||||||
|
42
extern/libopenjpeg/tcd.c
vendored
42
extern/libopenjpeg/tcd.c
vendored
@ -33,7 +33,7 @@
|
|||||||
#include "opj_includes.h"
|
#include "opj_includes.h"
|
||||||
|
|
||||||
void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
|
void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
|
||||||
int tileno, compno, resno, bandno, precno;//, cblkno;
|
int tileno, compno, resno, bandno, precno;/*, cblkno;*/
|
||||||
|
|
||||||
fprintf(fd, "image {\n");
|
fprintf(fd, "image {\n");
|
||||||
fprintf(fd, " tw=%d, th=%d x0=%d x1=%d y0=%d y1=%d\n",
|
fprintf(fd, " tw=%d, th=%d x0=%d x1=%d y0=%d y1=%d\n",
|
||||||
@ -290,6 +290,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c
|
|||||||
for (i = 0; i < res->pw * res->ph * 3; i++) {
|
for (i = 0; i < res->pw * res->ph * 3; i++) {
|
||||||
band->precincts[i].imsbtree = NULL;
|
band->precincts[i].imsbtree = NULL;
|
||||||
band->precincts[i].incltree = NULL;
|
band->precincts[i].incltree = NULL;
|
||||||
|
band->precincts[i].cblks.enc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (precno = 0; precno < res->pw * res->ph; precno++) {
|
for (precno = 0; precno < res->pw * res->ph; precno++) {
|
||||||
@ -418,6 +419,13 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur
|
|||||||
/* Modification of the RATE >> */
|
/* Modification of the RATE >> */
|
||||||
for (j = 0; j < tcp->numlayers; j++) {
|
for (j = 0; j < tcp->numlayers; j++) {
|
||||||
tcp->rates[j] = tcp->rates[j] ?
|
tcp->rates[j] = tcp->rates[j] ?
|
||||||
|
cp->tp_on ?
|
||||||
|
(((float) (tile->numcomps
|
||||||
|
* (tile->x1 - tile->x0)
|
||||||
|
* (tile->y1 - tile->y0)
|
||||||
|
* image->comps[0].prec))
|
||||||
|
/(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) - (((tcd->cur_totnum_tp - 1) * 14 )/ tcp->numlayers)
|
||||||
|
:
|
||||||
((float) (tile->numcomps
|
((float) (tile->numcomps
|
||||||
* (tile->x1 - tile->x0)
|
* (tile->x1 - tile->x0)
|
||||||
* (tile->y1 - tile->y0)
|
* (tile->y1 - tile->y0)
|
||||||
@ -584,7 +592,9 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur
|
|||||||
cblk->y0 = int_max(cblkystart, prc->y0);
|
cblk->y0 = int_max(cblkystart, prc->y0);
|
||||||
cblk->x1 = int_min(cblkxend, prc->x1);
|
cblk->x1 = int_min(cblkxend, prc->x1);
|
||||||
cblk->y1 = int_min(cblkyend, prc->y1);
|
cblk->y1 = int_min(cblkyend, prc->y1);
|
||||||
cblk->data = (unsigned char*) opj_calloc(8192, sizeof(unsigned char));
|
cblk->data = (unsigned char*) opj_calloc(8192+2, sizeof(unsigned char));
|
||||||
|
/* FIXME: mqc_init_enc and mqc_byteout underrun the buffer if we don't do this. Why? */
|
||||||
|
cblk->data += 2;
|
||||||
cblk->layers = (opj_tcd_layer_t*) opj_calloc(100, sizeof(opj_tcd_layer_t));
|
cblk->layers = (opj_tcd_layer_t*) opj_calloc(100, sizeof(opj_tcd_layer_t));
|
||||||
cblk->passes = (opj_tcd_pass_t*) opj_calloc(100, sizeof(opj_tcd_pass_t));
|
cblk->passes = (opj_tcd_pass_t*) opj_calloc(100, sizeof(opj_tcd_pass_t));
|
||||||
}
|
}
|
||||||
@ -647,7 +657,7 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp) {
|
|||||||
tilec->y1 = int_ceildiv(tile->y1, image->comps[i].dy);
|
tilec->y1 = int_ceildiv(tile->y1, image->comps[i].dy);
|
||||||
|
|
||||||
x0 = j == 0 ? tilec->x0 : int_min(x0, (unsigned int) tilec->x0);
|
x0 = j == 0 ? tilec->x0 : int_min(x0, (unsigned int) tilec->x0);
|
||||||
y0 = j == 0 ? tilec->y0 : int_min(y0, (unsigned int) tilec->x0);
|
y0 = j == 0 ? tilec->y0 : int_min(y0, (unsigned int) tilec->y0);
|
||||||
x1 = j == 0 ? tilec->x1 : int_max(x1, (unsigned int) tilec->x1);
|
x1 = j == 0 ? tilec->x1 : int_max(x1, (unsigned int) tilec->x1);
|
||||||
y1 = j == 0 ? tilec->y1 : int_max(y1, (unsigned int) tilec->y1);
|
y1 = j == 0 ? tilec->y1 : int_max(y1, (unsigned int) tilec->y1);
|
||||||
}
|
}
|
||||||
@ -667,6 +677,8 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
|
|||||||
opj_tcp_t *tcp;
|
opj_tcp_t *tcp;
|
||||||
opj_tcd_tile_t *tile;
|
opj_tcd_tile_t *tile;
|
||||||
|
|
||||||
|
OPJ_ARG_NOT_USED(cstr_info);
|
||||||
|
|
||||||
tcd->cp = cp;
|
tcd->cp = cp;
|
||||||
|
|
||||||
tcp = &(cp->tcps[cp->tileno[tileno]]);
|
tcp = &(cp->tcps[cp->tileno[tileno]]);
|
||||||
@ -988,7 +1000,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
||||||
int compno, resno, bandno, precno, cblkno, passno, layno;
|
int compno, resno, bandno, precno, cblkno, passno, layno;
|
||||||
double min, max;
|
double min, max;
|
||||||
double cumdisto[100]; /* fixed_quality */
|
double cumdisto[100]; /* fixed_quality */
|
||||||
@ -1085,7 +1097,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
|
|||||||
opj_t2_t *t2 = t2_create(tcd->cinfo, tcd->image, cp);
|
opj_t2_t *t2 = t2_create(tcd->cinfo, tcd->image, cp);
|
||||||
double thresh = 0;
|
double thresh = 0;
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
int l = 0;
|
int l = 0;
|
||||||
double distoachieved = 0; /* fixed_quality */
|
double distoachieved = 0; /* fixed_quality */
|
||||||
thresh = (lo + hi) / 2;
|
thresh = (lo + hi) / 2;
|
||||||
@ -1140,7 +1152,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cstr_info) { /* Threshold for Marcela Index */
|
if(cstr_info) { /* Threshold for Marcela Index */
|
||||||
@ -1152,7 +1164,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
|
|||||||
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
|
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
||||||
@ -1304,7 +1316,7 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
|
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
|
||||||
int l;
|
int l;
|
||||||
int compno;
|
int compno;
|
||||||
int eof = 0;
|
int eof = 0;
|
||||||
@ -1340,7 +1352,7 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cstr_info->tile[tileno].pdx[resno] = 15;
|
cstr_info->tile[tileno].pdx[resno] = 15;
|
||||||
cstr_info->tile[tileno].pdx[resno] = 15;
|
cstr_info->tile[tileno].pdy[resno] = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1387,7 +1399,7 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
|||||||
if (tcd->image->comps[compno].resno_decoded < 0) {
|
if (tcd->image->comps[compno].resno_decoded < 0) {
|
||||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
|
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
|
||||||
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
|
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,6 +1419,8 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
|||||||
|
|
||||||
if (tcd->tcp->mct) {
|
if (tcd->tcp->mct) {
|
||||||
int n = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0);
|
int n = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0);
|
||||||
|
|
||||||
|
if (tile->numcomps >= 3 ){
|
||||||
if (tcd->tcp->tccps[0].qmfbid == 1) {
|
if (tcd->tcp->tccps[0].qmfbid == 1) {
|
||||||
mct_decode(
|
mct_decode(
|
||||||
tile->comps[0].data,
|
tile->comps[0].data,
|
||||||
@ -1420,6 +1434,9 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
|||||||
(float*)tile->comps[2].data,
|
(float*)tile->comps[2].data,
|
||||||
n);
|
n);
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
opj_event_msg(tcd->cinfo, EVT_WARNING,"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",tile->numcomps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------TILE-------------------*/
|
/*---------------TILE-------------------*/
|
||||||
@ -1467,10 +1484,10 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
|||||||
opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
|
opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
|
||||||
|
|
||||||
if (eof) {
|
if (eof) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tcd_free_decode(opj_tcd_t *tcd) {
|
void tcd_free_decode(opj_tcd_t *tcd) {
|
||||||
@ -1504,3 +1521,4 @@ void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
5
extern/libopenjpeg/tcd.h
vendored
5
extern/libopenjpeg/tcd.h
vendored
@ -251,7 +251,7 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
|
|||||||
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
|
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
|
||||||
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
|
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
|
||||||
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
|
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
|
||||||
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
|
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
|
||||||
/**
|
/**
|
||||||
Encode a tile from the raw image into a buffer
|
Encode a tile from the raw image into a buffer
|
||||||
@param tcd TCD handle
|
@param tcd TCD handle
|
||||||
@ -268,8 +268,9 @@ Decode a tile from a buffer into a raw image
|
|||||||
@param src Source buffer
|
@param src Source buffer
|
||||||
@param len Length of source buffer
|
@param len Length of source buffer
|
||||||
@param tileno Number that identifies one of the tiles to be decoded
|
@param tileno Number that identifies one of the tiles to be decoded
|
||||||
|
@param cstr_info Codestream information structure
|
||||||
*/
|
*/
|
||||||
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
|
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
|
||||||
/**
|
/**
|
||||||
Free the memory allocated for decoding
|
Free the memory allocated for decoding
|
||||||
@param tcd TCD handle
|
@param tcd TCD handle
|
||||||
|
120
extern/libopenjpeg/thix_manager.c
vendored
Normal file
120
extern/libopenjpeg/thix_manager.c
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* $Id: thix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.c from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "opj_includes.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write tile-part headers mhix box
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] tileno tile number
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of mhix box
|
||||||
|
*/
|
||||||
|
int write_tilemhix( int coff, opj_codestream_info_t cstr_info, int tileno, opj_cio_t *cio);
|
||||||
|
|
||||||
|
int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
int tileno;
|
||||||
|
opj_jp2_box_t *box;
|
||||||
|
|
||||||
|
lenp = 0;
|
||||||
|
box = (opj_jp2_box_t *)opj_calloc( cstr_info.tw*cstr_info.th, sizeof(opj_jp2_box_t));
|
||||||
|
|
||||||
|
for ( i = 0; i < 2 ; i++ ){
|
||||||
|
if (i)
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_THIX, 4); /* THIX */
|
||||||
|
write_manf( i, cstr_info.tw*cstr_info.th, box, cio);
|
||||||
|
|
||||||
|
for (tileno = 0; tileno < cstr_info.tw*cstr_info.th; tileno++){
|
||||||
|
box[tileno].length = write_tilemhix( coff, cstr_info, tileno, cio);
|
||||||
|
box[tileno].type = JPIP_MHIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_free(box);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_tilemhix( int coff, opj_codestream_info_t cstr_info, int tileno, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
opj_tile_info_t tile;
|
||||||
|
opj_tp_info_t tp;
|
||||||
|
int len, lenp;
|
||||||
|
opj_marker_info_t *marker;
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_MHIX, 4); /* MHIX */
|
||||||
|
|
||||||
|
tile = cstr_info.tile[tileno];
|
||||||
|
tp = tile.tp[0];
|
||||||
|
|
||||||
|
cio_write( cio, tp.tp_end_header-tp.tp_start_pos+1, 8); /* TLEN */
|
||||||
|
|
||||||
|
marker = cstr_info.tile[tileno].marker;
|
||||||
|
|
||||||
|
for( i=0; i<cstr_info.tile[tileno].marknum; i++){ /* Marker restricted to 1 apparition */
|
||||||
|
cio_write( cio, marker[i].type, 2);
|
||||||
|
cio_write( cio, 0, 2);
|
||||||
|
cio_write( cio, marker[i].pos-coff, 8);
|
||||||
|
cio_write( cio, marker[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free( marker);*/
|
||||||
|
|
||||||
|
len = cio_tell( cio) - lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
153
extern/libopenjpeg/tpix_manager.c
vendored
Normal file
153
extern/libopenjpeg/tpix_manager.c
vendored
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
* $Id: tpix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Modification of jpip.c from 2KAN indexer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "opj_includes.h"
|
||||||
|
|
||||||
|
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write faix box of tpix
|
||||||
|
*
|
||||||
|
* @param[in] coff offset of j2k codestream
|
||||||
|
* @param[in] compno component number
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @param[in] j2klen length of j2k codestream
|
||||||
|
* @param[in] cio file output handle
|
||||||
|
* @return length of faix box
|
||||||
|
*/
|
||||||
|
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio);
|
||||||
|
|
||||||
|
|
||||||
|
int write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_TPIX, 4); /* TPIX */
|
||||||
|
|
||||||
|
write_tpixfaix( coff, 0, cstr_info, j2klen, cio);
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get number of maximum tile parts per tile
|
||||||
|
*
|
||||||
|
* @param[in] cstr_info codestream information
|
||||||
|
* @return number of maximum tile parts per tile
|
||||||
|
*/
|
||||||
|
int get_num_max_tile_parts( opj_codestream_info_t cstr_info);
|
||||||
|
|
||||||
|
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
int i, j;
|
||||||
|
int Aux;
|
||||||
|
int num_max_tile_parts;
|
||||||
|
int size_of_coding; /* 4 or 8 */
|
||||||
|
opj_tp_info_t tp;
|
||||||
|
int version;
|
||||||
|
|
||||||
|
num_max_tile_parts = get_num_max_tile_parts( cstr_info);
|
||||||
|
|
||||||
|
if( j2klen > pow( 2, 32)){
|
||||||
|
size_of_coding = 8;
|
||||||
|
version = num_max_tile_parts == 1 ? 1:3;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
size_of_coding = 4;
|
||||||
|
version = num_max_tile_parts == 1 ? 0:2;
|
||||||
|
}
|
||||||
|
|
||||||
|
lenp = cio_tell( cio);
|
||||||
|
cio_skip( cio, 4); /* L [at the end] */
|
||||||
|
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||||
|
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
|
||||||
|
|
||||||
|
cio_write( cio, num_max_tile_parts, size_of_coding); /* NMAX */
|
||||||
|
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||||
|
for (i = 0; i < cstr_info.tw*cstr_info.th; i++){
|
||||||
|
for (j = 0; j < cstr_info.tile[i].num_tps; j++){
|
||||||
|
tp = cstr_info.tile[i].tp[j];
|
||||||
|
cio_write( cio, tp.tp_start_pos-coff, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, tp.tp_end_pos-tp.tp_start_pos+1, size_of_coding); /* length */
|
||||||
|
if (version & 0x02){
|
||||||
|
if( cstr_info.tile[i].num_tps == 1 && cstr_info.numdecompos[compno] > 1)
|
||||||
|
Aux = cstr_info.numdecompos[compno] + 1;
|
||||||
|
else
|
||||||
|
Aux = j + 1;
|
||||||
|
|
||||||
|
cio_write( cio, Aux,4);
|
||||||
|
/*cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4);*/ /* Aux_i,j : Auxiliary value */
|
||||||
|
/* fprintf(stderr,"AUX value %d\n",Aux);*/
|
||||||
|
}
|
||||||
|
/*cio_write(0,4);*/
|
||||||
|
}
|
||||||
|
/* PADDING */
|
||||||
|
while (j < num_max_tile_parts){
|
||||||
|
cio_write( cio, 0, size_of_coding); /* start position */
|
||||||
|
cio_write( cio, 0, size_of_coding); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write( cio, 0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = cio_tell( cio)-lenp;
|
||||||
|
cio_seek( cio, lenp);
|
||||||
|
cio_write( cio, len, 4); /* L */
|
||||||
|
cio_seek( cio, lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_num_max_tile_parts( opj_codestream_info_t cstr_info)
|
||||||
|
{
|
||||||
|
int num_max_tp = 0, i;
|
||||||
|
|
||||||
|
for( i=0; i<cstr_info.tw*cstr_info.th; i++)
|
||||||
|
num_max_tp = MAX( cstr_info.tile[i].num_tps, num_max_tp);
|
||||||
|
|
||||||
|
return num_max_tp;
|
||||||
|
}
|
2
extern/recastnavigation/recast-capi.cpp
vendored
2
extern/recastnavigation/recast-capi.cpp
vendored
@ -278,7 +278,7 @@ static inline void swapfunc(char *, char *, int, int);
|
|||||||
#define min(a, b) (a) < (b) ? a : b
|
#define min(a, b) (a) < (b) ? a : b
|
||||||
#define swapcode(TYPE, parmi, parmj, n) \
|
#define swapcode(TYPE, parmi, parmj, n) \
|
||||||
{ \
|
{ \
|
||||||
long i = (n) / sizeof (TYPE); \
|
long i = (n) / sizeof(TYPE); \
|
||||||
TYPE *pi = (TYPE *) (parmi); \
|
TYPE *pi = (TYPE *) (parmi); \
|
||||||
TYPE *pj = (TYPE *) (parmj); \
|
TYPE *pj = (TYPE *) (parmj); \
|
||||||
do { \
|
do { \
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "AUD_PyAPI.h"
|
#include "AUD_PyAPI.h"
|
||||||
#include "structmember.h"
|
#include <structmember.h>
|
||||||
|
|
||||||
#include "AUD_I3DDevice.h"
|
#include "AUD_I3DDevice.h"
|
||||||
#include "AUD_I3DHandle.h"
|
#include "AUD_I3DHandle.h"
|
||||||
|
@ -143,23 +143,23 @@ void AUD_FFMPEGReader::init()
|
|||||||
|
|
||||||
switch(m_codecCtx->sample_fmt)
|
switch(m_codecCtx->sample_fmt)
|
||||||
{
|
{
|
||||||
case SAMPLE_FMT_U8:
|
case AV_SAMPLE_FMT_U8:
|
||||||
m_convert = AUD_convert_u8_float;
|
m_convert = AUD_convert_u8_float;
|
||||||
m_specs.format = AUD_FORMAT_U8;
|
m_specs.format = AUD_FORMAT_U8;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_FMT_S16:
|
case AV_SAMPLE_FMT_S16:
|
||||||
m_convert = AUD_convert_s16_float;
|
m_convert = AUD_convert_s16_float;
|
||||||
m_specs.format = AUD_FORMAT_S16;
|
m_specs.format = AUD_FORMAT_S16;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_FMT_S32:
|
case AV_SAMPLE_FMT_S32:
|
||||||
m_convert = AUD_convert_s32_float;
|
m_convert = AUD_convert_s32_float;
|
||||||
m_specs.format = AUD_FORMAT_S32;
|
m_specs.format = AUD_FORMAT_S32;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_FMT_FLT:
|
case AV_SAMPLE_FMT_FLT:
|
||||||
m_convert = AUD_convert_copy<float>;
|
m_convert = AUD_convert_copy<float>;
|
||||||
m_specs.format = AUD_FORMAT_FLOAT32;
|
m_specs.format = AUD_FORMAT_FLOAT32;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_FMT_DBL:
|
case AV_SAMPLE_FMT_DBL:
|
||||||
m_convert = AUD_convert_double_float;
|
m_convert = AUD_convert_double_float;
|
||||||
m_specs.format = AUD_FORMAT_FLOAT64;
|
m_specs.format = AUD_FORMAT_FLOAT64;
|
||||||
break;
|
break;
|
||||||
@ -189,7 +189,7 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(std::string filename) :
|
|||||||
}
|
}
|
||||||
catch(AUD_Exception&)
|
catch(AUD_Exception&)
|
||||||
{
|
{
|
||||||
av_close_input_file(m_formatCtx);
|
avformat_close_input(&m_formatCtx);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer) :
|
|||||||
}
|
}
|
||||||
catch(AUD_Exception&)
|
catch(AUD_Exception&)
|
||||||
{
|
{
|
||||||
av_close_input_stream(m_formatCtx);
|
avformat_close_input(&m_formatCtx);
|
||||||
av_free(m_aviocontext);
|
av_free(m_aviocontext);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ AUD_FFMPEGReader::~AUD_FFMPEGReader()
|
|||||||
|
|
||||||
if(m_aviocontext)
|
if(m_aviocontext)
|
||||||
{
|
{
|
||||||
av_close_input_stream(m_formatCtx);
|
avformat_close_input(&m_formatCtx);
|
||||||
av_free(m_aviocontext);
|
av_free(m_aviocontext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -133,23 +133,23 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
|
|||||||
{
|
{
|
||||||
case AUD_FORMAT_U8:
|
case AUD_FORMAT_U8:
|
||||||
m_convert = AUD_convert_float_u8;
|
m_convert = AUD_convert_float_u8;
|
||||||
m_codecCtx->sample_fmt = SAMPLE_FMT_U8;
|
m_codecCtx->sample_fmt = AV_SAMPLE_FMT_U8;
|
||||||
break;
|
break;
|
||||||
case AUD_FORMAT_S16:
|
case AUD_FORMAT_S16:
|
||||||
m_convert = AUD_convert_float_s16;
|
m_convert = AUD_convert_float_s16;
|
||||||
m_codecCtx->sample_fmt = SAMPLE_FMT_S16;
|
m_codecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
break;
|
break;
|
||||||
case AUD_FORMAT_S32:
|
case AUD_FORMAT_S32:
|
||||||
m_convert = AUD_convert_float_s32;
|
m_convert = AUD_convert_float_s32;
|
||||||
m_codecCtx->sample_fmt = SAMPLE_FMT_S32;
|
m_codecCtx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
break;
|
break;
|
||||||
case AUD_FORMAT_FLOAT32:
|
case AUD_FORMAT_FLOAT32:
|
||||||
m_convert = AUD_convert_copy<float>;
|
m_convert = AUD_convert_copy<float>;
|
||||||
m_codecCtx->sample_fmt = SAMPLE_FMT_FLT;
|
m_codecCtx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
break;
|
break;
|
||||||
case AUD_FORMAT_FLOAT64:
|
case AUD_FORMAT_FLOAT64:
|
||||||
m_convert = AUD_convert_float_double;
|
m_convert = AUD_convert_float_double;
|
||||||
m_codecCtx->sample_fmt = SAMPLE_FMT_DBL;
|
m_codecCtx->sample_fmt = AV_SAMPLE_FMT_DBL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AUD_THROW(AUD_ERROR_FFMPEG, format_error);
|
AUD_THROW(AUD_ERROR_FFMPEG, format_error);
|
||||||
|
@ -205,15 +205,15 @@ Operate(
|
|||||||
void
|
void
|
||||||
BSP_GhostTestApp3D::
|
BSP_GhostTestApp3D::
|
||||||
UpdateFrame(
|
UpdateFrame(
|
||||||
){
|
) {
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
|
|
||||||
GHOST_Rect v_rect;
|
GHOST_Rect v_rect;
|
||||||
m_window->getClientBounds(v_rect);
|
m_window->getClientBounds(v_rect);
|
||||||
|
|
||||||
glViewport(0,0,v_rect.getWidth(),v_rect.getHeight());
|
glViewport(0,0,v_rect.getWidth(),v_rect.getHeight());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ NewTestMesh(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
MT_Vector3 min,max;
|
MT_Vector3 min,max;
|
||||||
MT_Vector3 min2,max2;
|
MT_Vector3 min2,max2;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
class CTR_UHeapable {
|
class CTR_UHeapable {
|
||||||
|
|
||||||
public :
|
public:
|
||||||
int &
|
int &
|
||||||
HeapPos(
|
HeapPos(
|
||||||
) {
|
) {
|
||||||
@ -79,16 +79,16 @@ public :
|
|||||||
return m_ind;
|
return m_ind;
|
||||||
};
|
};
|
||||||
|
|
||||||
private :
|
private:
|
||||||
|
|
||||||
float m_key;
|
float m_key;
|
||||||
int m_ind;
|
int m_ind;
|
||||||
|
|
||||||
protected :
|
protected:
|
||||||
|
|
||||||
CTR_UHeapable(
|
CTR_UHeapable(
|
||||||
) : m_key (0),
|
) : m_key(0),
|
||||||
m_ind (0)
|
m_ind(0)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,9 +115,9 @@ public:
|
|||||||
HeapType *base
|
HeapType *base
|
||||||
) {
|
) {
|
||||||
int i;
|
int i;
|
||||||
int start = Parent(m_vector.size()-1);
|
int start = Parent(m_vector.size() - 1);
|
||||||
for (i = start; i >=0; --i) {
|
for (i = start; i >= 0; --i) {
|
||||||
DownHeap(base,i);
|
DownHeap(base, i);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,10 +128,10 @@ public:
|
|||||||
) {
|
) {
|
||||||
// add element to vector
|
// add element to vector
|
||||||
m_vector.push_back(elem);
|
m_vector.push_back(elem);
|
||||||
base[elem].HeapPos() = m_vector.size()-1;
|
base[elem].HeapPos() = m_vector.size() - 1;
|
||||||
|
|
||||||
// push the element up the heap
|
// push the element up the heap
|
||||||
UpHeap(base,m_vector.size()-1);
|
UpHeap(base, m_vector.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// access to the vector for initial loading of elements
|
// access to the vector for initial loading of elements
|
||||||
@ -155,16 +155,17 @@ public:
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != int(m_vector.size())-1) {
|
if (i != int(m_vector.size()) - 1) {
|
||||||
|
|
||||||
Swap(base,i,m_vector.size() - 1);
|
Swap(base, i, m_vector.size() - 1);
|
||||||
m_vector.pop_back();
|
m_vector.pop_back();
|
||||||
|
|
||||||
if (!m_vector.empty()) {
|
if (!m_vector.empty()) {
|
||||||
UpHeap(base,i);
|
UpHeap(base, i);
|
||||||
DownHeap(base,i);
|
DownHeap(base, i);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_vector.pop_back();
|
m_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,10 +183,10 @@ public:
|
|||||||
HeapType *base
|
HeapType *base
|
||||||
) {
|
) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i < int(m_vector.size()) ; i++) {
|
for (i = 1; i < int(m_vector.size()); i++) {
|
||||||
|
|
||||||
CTR_UHeapable * elem = base + m_vector[i];
|
CTR_UHeapable *elem = base + m_vector[i];
|
||||||
CTR_UHeapable * p_elem = base + m_vector[Parent(i)];
|
CTR_UHeapable *p_elem = base + m_vector[Parent(i)];
|
||||||
|
|
||||||
assert(p_elem->HeapKey() >= elem->HeapKey());
|
assert(p_elem->HeapKey() >= elem->HeapKey());
|
||||||
assert(elem->HeapPos() == i);
|
assert(elem->HeapPos() == i);
|
||||||
@ -215,7 +216,7 @@ private:
|
|||||||
int i,
|
int i,
|
||||||
int j
|
int j
|
||||||
) {
|
) {
|
||||||
std::swap(m_vector[i],m_vector[j]);
|
std::swap(m_vector[i], m_vector[j]);
|
||||||
|
|
||||||
CTR_UHeapable *heap_i = base + m_vector[i];
|
CTR_UHeapable *heap_i = base + m_vector[i];
|
||||||
CTR_UHeapable *heap_j = base + m_vector[j];
|
CTR_UHeapable *heap_j = base + m_vector[j];
|
||||||
@ -229,20 +230,20 @@ private:
|
|||||||
Parent(
|
Parent(
|
||||||
unsigned int i
|
unsigned int i
|
||||||
) {
|
) {
|
||||||
return (i-1) >> 1;
|
return (i - 1) >> 1;
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
Left(
|
Left(
|
||||||
int i
|
int i
|
||||||
) {
|
) {
|
||||||
return (i<<1)+1;
|
return (i << 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Right(
|
Right(
|
||||||
int i
|
int i
|
||||||
) {
|
) {
|
||||||
return (i<<1)+2;
|
return (i << 1) + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
@ -264,20 +265,21 @@ private:
|
|||||||
int r = Right(i);
|
int r = Right(i);
|
||||||
|
|
||||||
int largest;
|
int largest;
|
||||||
if (l < heap_size && HeapVal(base,l) > HeapVal(base,i)) {
|
if (l < heap_size && HeapVal(base, l) > HeapVal(base, i)) {
|
||||||
largest = l;
|
largest = l;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
largest = i;
|
largest = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r < heap_size && HeapVal(base,r) > HeapVal(base,largest)) {
|
if (r < heap_size && HeapVal(base, r) > HeapVal(base, largest)) {
|
||||||
largest = r;
|
largest = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (largest != i) {
|
if (largest != i) {
|
||||||
// exchange i and largest
|
// exchange i and largest
|
||||||
Swap(base,i,largest);
|
Swap(base, i, largest);
|
||||||
DownHeap(base,largest);
|
DownHeap(base, largest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,10 +294,10 @@ private:
|
|||||||
|
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
int p = Parent(i);
|
int p = Parent(i);
|
||||||
if (HeapVal(base,i) < HeapVal(base,p)) {
|
if (HeapVal(base, i) < HeapVal(base, p)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Swap(base,p,i);
|
Swap(base, p, i);
|
||||||
i = p;
|
i = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,6 +255,16 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
|
|||||||
{
|
{
|
||||||
Integrator *integrator = state.scene->integrator;
|
Integrator *integrator = state.scene->integrator;
|
||||||
|
|
||||||
|
xml_read_bool(&integrator->progressive, node, "progressive");
|
||||||
|
|
||||||
|
if(!integrator->progressive) {
|
||||||
|
xml_read_int(&integrator->diffuse_samples, node, "diffuse_samples");
|
||||||
|
xml_read_int(&integrator->glossy_samples, node, "glossy_samples");
|
||||||
|
xml_read_int(&integrator->transmission_samples, node, "transmission_samples");
|
||||||
|
xml_read_int(&integrator->ao_samples, node, "ao_samples");
|
||||||
|
xml_read_int(&integrator->mesh_light_samples, node, "mesh_light_samples");
|
||||||
|
}
|
||||||
|
|
||||||
xml_read_int(&integrator->min_bounce, node, "min_bounce");
|
xml_read_int(&integrator->min_bounce, node, "min_bounce");
|
||||||
xml_read_int(&integrator->max_bounce, node, "max_bounce");
|
xml_read_int(&integrator->max_bounce, node, "max_bounce");
|
||||||
|
|
||||||
@ -267,8 +277,10 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
|
|||||||
|
|
||||||
xml_read_bool(&integrator->transparent_shadows, node, "transparent_shadows");
|
xml_read_bool(&integrator->transparent_shadows, node, "transparent_shadows");
|
||||||
xml_read_bool(&integrator->no_caustics, node, "no_caustics");
|
xml_read_bool(&integrator->no_caustics, node, "no_caustics");
|
||||||
|
xml_read_float(&integrator->filter_glossy, node, "blur_glossy");
|
||||||
|
|
||||||
xml_read_int(&integrator->seed, node, "seed");
|
xml_read_int(&integrator->seed, node, "seed");
|
||||||
|
xml_read_float(&integrator->sample_clamp, node, "sample_clamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Camera */
|
/* Camera */
|
||||||
|
@ -336,7 +336,7 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
|
|||||||
cls.fisheye_fov = FloatProperty(
|
cls.fisheye_fov = FloatProperty(
|
||||||
name="Field of View",
|
name="Field of View",
|
||||||
description="Field of view for the fisheye lens",
|
description="Field of view for the fisheye lens",
|
||||||
min=0.1745, soft_max=2*math.pi, max=10.0*math.pi,
|
min=0.1745, soft_max=2 * math.pi, max=10.0 * math.pi,
|
||||||
subtype='ANGLE',
|
subtype='ANGLE',
|
||||||
default=math.pi,
|
default=math.pi,
|
||||||
)
|
)
|
||||||
|
@ -85,6 +85,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
|||||||
sub.prop(cscene, "ao_samples", text="AO")
|
sub.prop(cscene, "ao_samples", text="AO")
|
||||||
sub.prop(cscene, "mesh_light_samples", text="Mesh Light")
|
sub.prop(cscene, "mesh_light_samples", text="Mesh Light")
|
||||||
|
|
||||||
|
|
||||||
class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
|
class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Light Paths"
|
bl_label = "Light Paths"
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
@ -545,6 +546,7 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
|
|||||||
if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
|
if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
|
||||||
layout.prop(lamp, "color")
|
layout.prop(lamp, "color")
|
||||||
|
|
||||||
|
|
||||||
class CyclesLamp_PT_spot(CyclesButtonsPanel, Panel):
|
class CyclesLamp_PT_spot(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Spot Shape"
|
bl_label = "Spot Shape"
|
||||||
bl_context = "data"
|
bl_context = "data"
|
||||||
@ -569,6 +571,7 @@ class CyclesLamp_PT_spot(CyclesButtonsPanel, Panel):
|
|||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(lamp, "show_cone")
|
col.prop(lamp, "show_cone")
|
||||||
|
|
||||||
|
|
||||||
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
|
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Surface"
|
bl_label = "Surface"
|
||||||
bl_context = "world"
|
bl_context = "world"
|
||||||
|
@ -218,7 +218,7 @@ void BlenderSession::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffer_params.passes = passes;
|
buffer_params.passes = passes;
|
||||||
scene->film->passes = passes;
|
scene->film->tag_passes_update(scene, passes);
|
||||||
scene->film->tag_update(scene);
|
scene->film->tag_update(scene);
|
||||||
scene->integrator->tag_update(scene);
|
scene->integrator->tag_update(scene);
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ if(WITH_CYCLES_TEST)
|
|||||||
include_directories(${GLUT_INCLUDE_DIR})
|
include_directories(${GLUT_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_BUILTIN_GLEW)
|
if(WITH_SYSTEM_GLEW)
|
||||||
set(CYCLES_GLEW_LIBRARY extern_glew)
|
|
||||||
else()
|
|
||||||
set(CYCLES_GLEW_LIBRARY ${GLEW_LIBRARY})
|
set(CYCLES_GLEW_LIBRARY ${GLEW_LIBRARY})
|
||||||
|
else()
|
||||||
|
set(CYCLES_GLEW_LIBRARY extern_glew)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "film.h"
|
#include "film.h"
|
||||||
#include "integrator.h"
|
#include "integrator.h"
|
||||||
|
#include "mesh.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
|
||||||
#include "util_algorithm.h"
|
#include "util_algorithm.h"
|
||||||
@ -296,6 +297,16 @@ bool Film::modified(const Film& film)
|
|||||||
&& Pass::equals(passes, film.passes));
|
&& Pass::equals(passes, film.passes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Film::tag_passes_update(Scene *scene, const vector<Pass>& passes_)
|
||||||
|
{
|
||||||
|
if(Pass::contains(passes, PASS_UV) != Pass::contains(passes_, PASS_UV))
|
||||||
|
scene->mesh_manager->tag_update(scene);
|
||||||
|
else if(Pass::contains(passes, PASS_MOTION) != Pass::contains(passes_, PASS_MOTION))
|
||||||
|
scene->mesh_manager->tag_update(scene);
|
||||||
|
|
||||||
|
passes = passes_;
|
||||||
|
}
|
||||||
|
|
||||||
void Film::tag_update(Scene *scene)
|
void Film::tag_update(Scene *scene)
|
||||||
{
|
{
|
||||||
need_update = true;
|
need_update = true;
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
void device_free(Device *device, DeviceScene *dscene);
|
void device_free(Device *device, DeviceScene *dscene);
|
||||||
|
|
||||||
bool modified(const Film& film);
|
bool modified(const Film& film);
|
||||||
|
void tag_passes_update(Scene *scene, const vector<Pass>& passes_);
|
||||||
void tag_update(Scene *scene);
|
void tag_update(Scene *scene);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -665,11 +665,11 @@ int ControlParticles::initFromBinaryFile(string filename) {
|
|||||||
int ptype=0;
|
int ptype=0;
|
||||||
float psize=0.0;
|
float psize=0.0;
|
||||||
ntlVec3Gfx ppos,pvel;
|
ntlVec3Gfx ppos,pvel;
|
||||||
gzread(gzf, &ptype, sizeof( ptype ));
|
gzread(gzf, &ptype, sizeof(ptype));
|
||||||
gzread(gzf, &psize, sizeof( float ));
|
gzread(gzf, &psize, sizeof(float));
|
||||||
|
|
||||||
for(int j=0; j<3; j++) { gzread(gzf, &ppos[j], sizeof( float )); }
|
for (int j=0; j<3; j++) { gzread(gzf, &ppos[j], sizeof(float)); }
|
||||||
for(int j=0; j<3; j++) { gzread(gzf, &pvel[j], sizeof( float )); }
|
for (int j=0; j<3; j++) { gzread(gzf, &pvel[j], sizeof(float)); }
|
||||||
|
|
||||||
ControlParticle p;
|
ControlParticle p;
|
||||||
p.reset();
|
p.reset();
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
#include <libavcodec/opt.h>
|
|
||||||
|
|
||||||
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
|
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
|
||||||
#define FFMPEG_HAVE_AVIO 1
|
#define FFMPEG_HAVE_AVIO 1
|
||||||
@ -76,6 +75,20 @@
|
|||||||
#define FFMPEG_FFV1_ALPHA_SUPPORTED
|
#define FFMPEG_FFV1_ALPHA_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ((LIBAVFORMAT_VERSION_MAJOR < 53) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR < 24)) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR < 24) && (LIBAVFORMAT_VERSION_MICRO < 2)))
|
||||||
|
#define avformat_close_input(x) av_close_input_file(*(x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ((LIBAVFORMAT_VERSION_MAJOR > 53) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR > 32)) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR == 24) && (LIBAVFORMAT_VERSION_MICRO >= 100)))
|
||||||
|
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
||||||
|
{
|
||||||
|
ff_update_cur_dts(s, ref_st, timestamp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FFMPEG_HAVE_AVIO
|
#ifndef FFMPEG_HAVE_AVIO
|
||||||
#define AVIO_FLAG_WRITE URL_WRONLY
|
#define AVIO_FLAG_WRITE URL_WRONLY
|
||||||
#define avio_open url_fopen
|
#define avio_open url_fopen
|
||||||
|
@ -61,7 +61,7 @@ GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
|
|||||||
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
|
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
/* no prefix assumes a portable build which only uses bundled scripts */
|
/* no prefix assumes a portable build which only uses bundled scripts */
|
||||||
if(static_path) {
|
if (static_path) {
|
||||||
static char system_path[PATH_MAX];
|
static char system_path[PATH_MAX];
|
||||||
snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
|
snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
|
||||||
return (GHOST_TUns8*)system_path;
|
return (GHOST_TUns8*)system_path;
|
||||||
@ -76,10 +76,10 @@ const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *ver
|
|||||||
|
|
||||||
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
|
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
|
||||||
* operator works we give a different path depending on the requested version */
|
* operator works we give a different path depending on the requested version */
|
||||||
if(version < 264) {
|
if (version < 264) {
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
if(home) {
|
if (home) {
|
||||||
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
|
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
|
||||||
return (GHOST_TUns8*)user_path;
|
return (GHOST_TUns8*)user_path;
|
||||||
}
|
}
|
||||||
|
@ -639,8 +639,8 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
|
|||||||
GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow)
|
GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 x_screen, y_screen;
|
GHOST_TInt32 x_screen, y_screen;
|
||||||
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 * ) getSystem());
|
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *) getSystem();
|
||||||
GHOST_WindowWin32 *window = ( GHOST_WindowWin32 * ) Iwindow;
|
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *) Iwindow;
|
||||||
|
|
||||||
system->getCursorPosition(x_screen, y_screen);
|
system->getCursorPosition(x_screen, y_screen);
|
||||||
|
|
||||||
|
@ -526,7 +526,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Dispose the system */
|
/* Dispose the system */
|
||||||
GHOST_DisposeSystem(shSystem);
|
GHOST_DisposeSystem(shSystem);
|
||||||
GHOST_DisposeEventConsumer(consumer);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ Application::Application(GHOST_ISystem *system)
|
|||||||
m_secondaryWindow = system->createWindow(title2, 340, 64, 320, 200, GHOST_kWindowStateNormal,
|
m_secondaryWindow = system->createWindow(title2, 340, 64, 320, 200, GHOST_kWindowStateNormal,
|
||||||
GHOST_kDrawingContextTypeOpenGL, false, false);
|
GHOST_kDrawingContextTypeOpenGL, false, false);
|
||||||
if (!m_secondaryWindow) {
|
if (!m_secondaryWindow) {
|
||||||
cout << "could not create secondary window\n";
|
std::cout << "could not create secondary window\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,8 @@ struct r_fill_context {
|
|||||||
* just the poly. Since the DEM code could end up being coupled with this, we'll keep it separate
|
* just the poly. Since the DEM code could end up being coupled with this, we'll keep it separate
|
||||||
* for now.
|
* for now.
|
||||||
*/
|
*/
|
||||||
static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge) {
|
static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
int xbeg;
|
int xbeg;
|
||||||
int ybeg;
|
int ybeg;
|
||||||
@ -165,7 +166,8 @@ static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *v
|
|||||||
* for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
|
* for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
|
||||||
* if it ends up being coupled with this function.
|
* if it ends up being coupled with this function.
|
||||||
*/
|
*/
|
||||||
static int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, float intensity) {
|
static int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, float intensity)
|
||||||
|
{
|
||||||
int x_curr; /* current pixel position in X */
|
int x_curr; /* current pixel position in X */
|
||||||
int y_curr; /* current scan line being drawn */
|
int y_curr; /* current scan line being drawn */
|
||||||
int yp; /* y-pixel's position in frame buffer */
|
int yp; /* y-pixel's position in frame buffer */
|
||||||
@ -757,18 +759,21 @@ int PLX_raskterize_feather(float (*base_verts)[2], int num_base_verts, float (*f
|
|||||||
return i; /* Return the value returned by the rasterizer. */
|
return i; /* Return the value returned by the rasterizer. */
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_range_expanded_pixel_coord(float normalized_value, int max_value) {
|
int get_range_expanded_pixel_coord(float normalized_value, int max_value)
|
||||||
|
{
|
||||||
return (int)((normalized_value * (float)(max_value)) + 0.5f);
|
return (int)((normalized_value * (float)(max_value)) + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y) {
|
float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y)
|
||||||
|
{
|
||||||
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
|
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
return buf[(pos_y * buf_y) + buf_x];
|
return buf[(pos_y * buf_y) + buf_x];
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v) {
|
float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v)
|
||||||
|
{
|
||||||
int a;
|
int a;
|
||||||
int b;
|
int b;
|
||||||
int a_plus_1;
|
int a_plus_1;
|
||||||
@ -794,14 +799,16 @@ float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, fl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity) {
|
void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity)
|
||||||
|
{
|
||||||
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
|
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf[(pos_y * buf_y) + buf_x] = intensity;
|
buf[(pos_y * buf_y) + buf_x] = intensity;
|
||||||
}
|
}
|
||||||
#define __PLX__FAKE_AA__
|
#define __PLX__FAKE_AA__
|
||||||
int PLX_antialias_buffer(float *buf, int buf_x, int buf_y) {
|
int PLX_antialias_buffer(float *buf, int buf_x, int buf_y)
|
||||||
|
{
|
||||||
#ifdef __PLX__FAKE_AA__
|
#ifdef __PLX__FAKE_AA__
|
||||||
#ifdef __PLX_GREY_AA__
|
#ifdef __PLX_GREY_AA__
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -183,8 +183,8 @@ def modules(module_cache):
|
|||||||
del modules_stale
|
del modules_stale
|
||||||
|
|
||||||
mod_list = list(module_cache.values())
|
mod_list = list(module_cache.values())
|
||||||
mod_list.sort(key=lambda mod: (mod.bl_info['category'],
|
mod_list.sort(key=lambda mod: (mod.bl_info["category"],
|
||||||
mod.bl_info['name'],
|
mod.bl_info["name"],
|
||||||
))
|
))
|
||||||
return mod_list
|
return mod_list
|
||||||
|
|
||||||
|
@ -887,9 +887,9 @@ if __name__ == "__main__":
|
|||||||
# Example, should be called externally
|
# Example, should be called externally
|
||||||
# (class, from, to)
|
# (class, from, to)
|
||||||
replace_ls = [
|
replace_ls = [
|
||||||
('AnimVizMotionPaths', 'frame_after', 'frame_after'),
|
("AnimVizMotionPaths", "frame_after", "frame_after"),
|
||||||
('AnimVizMotionPaths', 'frame_before', 'frame_before'),
|
("AnimVizMotionPaths", "frame_before", "frame_before"),
|
||||||
('AnimVizOnionSkinning', 'frame_after', 'frame_after'),
|
("AnimVizOnionSkinning", "frame_after", "frame_after"),
|
||||||
]
|
]
|
||||||
|
|
||||||
update_data_paths(replace_ls)
|
update_data_paths(replace_ls)
|
||||||
|
@ -36,14 +36,14 @@ def read_blend_rend_chunk(path):
|
|||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
blendfile = open(path, 'rb')
|
blendfile = open(path, "rb")
|
||||||
|
|
||||||
head = blendfile.read(7)
|
head = blendfile.read(7)
|
||||||
|
|
||||||
if head[0:2] == b'\x1f\x8b': # gzip magic
|
if head[0:2] == b'\x1f\x8b': # gzip magic
|
||||||
import gzip
|
import gzip
|
||||||
blendfile.close()
|
blendfile.close()
|
||||||
blendfile = gzip.open(path, 'rb')
|
blendfile = gzip.open(path, "rb")
|
||||||
head = blendfile.read(7)
|
head = blendfile.read(7)
|
||||||
|
|
||||||
if head != b'BLENDER':
|
if head != b'BLENDER':
|
||||||
@ -80,7 +80,7 @@ def read_blend_rend_chunk(path):
|
|||||||
scene_name = scene_name[:scene_name.index(b'\0')]
|
scene_name = scene_name[:scene_name.index(b'\0')]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
scene_name = str(scene_name, 'utf8')
|
scene_name = str(scene_name, "utf8")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ def main():
|
|||||||
#~ if "-d" in sys.argv: # Enable this to measure start up speed
|
#~ if "-d" in sys.argv: # Enable this to measure start up speed
|
||||||
if 0:
|
if 0:
|
||||||
import cProfile
|
import cProfile
|
||||||
cProfile.run('import bpy; bpy.utils.load_scripts()', 'blender.prof')
|
cProfile.run("import bpy; bpy.utils.load_scripts()", "blender.prof")
|
||||||
|
|
||||||
import pstats
|
import pstats
|
||||||
p = pstats.Stats('blender.prof')
|
p = pstats.Stats("blender.prof")
|
||||||
p.sort_stats('cumulative').print_stats(100)
|
p.sort_stats("cumulative").print_stats(100)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
utils.load_scripts()
|
utils.load_scripts()
|
||||||
|
@ -74,7 +74,7 @@ class BPyOpsSubMod(object):
|
|||||||
|
|
||||||
eg. bpy.ops.object
|
eg. bpy.ops.object
|
||||||
'''
|
'''
|
||||||
__keys__ = ('module',)
|
__keys__ = ("module",)
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
@ -111,7 +111,7 @@ class BPyOpsSubModOp(object):
|
|||||||
eg. bpy.ops.object.somefunc
|
eg. bpy.ops.object.somefunc
|
||||||
'''
|
'''
|
||||||
|
|
||||||
__keys__ = ('module', 'func')
|
__keys__ = ("module", "func")
|
||||||
|
|
||||||
def _get_doc(self):
|
def _get_doc(self):
|
||||||
return op_as_string(self.idname())
|
return op_as_string(self.idname())
|
||||||
|
@ -489,7 +489,7 @@ def keyconfig_set(filepath):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
keyfile = open(filepath)
|
keyfile = open(filepath)
|
||||||
exec(compile(keyfile.read(), filepath, 'exec'), {"__file__": filepath})
|
exec(compile(keyfile.read(), filepath, "exec"), {"__file__": filepath})
|
||||||
keyfile.close()
|
keyfile.close()
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -71,7 +71,7 @@ def load_image(imagepath,
|
|||||||
def _image_load_placeholder(path):
|
def _image_load_placeholder(path):
|
||||||
name = bpy.path.basename(path)
|
name = bpy.path.basename(path)
|
||||||
if type(name) == bytes:
|
if type(name) == bytes:
|
||||||
name = name.decode('utf-8', "replace")
|
name = name.decode("utf-8", "replace")
|
||||||
image = bpy.data.images.new(name, 128, 128)
|
image = bpy.data.images.new(name, 128, 128)
|
||||||
# allow the path to be resolved later
|
# allow the path to be resolved later
|
||||||
image.filepath = path
|
image.filepath = path
|
||||||
|
@ -171,7 +171,7 @@ def keyconfig_export(wm, kc, filepath):
|
|||||||
# First add all user_modified keymaps (found in keyconfigs.user.keymaps list),
|
# First add all user_modified keymaps (found in keyconfigs.user.keymaps list),
|
||||||
# then add all remaining keymaps from the currently active custom keyconfig.
|
# then add all remaining keymaps from the currently active custom keyconfig.
|
||||||
#
|
#
|
||||||
# This will create a final list of keymaps that can be used as a 'diff' against
|
# This will create a final list of keymaps that can be used as a "diff" against
|
||||||
# the default blender keyconfig, recreating the current setup from a fresh blender
|
# the default blender keyconfig, recreating the current setup from a fresh blender
|
||||||
# without needing to export keymaps which haven't been edited.
|
# without needing to export keymaps which haven't been edited.
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
|
|||||||
|
|
||||||
fill = tessellate_polygon([[v[0] for v in loop] for loop in loop_list])
|
fill = tessellate_polygon([[v[0] for v in loop] for loop in loop_list])
|
||||||
#draw_loops(loop_list)
|
#draw_loops(loop_list)
|
||||||
#raise 'done loop'
|
#raise Exception("done loop")
|
||||||
# map to original indices
|
# map to original indices
|
||||||
fill = [[vert_map[i] for i in reversed(f)] for f in fill]
|
fill = [[vert_map[i] for i in reversed(f)] for f in fill]
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def _call_recursive(context, base, py_node):
|
|||||||
value = eval(value, {"context": _bpy.context})
|
value = eval(value, {"context": _bpy.context})
|
||||||
setattr(base, py_node[TAG], value)
|
setattr(base, py_node[TAG], value)
|
||||||
else:
|
else:
|
||||||
value = py_node[ARGS]['value'] # have to have this
|
value = py_node[ARGS]["value"] # have to have this
|
||||||
setattr(base, py_node[TAG], value)
|
setattr(base, py_node[TAG], value)
|
||||||
else:
|
else:
|
||||||
args = _parse_rna_args(base, py_node)
|
args = _parse_rna_args(base, py_node)
|
||||||
|
@ -96,7 +96,10 @@ def get_console(console_id):
|
|||||||
|
|
||||||
namespace["__builtins__"] = sys.modules["builtins"]
|
namespace["__builtins__"] = sys.modules["builtins"]
|
||||||
namespace["bpy"] = bpy
|
namespace["bpy"] = bpy
|
||||||
|
|
||||||
|
# weak! - but highly convenient
|
||||||
namespace["C"] = bpy.context
|
namespace["C"] = bpy.context
|
||||||
|
namespace["D"] = bpy.data
|
||||||
|
|
||||||
replace_help(namespace)
|
replace_help(namespace)
|
||||||
|
|
||||||
@ -305,6 +308,7 @@ def banner(context):
|
|||||||
'OUTPUT')
|
'OUTPUT')
|
||||||
add_scrollback("Convenience Imports: from mathutils import *; "
|
add_scrollback("Convenience Imports: from mathutils import *; "
|
||||||
"from math import *", 'OUTPUT')
|
"from math import *", 'OUTPUT')
|
||||||
|
add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data", 'OUTPUT')
|
||||||
add_scrollback("", 'OUTPUT')
|
add_scrollback("", 'OUTPUT')
|
||||||
sc.prompt = PROMPT
|
sc.prompt = PROMPT
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
import os
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
language_id = 'shell'
|
language_id = "shell"
|
||||||
|
|
||||||
|
|
||||||
def add_scrollback(text, text_type):
|
def add_scrollback(text, text_type):
|
||||||
|
@ -172,7 +172,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
|
|||||||
fileobject.close()
|
fileobject.close()
|
||||||
|
|
||||||
'''
|
'''
|
||||||
print(".", end='')
|
print(".", end="")
|
||||||
import sys
|
import sys
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
'''
|
'''
|
||||||
|
@ -66,9 +66,9 @@ def rna_id_ignore(rna_id):
|
|||||||
|
|
||||||
def range_str(val):
|
def range_str(val):
|
||||||
if val < -10000000:
|
if val < -10000000:
|
||||||
return '-inf'
|
return "-inf"
|
||||||
elif val > 10000000:
|
elif val > 10000000:
|
||||||
return 'inf'
|
return "inf"
|
||||||
elif type(val) == float:
|
elif type(val) == float:
|
||||||
return '%g' % val
|
return '%g' % val
|
||||||
else:
|
else:
|
||||||
@ -305,8 +305,8 @@ class InfoPropertyRNA:
|
|||||||
return type_str
|
return type_str
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
txt = ''
|
txt = ""
|
||||||
txt += ' * ' + self.identifier + ': ' + self.description
|
txt += " * " + self.identifier + ": " + self.description
|
||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ class InfoOperatorRNA:
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
def _GetInfoRNA(bl_rna, cls, parent_id=''):
|
def _GetInfoRNA(bl_rna, cls, parent_id=""):
|
||||||
|
|
||||||
if bl_rna is None:
|
if bl_rna is None:
|
||||||
return None
|
return None
|
||||||
@ -641,7 +641,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
props = [(prop.identifier, prop) for prop in v.properties]
|
props = [(prop.identifier, prop) for prop in v.properties]
|
||||||
for prop_id, prop in sorted(props):
|
for prop_id, prop in sorted(props):
|
||||||
# if prop.type == 'boolean':
|
# if prop.type == "boolean":
|
||||||
# continue
|
# continue
|
||||||
prop_type = prop.type
|
prop_type = prop.type
|
||||||
if prop.array_length > 0:
|
if prop.array_length > 0:
|
||||||
|
@ -352,7 +352,7 @@ def xml_file_run(context, filepath, rna_map):
|
|||||||
|
|
||||||
def xml_file_write(context, filepath, rna_map):
|
def xml_file_write(context, filepath, rna_map):
|
||||||
|
|
||||||
file = open(filepath, 'w', encoding='utf-8')
|
file = open(filepath, "w", encoding="utf-8")
|
||||||
fw = file.write
|
fw = file.write
|
||||||
|
|
||||||
fw("<bpy>\n")
|
fw("<bpy>\n")
|
||||||
|
@ -27,7 +27,7 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def cutPoint(text, length):
|
def cutPoint(text, length):
|
||||||
"Returns position of the last space found before 'length' chars"
|
"""Returns position of the last space found before 'length' chars"""
|
||||||
l = length
|
l = length
|
||||||
c = text[l]
|
c = text[l]
|
||||||
while c != ' ':
|
while c != ' ':
|
||||||
@ -98,7 +98,7 @@ def write_sysinfo(op):
|
|||||||
output.write(lilies)
|
output.write(lilies)
|
||||||
ffmpeg = bpy.app.ffmpeg
|
ffmpeg = bpy.app.ffmpeg
|
||||||
if ffmpeg.supported:
|
if ffmpeg.supported:
|
||||||
for lib in ['avcodec', 'avdevice', 'avformat', 'avutil', 'swscale']:
|
for lib in ("avcodec", "avdevice", "avformat", "avutil", "swscale"):
|
||||||
output.write("%r:%r%r\n" % (lib, " " * (10 - len(lib)),
|
output.write("%r:%r%r\n" % (lib, " " * (10 - len(lib)),
|
||||||
getattr(ffmpeg, lib + "_version_string")))
|
getattr(ffmpeg, lib + "_version_string")))
|
||||||
else:
|
else:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Theme>
|
<Theme>
|
||||||
<view_3d>
|
<view_3d>
|
||||||
<ThemeView3D object_active="#ff8c19"
|
<ThemeView3D object_active="#ff8c19"
|
||||||
editmesh_active="#ffffff80"
|
editmesh_active="#ff020080"
|
||||||
act_spline="#db2512"
|
act_spline="#db2512"
|
||||||
handle_align="#803060"
|
handle_align="#803060"
|
||||||
handle_sel_align="#f090a0"
|
handle_sel_align="#f090a0"
|
||||||
@ -461,7 +461,7 @@
|
|||||||
<ThemeTextEditor cursor="#ff0000"
|
<ThemeTextEditor cursor="#ff0000"
|
||||||
syntax_special="#969629"
|
syntax_special="#969629"
|
||||||
line_numbers_background="#191919"
|
line_numbers_background="#191919"
|
||||||
selected_text="#ffffff"
|
selected_text="#202020"
|
||||||
syntax_builtin="#cf3d99"
|
syntax_builtin="#cf3d99"
|
||||||
syntax_comment="#249d60"
|
syntax_comment="#249d60"
|
||||||
syntax_numbers="#3c68ff"
|
syntax_numbers="#3c68ff"
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import bpy
|
||||||
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
|
op.apply_modifiers = True
|
||||||
|
op.export_mesh_type = 0
|
||||||
|
op.export_mesh_type_selection = 'view'
|
||||||
|
op.selected = True
|
||||||
|
op.include_children = False
|
||||||
|
op.include_armatures = True
|
||||||
|
op.deform_bones_only = True
|
||||||
|
op.active_uv_only = True
|
||||||
|
op.include_uv_textures = True
|
||||||
|
op.use_texture_copies = True
|
||||||
|
op.use_object_instantiation = False
|
||||||
|
op.sort_by_name = True
|
||||||
|
op.second_life = True
|
@ -1,10 +1,16 @@
|
|||||||
import bpy
|
import bpy
|
||||||
op = bpy.context.active_operator
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
op.selected = True
|
|
||||||
op.apply_modifiers = True
|
op.apply_modifiers = True
|
||||||
op.include_armatures = False
|
op.export_mesh_type = 0
|
||||||
|
op.export_mesh_type_selection = 'view'
|
||||||
|
op.selected = True
|
||||||
op.include_children = False
|
op.include_children = False
|
||||||
|
op.include_armatures = False
|
||||||
|
op.deform_bones_only = False
|
||||||
|
op.active_uv_only = True
|
||||||
|
op.include_uv_textures = True
|
||||||
|
op.use_texture_copies = True
|
||||||
op.use_object_instantiation = False
|
op.use_object_instantiation = False
|
||||||
op.sort_by_name = True
|
op.sort_by_name = True
|
||||||
op.second_life = True
|
op.second_life = False
|
@ -77,7 +77,7 @@ class ConsoleBanner(Operator):
|
|||||||
|
|
||||||
# default to python
|
# default to python
|
||||||
if not sc.language:
|
if not sc.language:
|
||||||
sc.language = 'python'
|
sc.language = "python"
|
||||||
|
|
||||||
module = _lang_module_get(sc)
|
module = _lang_module_get(sc)
|
||||||
banner = getattr(module, "banner", None)
|
banner = getattr(module, "banner", None)
|
||||||
|
@ -34,7 +34,8 @@ class SelectPattern(Operator):
|
|||||||
|
|
||||||
pattern = StringProperty(
|
pattern = StringProperty(
|
||||||
name="Pattern",
|
name="Pattern",
|
||||||
description="Name filter using '*', '?' and '[abc]' unix style wildcards",
|
description="Name filter using '*', '?' and "
|
||||||
|
"'[abc]' unix style wildcards",
|
||||||
maxlen=64,
|
maxlen=64,
|
||||||
default="*",
|
default="*",
|
||||||
)
|
)
|
||||||
@ -130,8 +131,8 @@ class SelectCamera(Operator):
|
|||||||
|
|
||||||
|
|
||||||
class SelectHierarchy(Operator):
|
class SelectHierarchy(Operator):
|
||||||
'''Select object relative to the active object's position ''' \
|
"""Select object relative to the active object's position """
|
||||||
'''in the hierarchy'''
|
"""in the hierarchy"""
|
||||||
bl_idname = "object.select_hierarchy"
|
bl_idname = "object.select_hierarchy"
|
||||||
bl_label = "Select Hierarchy"
|
bl_label = "Select Hierarchy"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
@ -277,8 +278,8 @@ class SubdivisionSet(Operator):
|
|||||||
|
|
||||||
|
|
||||||
class ShapeTransfer(Operator):
|
class ShapeTransfer(Operator):
|
||||||
'''Copy another selected objects active shape to this one by ''' \
|
"""Copy another selected objects active shape to this one by """
|
||||||
'''applying the relative offsets'''
|
"""applying the relative offsets"""
|
||||||
|
|
||||||
bl_idname = "object.shape_key_transfer"
|
bl_idname = "object.shape_key_transfer"
|
||||||
bl_label = "Transfer Shape Key"
|
bl_label = "Transfer Shape Key"
|
||||||
|
@ -174,6 +174,7 @@ class QuickExplode(Operator):
|
|||||||
|
|
||||||
if self.style == 'BLEND' and len(mesh_objects) != 2:
|
if self.style == 'BLEND' and len(mesh_objects) != 2:
|
||||||
self.report({'ERROR'}, "Select two mesh objects")
|
self.report({'ERROR'}, "Select two mesh objects")
|
||||||
|
self.style = 'EXPLODE'
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
elif not mesh_objects:
|
elif not mesh_objects:
|
||||||
self.report({'ERROR'}, "Select at least one mesh object")
|
self.report({'ERROR'}, "Select at least one mesh object")
|
||||||
@ -241,10 +242,10 @@ class QuickExplode(Operator):
|
|||||||
if obj == to_obj:
|
if obj == to_obj:
|
||||||
tex_slot.alpha_factor = -1.0
|
tex_slot.alpha_factor = -1.0
|
||||||
elem = tex.color_ramp.elements[1]
|
elem = tex.color_ramp.elements[1]
|
||||||
elem.color = mat.diffuse_color
|
|
||||||
else:
|
else:
|
||||||
elem = tex.color_ramp.elements[0]
|
elem = tex.color_ramp.elements[0]
|
||||||
elem.color = mat.diffuse_color
|
# Keep already defined alpha!
|
||||||
|
elem.color[:3] = mat.diffuse_color
|
||||||
else:
|
else:
|
||||||
tex_slot.use_map_color_diffuse = False
|
tex_slot.use_map_color_diffuse = False
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
# ##### END GPL LICENSE BLOCK #####
|
# ##### END GPL LICENSE BLOCK #####
|
||||||
|
|
||||||
# <pep8-80 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Menu, Operator
|
from bpy.types import Menu, Operator
|
||||||
|
@ -107,7 +107,6 @@ def boundsEdgeLoop(edges):
|
|||||||
# print len(faces), minx, maxx, miny , maxy
|
# print len(faces), minx, maxx, miny , maxy
|
||||||
for ed in edges:
|
for ed in edges:
|
||||||
for pt in ed:
|
for pt in ed:
|
||||||
print 'ass'
|
|
||||||
x= pt[0]
|
x= pt[0]
|
||||||
y= pt[1]
|
y= pt[1]
|
||||||
if x<minx: x= minx
|
if x<minx: x= minx
|
||||||
@ -502,7 +501,6 @@ def mergeUvIslands(islandList):
|
|||||||
|
|
||||||
It gives about 10% speedup with minimal errors.
|
It gives about 10% speedup with minimal errors.
|
||||||
'''
|
'''
|
||||||
#print 'ass'
|
|
||||||
# Move the test along its width + SMALL_NUM
|
# Move the test along its width + SMALL_NUM
|
||||||
#boxLeft += sourceIsland[4] + SMALL_NUM
|
#boxLeft += sourceIsland[4] + SMALL_NUM
|
||||||
boxLeft += sourceIsland[4]
|
boxLeft += sourceIsland[4]
|
||||||
@ -832,7 +830,7 @@ def main(context,
|
|||||||
USER_ONLY_SELECTED_FACES = False
|
USER_ONLY_SELECTED_FACES = False
|
||||||
|
|
||||||
if not obList:
|
if not obList:
|
||||||
raise('error, no selected mesh objects')
|
raise Exception("error, no selected mesh objects")
|
||||||
|
|
||||||
# Reuse variable
|
# Reuse variable
|
||||||
if len(obList) == 1:
|
if len(obList) == 1:
|
||||||
|
@ -138,7 +138,7 @@ def execute_context_assign(self, context):
|
|||||||
|
|
||||||
|
|
||||||
class BRUSH_OT_active_index_set(Operator):
|
class BRUSH_OT_active_index_set(Operator):
|
||||||
'''Set active sculpt/paint brush from it's number'''
|
"""Set active sculpt/paint brush from it's number"""
|
||||||
bl_idname = "brush.active_index_set"
|
bl_idname = "brush.active_index_set"
|
||||||
bl_label = "Set Brush Number"
|
bl_label = "Set Brush Number"
|
||||||
|
|
||||||
@ -371,8 +371,8 @@ class WM_OT_context_toggle_enum(Operator):
|
|||||||
|
|
||||||
|
|
||||||
class WM_OT_context_cycle_int(Operator):
|
class WM_OT_context_cycle_int(Operator):
|
||||||
'''Set a context value. Useful for cycling active material, '''
|
"""Set a context value. Useful for cycling active material, """
|
||||||
'''vertex keys, groups' etc'''
|
"""vertex keys, groups' etc"""
|
||||||
bl_idname = "wm.context_cycle_int"
|
bl_idname = "wm.context_cycle_int"
|
||||||
bl_label = "Context Int Cycle"
|
bl_label = "Context Int Cycle"
|
||||||
bl_options = {'UNDO', 'INTERNAL'}
|
bl_options = {'UNDO', 'INTERNAL'}
|
||||||
@ -799,7 +799,6 @@ class WM_OT_path_open(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
|
def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
|
||||||
id_split = doc_id.split(".")
|
id_split = doc_id.split(".")
|
||||||
url = rna = None
|
url = rna = None
|
||||||
@ -1061,7 +1060,7 @@ class WM_OT_properties_edit(Operator):
|
|||||||
prop_ui["soft_min"] = prop_ui["min"] = prop_type(self.min)
|
prop_ui["soft_min"] = prop_ui["min"] = prop_type(self.min)
|
||||||
prop_ui["soft_max"] = prop_ui["max"] = prop_type(self.max)
|
prop_ui["soft_max"] = prop_ui["max"] = prop_type(self.max)
|
||||||
|
|
||||||
prop_ui['description'] = self.description
|
prop_ui["description"] = self.description
|
||||||
|
|
||||||
# otherwise existing buttons which reference freed
|
# otherwise existing buttons which reference freed
|
||||||
# memory may crash blender [#26510]
|
# memory may crash blender [#26510]
|
||||||
@ -1597,6 +1596,7 @@ class WM_OT_addon_disable(Operator):
|
|||||||
addon_utils.disable(self.module)
|
addon_utils.disable(self.module)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class WM_OT_theme_install(Operator):
|
class WM_OT_theme_install(Operator):
|
||||||
"Install a theme"
|
"Install a theme"
|
||||||
bl_idname = "wm.theme_install"
|
bl_idname = "wm.theme_install"
|
||||||
@ -1627,7 +1627,7 @@ class WM_OT_theme_install(Operator):
|
|||||||
|
|
||||||
xmlfile = self.filepath
|
xmlfile = self.filepath
|
||||||
|
|
||||||
path_themes = bpy.utils.user_resource('SCRIPTS','presets/interface_theme',create=True)
|
path_themes = bpy.utils.user_resource('SCRIPTS', "presets/interface_theme", create=True)
|
||||||
|
|
||||||
if not path_themes:
|
if not path_themes:
|
||||||
self.report({'ERROR'}, "Failed to get themes path")
|
self.report({'ERROR'}, "Failed to get themes path")
|
||||||
@ -1642,7 +1642,7 @@ class WM_OT_theme_install(Operator):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(xmlfile, path_dest)
|
shutil.copyfile(xmlfile, path_dest)
|
||||||
bpy.ops.script.execute_preset(filepath=path_dest,menu_idname="USERPREF_MT_interface_theme_presets")
|
bpy.ops.script.execute_preset(filepath=path_dest, menu_idname="USERPREF_MT_interface_theme_presets")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@ -1650,7 +1650,6 @@ class WM_OT_theme_install(Operator):
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.fileselect_add(self)
|
wm.fileselect_add(self)
|
||||||
|
@ -406,7 +406,7 @@ class DATA_PT_text_boxes(CurveButtonsPanel, Panel):
|
|||||||
col.prop(box, "x", text="X")
|
col.prop(box, "x", text="X")
|
||||||
col.prop(box, "y", text="Y")
|
col.prop(box, "y", text="Y")
|
||||||
|
|
||||||
row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
|
row.operator("font.textbox_remove", text="", icon='X', emboss=False).index = i
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, Panel):
|
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, Panel):
|
||||||
|
@ -50,6 +50,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
|
|||||||
physics_type = game.physics_type
|
physics_type = game.physics_type
|
||||||
|
|
||||||
if physics_type == 'CHARACTER':
|
if physics_type == 'CHARACTER':
|
||||||
|
layout.prop(game, "use_actor")
|
||||||
|
layout.prop(ob, "hide_render", text="Invisible") # out of place but useful
|
||||||
layout.prop(game, "step_height", slider=True)
|
layout.prop(game, "step_height", slider=True)
|
||||||
layout.prop(game, "jump_speed")
|
layout.prop(game, "jump_speed")
|
||||||
layout.prop(game, "fall_speed")
|
layout.prop(game, "fall_speed")
|
||||||
|
@ -841,7 +841,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(part, "use_simplify_viewport")
|
row.prop(part, "use_simplify_viewport")
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
sub.active = part.viewport == True
|
sub.active = part.use_simplify_viewport == True
|
||||||
sub.prop(part, "simplify_viewport")
|
sub.prop(part, "simplify_viewport")
|
||||||
|
|
||||||
elif part.render_type == 'OBJECT':
|
elif part.render_type == 'OBJECT':
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user