Revision: 15089 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15089 Author: schlaile Date: 2008-06-02 23:35:57 +0200 (Mon, 02 Jun 2008)
Log Message: ----------- == RED one (redcode) == This adds redcode (the file format of RED one, R3D) support to blender. Seems to work fine with the footage I found on the web, but keep in mind, that because of the unoptimized nature of libopenjpeg, frame decoding isn't that fast. It is also a rather challenging task, to make 4k-float-footage realtime :) Modified Paths: -------------- trunk/blender/config/linux2-config.py trunk/blender/extern/SConscript trunk/blender/intern/bsp/SConscript trunk/blender/source/blender/imbuf/SConscript trunk/blender/source/blender/imbuf/intern/IMB_anim.h trunk/blender/source/blender/imbuf/intern/anim.c trunk/blender/source/blender/imbuf/intern/util.c trunk/blender/tools/btools.py Added Paths: ----------- trunk/blender/extern/libopenjpeg/ trunk/blender/extern/libopenjpeg/SConscript trunk/blender/extern/libopenjpeg/bio.c trunk/blender/extern/libopenjpeg/bio.h trunk/blender/extern/libopenjpeg/cio.c trunk/blender/extern/libopenjpeg/cio.h trunk/blender/extern/libopenjpeg/dwt.c trunk/blender/extern/libopenjpeg/dwt.h trunk/blender/extern/libopenjpeg/event.c trunk/blender/extern/libopenjpeg/event.h trunk/blender/extern/libopenjpeg/fix.h trunk/blender/extern/libopenjpeg/image.c trunk/blender/extern/libopenjpeg/image.h trunk/blender/extern/libopenjpeg/int.h trunk/blender/extern/libopenjpeg/j2k.c trunk/blender/extern/libopenjpeg/j2k.h trunk/blender/extern/libopenjpeg/j2k_lib.c trunk/blender/extern/libopenjpeg/j2k_lib.h trunk/blender/extern/libopenjpeg/jp2.c trunk/blender/extern/libopenjpeg/jp2.h trunk/blender/extern/libopenjpeg/jpt.c trunk/blender/extern/libopenjpeg/jpt.h trunk/blender/extern/libopenjpeg/license.txt trunk/blender/extern/libopenjpeg/mct.c trunk/blender/extern/libopenjpeg/mct.h trunk/blender/extern/libopenjpeg/mqc.c trunk/blender/extern/libopenjpeg/mqc.h trunk/blender/extern/libopenjpeg/openjpeg.c trunk/blender/extern/libopenjpeg/openjpeg.h trunk/blender/extern/libopenjpeg/opj_includes.h trunk/blender/extern/libopenjpeg/opj_malloc.h trunk/blender/extern/libopenjpeg/pi.c trunk/blender/extern/libopenjpeg/pi.h trunk/blender/extern/libopenjpeg/raw.c trunk/blender/extern/libopenjpeg/raw.h trunk/blender/extern/libopenjpeg/t1.c trunk/blender/extern/libopenjpeg/t1.h trunk/blender/extern/libopenjpeg/t1_generate_luts.c trunk/blender/extern/libopenjpeg/t1_luts.h trunk/blender/extern/libopenjpeg/t2.c trunk/blender/extern/libopenjpeg/t2.h trunk/blender/extern/libopenjpeg/tcd.c trunk/blender/extern/libopenjpeg/tcd.h trunk/blender/extern/libopenjpeg/tgt.c trunk/blender/extern/libopenjpeg/tgt.h trunk/blender/extern/libredcode/ trunk/blender/extern/libredcode/AUTHOR trunk/blender/extern/libredcode/LICENSE trunk/blender/extern/libredcode/NOTES trunk/blender/extern/libredcode/SConscript trunk/blender/extern/libredcode/codec.c trunk/blender/extern/libredcode/codec.h trunk/blender/extern/libredcode/debayer.c trunk/blender/extern/libredcode/debayer.h trunk/blender/extern/libredcode/format.c trunk/blender/extern/libredcode/format.h Modified: trunk/blender/config/linux2-config.py =================================================================== --- trunk/blender/config/linux2-config.py 2008-06-02 20:52:40 UTC (rev 15088) +++ trunk/blender/config/linux2-config.py 2008-06-02 21:35:57 UTC (rev 15089) @@ -130,6 +130,24 @@ BF_FFMPEG_INC = '${BF_FFMPEG}/include' BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib' +WITH_BF_OPENJPEG = 'true' +BF_OPENJPEG = '#extern/libopenjpeg' +BF_OPENJPEG_LIB = '' +# Uncomment the following two lines to use system's ffmpeg +# BF_FFMPEG = '/usr' +# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil' +BF_OPENJPEG_INC = '${BF_OPENJPEG}/include' +BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' + +WITH_BF_REDCODE = 'true' +BF_REDCODE = '#extern/libredcode' +BF_REDCODE_LIB = '' +# Uncomment the following two lines to use system's ffmpeg +# BF_FFMPEG = '/usr' +# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil' +BF_REDCODE_INC = '${BF_REDCODE}/include' +BF_REDCODE_LIBPATH='${BF_REDCODE}/lib' + # Mesa Libs should go here if your using them as well.... WITH_BF_STATICOPENGL = 'false' BF_OPENGL = '/usr' Modified: trunk/blender/extern/SConscript =================================================================== --- trunk/blender/extern/SConscript 2008-06-02 20:52:40 UTC (rev 15088) +++ trunk/blender/extern/SConscript 2008-06-02 21:35:57 UTC (rev 15089) @@ -21,5 +21,11 @@ SConscript(['xvidcore/SConscript']) SConscript(['ffmpeg/SConscript']) +if env['WITH_BF_OPENJPEG'] and env['BF_OPENJPEG_LIB'] == '': + SConscript(['libopenjpeg/SConscript']) + +if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '': + SConscript(['libredcode/SConscript']) + if env['OURPLATFORM'] == 'linux2': SConscript(['binreloc/SConscript']); Added: trunk/blender/extern/libopenjpeg/SConscript =================================================================== --- trunk/blender/extern/libopenjpeg/SConscript (rev 0) +++ trunk/blender/extern/libopenjpeg/SConscript 2008-06-02 21:35:57 UTC (rev 15089) @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import sys + +Import('env') + +sources = env.Glob('*.c') +incs = '.' + +flags = "-Wall -O3 -ffast-math -std=c99" + +oj_env = env.Copy(); +oj_env.Replace(CCFLAGS = '') +oj_env.Replace(BF_DEBUG_FLAGS = '') + +oj_env.BlenderLib ( libname='extern_openjpeg', + sources=sources, includes=Split(incs), + defines=[], + libtype=['core','intern','player'], + priority=[10, 10, 300], compileflags = Split(flags)) Added: trunk/blender/extern/libopenjpeg/bio.c =================================================================== --- trunk/blender/extern/libopenjpeg/bio.c (rev 0) +++ trunk/blender/extern/libopenjpeg/bio.c 2008-06-02 21:35:57 UTC (rev 15089) @@ -0,0 +1,187 @@ +/* + * 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 and Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * 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 "opj_includes.h" + +/** @defgroup BIO BIO - Individual bit input-output stream */ +/[EMAIL PROTECTED]/ + +/** @name Local static functions */ +/[EMAIL PROTECTED]/ + +/** +Write a bit [EMAIL PROTECTED] bio BIO handle [EMAIL PROTECTED] b Bit to write (0 or 1) +*/ +static void bio_putbit(opj_bio_t *bio, int b); +/** +Read a bit [EMAIL PROTECTED] bio BIO handle [EMAIL PROTECTED] Returns the read bit +*/ +static int bio_getbit(opj_bio_t *bio); +/** +Write a byte [EMAIL PROTECTED] bio BIO handle [EMAIL PROTECTED] Returns 0 if successful, returns 1 otherwise +*/ +static int bio_byteout(opj_bio_t *bio); +/** +Read a byte [EMAIL PROTECTED] bio BIO handle [EMAIL PROTECTED] Returns 0 if successful, returns 1 otherwise +*/ +static int bio_bytein(opj_bio_t *bio); + +/[EMAIL PROTECTED]/ + +/[EMAIL PROTECTED]/ + +/* +========================================================== + local functions +========================================================== +*/ + +static int bio_byteout(opj_bio_t *bio) { + bio->buf = (bio->buf << 8) & 0xffff; + bio->ct = bio->buf == 0xff00 ? 7 : 8; + if (bio->bp >= bio->end) { + return 1; + } + *bio->bp++ = bio->buf >> 8; + return 0; +} + +static int bio_bytein(opj_bio_t *bio) { + bio->buf = (bio->buf << 8) & 0xffff; + bio->ct = bio->buf == 0xff00 ? 7 : 8; + if (bio->bp >= bio->end) { + return 1; + } + bio->buf |= *bio->bp++; + return 0; +} + +static void bio_putbit(opj_bio_t *bio, int b) { + if (bio->ct == 0) { + bio_byteout(bio); + } + bio->ct--; + bio->buf |= b << bio->ct; +} + +static int bio_getbit(opj_bio_t *bio) { + if (bio->ct == 0) { + bio_bytein(bio); + } + bio->ct--; + return (bio->buf >> bio->ct) & 1; +} + +/* +========================================================== + Bit Input/Output interface +========================================================== +*/ + +opj_bio_t* bio_create(void) { + opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t)); + return bio; +} + +void bio_destroy(opj_bio_t *bio) { + if(bio) { + opj_free(bio); + } +} + +int bio_numbytes(opj_bio_t *bio) { + return (bio->bp - bio->start); +} + +void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len) { + bio->start = bp; + bio->end = bp + len; + bio->bp = bp; + bio->buf = 0; + bio->ct = 8; +} + +void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len) { + bio->start = bp; + bio->end = bp + len; + bio->bp = bp; + bio->buf = 0; + bio->ct = 0; +} + +void bio_write(opj_bio_t *bio, int v, int n) { + int i; + for (i = n - 1; i >= 0; i--) { + bio_putbit(bio, (v >> i) & 1); + } +} + +int bio_read(opj_bio_t *bio, int n) { + int i, v; + v = 0; + for (i = n - 1; i >= 0; i--) { + v += bio_getbit(bio) << i; + } + return v; +} + +int bio_flush(opj_bio_t *bio) { + bio->ct = 0; + if (bio_byteout(bio)) { + return 1; + } + if (bio->ct == 7) { + bio->ct = 0; + if (bio_byteout(bio)) { + return 1; + } + } + return 0; +} + +int bio_inalign(opj_bio_t *bio) { + bio->ct = 0; + if ((bio->buf & 0xff) == 0xff) { + if (bio_bytein(bio)) { + return 1; + } + bio->ct = 0; + } + return 0; +} Added: trunk/blender/extern/libopenjpeg/bio.h =================================================================== --- trunk/blender/extern/libopenjpeg/bio.h (rev 0) +++ trunk/blender/extern/libopenjpeg/bio.h 2008-06-02 21:35:57 UTC (rev 15089) @@ -0,0 +1,125 @@ +/* + * 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 and Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * 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. + */ + +#ifndef __BIO_H +#define __BIO_H +/** [EMAIL PROTECTED] bio.h [EMAIL PROTECTED] Implementation of an individual bit input-output (BIO) + +The functions in BIO.C have for goal to realize an individual bit input - output. +*/ + +/** @defgroup BIO BIO - Individual bit input-output stream */ +/[EMAIL PROTECTED]/ + +/** +Individual bit input-output stream (BIO) +*/ +typedef struct opj_bio { + /** pointer to the start of the buffer */ + unsigned char *start; + /** pointer to the end of the buffer */ + unsigned char *end; + /** pointer to the present position in the buffer */ + unsigned char *bp; + /** temporary place where each byte is read or written */ + unsigned int buf; + /** coder : number of bits free to write. decoder : number of bits read */ + int ct; +} opj_bio_t; + +/** @name Exported functions */ +/[EMAIL PROTECTED]/ +/* ----------------------------------------------------------------------- */ +/** +Create a new BIO handle [EMAIL PROTECTED] Returns a new BIO handle if successful, returns NULL otherwise +*/ +opj_bio_t* bio_create(void); +/** @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs