Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-07-12 18:38:26 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-12 18:38:26 +0300
commit5fae2503bf7d81b89f68f4c494f4c0e4c9eb5f46 (patch)
tree9b37773884e020430093b429c4fba4ff7b04481f /extern/libopenjpeg/cio.h
parent51b274a6be5d59c7009fd3f439821d1e15b72709 (diff)
Revert "OpenJPEG: update to 2.1 from 1.5"
This reverts commit f12204196fb1ee985ab9745cf9c70877601145f9. Campbell, sorry. have to revert this for the time being. We've missed some very important bits, such as: - FFmpeg is usually linked against OpenJPEG - OIIO needs OpenJPEG as well. For FFmpeg issues we can either disable OpenJPEG there (since we don't really use it), or bump FFmpeg to version 3.1.1 which can use either of OpenJPEG 1.5 or 2.1. For OIIO we do need OpenJPEG support (otherwise Cycles will not be able to use j2k/j2c textures) and currently there is NO solution to make OIIO working with OpenJPEG 2.1. According to Matthias Fauconneau (aka mfv) Larry is working on the patch to get OIIO work with OpenJPEG 2.1, but it'll take some time still. I've tried to look into support of some sort of build system flag and do ifdefs, but it all becomes quite nasty, especially with bundled OpenJPEG bumped to 2.1. Surely such an update is something we'll have to apply to but at this exact moment it causes quite some pain for all developers. Suggest to wait for until OIIO supports OpenJPEG 2.1 and then go with the updates for real.
Diffstat (limited to 'extern/libopenjpeg/cio.h')
-rw-r--r--extern/libopenjpeg/cio.h378
1 files changed, 36 insertions, 342 deletions
diff --git a/extern/libopenjpeg/cio.h b/extern/libopenjpeg/cio.h
index 6dfa5bb847b..e62743141ca 100644
--- a/extern/libopenjpeg/cio.h
+++ b/extern/libopenjpeg/cio.h
@@ -1,18 +1,10 @@
/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
- * party and contributor rights, including patent rights, and no such rights
- * are granted under this license.
- *
- * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
- * Copyright (c) 2002-2014, Professor Benoit Macq
+ * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
- * Copyright (c) 2003-2014, Antonin Descampe
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
- * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
- * Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,6 +31,13 @@
#ifndef __CIO_H
#define __CIO_H
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define int64 __int64
+#else
+#define int64 long long
+#endif
+
/**
@file cio.h
@brief Implementation of a byte input-output process (CIO)
@@ -49,351 +48,46 @@ The functions in CIO.C have for goal to realize a byte input / output process.
/** @defgroup CIO CIO - byte input-output stream */
/*@{*/
-#include "opj_config_private.h"
-
-/* ----------------------------------------------------------------------- */
-
-#if defined(OPJ_BIG_ENDIAN)
- #define opj_write_bytes opj_write_bytes_BE
- #define opj_read_bytes opj_read_bytes_BE
- #define opj_write_double opj_write_double_BE
- #define opj_read_double opj_read_double_BE
- #define opj_write_float opj_write_float_BE
- #define opj_read_float opj_read_float_BE
-#else
- #define opj_write_bytes opj_write_bytes_LE
- #define opj_read_bytes opj_read_bytes_LE
- #define opj_write_double opj_write_double_LE
- #define opj_read_double opj_read_double_LE
- #define opj_write_float opj_write_float_LE
- #define opj_read_float opj_read_float_LE
-#endif
-
-
-
-typedef enum
-{
- opj_signed_sentinel = -1, /* do not use in code */
- opj_stream_e_output = 0x1,
- opj_stream_e_input = 0x2,
- opj_stream_e_end = 0x4,
- opj_stream_e_error = 0x8
-}
-opj_stream_flag ;
-
-/**
-Byte input-output stream.
-*/
-typedef struct opj_stream_private
-{
- /**
- * User data, be it files, ... The actual data depends on the type of the stream.
- */
- void * m_user_data;
-
- /**
- * Pointer to function to free m_user_data (NULL at initialization)
- * when destroying the stream. If pointer is NULL the function is not
- * called and the m_user_data is not freed (even if non-NULL).
- */
- opj_stream_free_user_data_fn m_free_user_data_fn;
-
- /**
- * User data length
- */
- OPJ_UINT64 m_user_data_length;
-
- /**
- * Pointer to actual read function (NULL at the initialization of the cio.
- */
- opj_stream_read_fn m_read_fn;
-
- /**
- * Pointer to actual write function (NULL at the initialization of the cio.
- */
- opj_stream_write_fn m_write_fn;
-
- /**
- * Pointer to actual skip function (NULL at the initialization of the cio.
- * There is no seek function to prevent from back and forth slow procedures.
- */
- opj_stream_skip_fn m_skip_fn;
-
- /**
- * Pointer to actual seek function (if available).
- */
- opj_stream_seek_fn m_seek_fn;
-
- /**
- * Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
- * you should never access this data directly.
- */
- OPJ_BYTE * m_stored_data;
-
- /**
- * Pointer to the current read data.
- */
- OPJ_BYTE * m_current_data;
-
- /**
- * FIXME DOC.
- */
- OPJ_OFF_T (* m_opj_skip)(struct opj_stream_private * ,OPJ_OFF_T , struct opj_event_mgr *);
-
- /**
- * FIXME DOC.
- */
- OPJ_BOOL (* m_opj_seek) (struct opj_stream_private * , OPJ_OFF_T , struct opj_event_mgr *);
-
- /**
- * number of bytes containing in the buffer.
- */
- OPJ_SIZE_T m_bytes_in_buffer;
-
- /**
- * The number of bytes read/written from the beginning of the stream
- */
- OPJ_OFF_T m_byte_offset;
-
- /**
- * The size of the buffer.
- */
- OPJ_SIZE_T m_buffer_size;
-
- /**
- * Flags to tell the status of the stream.
- */
- opj_stream_flag m_status;
-
-}
-opj_stream_private_t;
-
/** @name Exported functions (see also openjpeg.h) */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
- * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- * @param p_nb_bytes the number of bytes to write
+Number of bytes left before the end of the stream
+@param cio CIO handle
+@return Returns the number of bytes before the end of the stream
*/
-void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
-
-/**
- * Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- * @param p_nb_bytes the nb bytes to read.
- * @return the number of bytes read or -1 if an error occured.
- */
-void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
-
+int cio_numbytesleft(opj_cio_t *cio);
/**
- * Write some bytes to the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- * @param p_nb_bytes the number of bytes to write
- * @return the number of bytes written or -1 if an error occured
+Get pointer to the current position in the stream
+@param cio CIO handle
+@return Returns a pointer to the current position
*/
-void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
-
+unsigned char *cio_getbp(opj_cio_t *cio);
/**
- * Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- * @param p_nb_bytes the nb bytes to read.
- * @return the number of bytes read or -1 if an error occured.
- */
-void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
-
-
-/**
- * Write some bytes to the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- */
-void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
-
-/***
- * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- */
-void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
-
-/**
- * Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- */
-void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
-
-/**
- * Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- */
-void opj_read_double_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
-
-/**
- * Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- */
-void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
-
-/**
- * Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to read data from.
- * @param p_value pointer to the value that will store the data.
- */
-void opj_read_float_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
-
-/**
- * Write some bytes to the given data buffer, this function is used in Little Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- */
-void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
-
-/***
- * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
- * @param p_buffer pointer the data buffer to write data to.
- * @param p_value the value to write
- */
-void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
-
-/**
- * Reads some bytes from the stream.
- * @param p_stream the stream to read data from.
- * @param p_buffer pointer to the data buffer that will receive the data.
- * @param p_size number of bytes to read.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes read, or -1 if an error occured or if the stream is at the end.
- */
-OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Writes some bytes to the stream.
- * @param p_stream the stream to write data to.
- * @param p_buffer pointer to the data buffer holds the data to be writtent.
- * @param p_size number of bytes to write.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes writtent, or -1 if an error occured.
- */
-OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Writes the content of the stream buffer to the stream.
- * @param p_stream the stream to write data to.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return true if the data could be flushed, false else.
- */
-OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Skips a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes skipped, or -1 if an error occured.
- */
-OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Tells the byte offset on the stream (similar to ftell).
- *
- * @param p_stream the stream to get the information from.
- *
- * @return the current position o fthe stream.
- */
-OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream);
-
-
-/**
- * Get the number of bytes left before the end of the stream (similar to cio_numbytesleft).
- *
- * @param p_stream the stream to get the information from.
- *
- * @return Number of bytes left before the end of the stream.
- */
-OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream);
-
-/**
- * Skips a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes skipped, or -1 if an error occured.
- */
-OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Skips a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes skipped, or -1 if an error occured.
- */
-OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Skips a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return OPJ_TRUE if success, or OPJ_FALSE if an error occured.
- */
-OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Skips a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return the number of bytes skipped, or -1 if an error occured.
- */
-OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Seeks a number of bytes from the stream.
- * @param p_stream the stream to skip data from.
- * @param p_size the number of bytes to skip.
- * @param p_event_mgr the user event manager to be notified of special events.
- * @return true if the stream is seekable.
- */
-OPJ_BOOL opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
-
-/**
- * Tells if the given stream is seekable.
- */
-OPJ_BOOL opj_stream_has_seek (const opj_stream_private_t * p_stream);
-
-/**
- * FIXME DOC.
- */
-OPJ_SIZE_T opj_stream_default_read (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
-
-/**
- * FIXME DOC.
- */
-OPJ_SIZE_T opj_stream_default_write (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
-
+Write some bytes
+@param cio CIO handle
+@param v Value to write
+@param n Number of bytes to write
+@return Returns the number of bytes written or 0 if an error occured
+*/
+unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n);
/**
- * FIXME DOC.
- */
-OPJ_OFF_T opj_stream_default_skip (OPJ_OFF_T p_nb_bytes, void * p_user_data);
-
+Read some bytes
+@param cio CIO handle
+@param n Number of bytes to read
+@return Returns the value of the n bytes read
+*/
+unsigned int cio_read(opj_cio_t *cio, int n);
/**
- * FIXME DOC.
- */
-OPJ_BOOL opj_stream_default_seek (OPJ_OFF_T p_nb_bytes, void * p_user_data);
-
+Skip some bytes
+@param cio CIO handle
+@param n Number of bytes to skip
+*/
+void cio_skip(opj_cio_t *cio, int n);
/* ----------------------------------------------------------------------- */
/*@}*/
/*@}*/
-
#endif /* __CIO_H */