[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58412] branches/soc-2013-vse/source/ blender: This is initial commit for sequencer engine.
Alexander Kuznetsov
kuzsasha at gmail.com
Fri Jul 19 18:30:08 CEST 2013
Revision: 58412
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58412
Author: alexk
Date: 2013-07-19 16:30:08 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
This is initial commit for sequencer engine.
However, the code is still in process of migration to C++.
The engine gets buckets with commands which it should schedule and execute on devices.
More information here on design:
http://wiki.blender.org/index.php/User:AlexK/Gsoc2013
Added Paths:
-----------
branches/soc-2013-vse/source/blender/sequencer/
branches/soc-2013-vse/source/blender/sequencer/CMakeLists.txt
branches/soc-2013-vse/source/blender/sequencer/kernel/
branches/soc-2013-vse/source/blender/sequencer/kernel/include_type_float.cl
branches/soc-2013-vse/source/blender/sequencer/kernel/kernel_main.cl
branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.cpp
branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.h
branches/soc-2013-vse/source/blender/sequencer/sequencer_command.cpp
branches/soc-2013-vse/source/blender/sequencer/sequencer_command.h
branches/soc-2013-vse/source/blender/sequencer/sequencer_common.h
branches/soc-2013-vse/source/blender/sequencer/sequencer_device.cpp
branches/soc-2013-vse/source/blender/sequencer/sequencer_device.h
branches/soc-2013-vse/source/blender/sequencer/sequencer_effect.cpp
branches/soc-2013-vse/source/blender/sequencer/sequencer_effect.h
branches/soc-2013-vse/source/blender/sequencer/sequencer_main.cpp
branches/soc-2013-vse/source/blender/sequencer/sequencer_main.h
Added: branches/soc-2013-vse/source/blender/sequencer/CMakeLists.txt
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/CMakeLists.txt (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/CMakeLists.txt 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,66 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2013, Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): Alexandr Kuznetsov.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+ ./kernal
+ ../../../intern/opencl
+ ../../../intern/guardedalloc
+ ../makesdna
+ ../blenlib
+ ../cldm
+ ../imbuf
+)
+
+set(INC_SYS
+ ${GLEW_INCLUDE_PATH}
+)
+
+set(SRC
+ sequencer_main.cpp
+ sequencer_command.cpp
+ sequencer_device.cpp
+ sequencer_effect.cpp
+ sequencer_bucket.cpp
+
+ sequencer_main.h
+ sequencer_command.h
+ sequencer_device.h
+ sequencer_effect.h
+ sequencer_bucket.h
+
+ sequencer_common.h
+
+)
+
+
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
+
+data_to_c_simple_dev(kernel/kernel_main.cl SRC)
+data_to_c_simple_dev(kernel/include_type_float.cl SRC)
+
+
+
+blender_add_lib(bf_sequencer "${SRC}" "${INC}" "${INC_SYS}")
Added: branches/soc-2013-vse/source/blender/sequencer/kernel/include_type_float.cl
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/kernel/include_type_float.cl (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/kernel/include_type_float.cl 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,8 @@
+#define VS_TYPE (3)
+typedef float vst;
+typedef float2 vst2;
+#define vst3 float3
+typedef float4 vst4;
+typedef float8 vst8;
+typedef float16 vst16;
+
Added: branches/soc-2013-vse/source/blender/sequencer/kernel/kernel_main.cl
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/kernel/kernel_main.cl (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/kernel/kernel_main.cl 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,64 @@
+
+__kernel void square_dain(
+ __global float* in,
+ __global float* out,
+ const unsigned int sizex,
+ const unsigned int sizey)
+{
+ int i = get_global_id(0);
+ int j = get_global_id(1);
+
+
+ if(i>=sizex || j>=sizey)return;
+
+
+ int pos = j*sizex+i;
+ float val = in[pos*4];
+ out[pos*4]=val*val;
+
+
+};
+
+
+__kernel void testme_add(
+ __global float* in,
+ __global float* out,
+ const float val,
+ const unsigned int sizex,
+ const unsigned int sizey)
+{
+ int i = get_global_id(0);
+ int j = get_global_id(1);
+
+
+ if(i>=sizex || j>=sizey)return;
+
+
+ int pos = j*sizex+i;
+;
+ out[pos] = in[pos]+val;
+
+
+};
+
+
+__kernel void testme_multiply(
+ __global float* in,
+ __global float* out,
+ const float val,
+ const unsigned int sizex,
+ const unsigned int sizey)
+{
+ int i = get_global_id(0);
+ int j = get_global_id(1);
+
+
+ if(i>=sizex || j>=sizey)return;
+
+
+ int pos = j*sizex+i;
+;
+ out[pos] = in[pos]*val;
+
+
+};
\ No newline at end of file
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.cpp
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.cpp (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.cpp 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1 @@
+
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.h
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.h (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_bucket.h 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,8 @@
+#ifndef __SEQUENCER_BUCKET_H__
+#define __SEQUENCER_BUCKET_H__
+
+
+
+
+
+#endif /* __SEQUENCER_BUCKET_H__ */
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_command.cpp
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_command.cpp (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_command.cpp 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,106 @@
+
+#include "sequencer_command.h"
+#include "sequencer_bucket.h"
+#include "sequencer_common.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "MEM_guardedalloc.h"
+
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+#include "IMB_colormanagement.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+extern ImBuf * maintestimg;;
+
+
+
+int seq_CommandGenTest::exec_cpu(seqBucket *bucket)
+{
+ uint size[2];
+ uint i, j;
+
+
+ float *ri;
+
+ unsigned char *rect = (unsigned char *)maintestimg->rect;
+
+
+ size[0] = bucket->ImStack[this->outimgid].size[0];
+ size[1] = bucket->ImStack[this->outimgid].size[1];
+
+ bucket->internalImg[this->outimgid].pointer =
+ ri = (float*)MEM_callocN(sizeof(float)*4*size[0]*size[1], "seqTempImg");
+
+ bucket->internalImg[this->outimgid].memtype |= SEQ_DATA_STORAGE_MAINMEMORY;
+
+
+ for(i = 0; i < size[0]; i++)
+ {
+ for(j = 0; j < size[1]; j++)
+ {
+ ri[4*(j*size[0]+i)] = 1.0f/255.0f*rect[4*(j*maintestimg->y/size[1]*maintestimg->x+i*maintestimg->x/size[0])];
+ ri[4*(j*size[0]+i)+1] = 1.0f/255.0f*rect[4*(j*maintestimg->y/size[1]*maintestimg->x+i*maintestimg->x/size[0])+1];
+ ri[4*(j*size[0]+i)+2] = 1.0f/255.0f*rect[4*(j*maintestimg->y/size[1]*maintestimg->x+i*maintestimg->x/size[0])+2];
+ ri[4*(j*size[0]+i)+3] = 1.0f;
+
+ }
+
+ }
+
+
+ return 7;
+}
+
+
+
+
+
+
+int seq_CommandBrightenssAndContrast::exec_cpu(seqBucket * bucket)
+{
+
+ uint size[2];
+ uint i;
+
+
+
+float constrast = 1;
+float brightness = 0;
+
+
+ float *rio, *rii;
+
+
+
+ size[0] = bucket->ImStack[this->outimgid].size[0];
+ size[1] = bucket->ImStack[this->outimgid].size[1];
+
+ bucket->internalImg[this->outimgid].pointer =
+ rio = (float*)MEM_callocN(sizeof(float)*4*size[0]*size[1], "seqTempImg");
+
+ bucket->internalImg[this->outimgid].memtype |= SEQ_DATA_STORAGE_MAINMEMORY;
+
+ rii = (float*)bucket->internalImg[this->inimgid].pointer;
+
+
+ for(i=0; i < 4 * size[0] * size[1]; i+=4)
+ {
+ rio[i] = (rii[i]+brightness-0.5f)*constrast+0.5f;
+ rio[i+1] = (rii[i+1]+brightness-0.5f)*constrast+0.5f;
+ rio[i+2] = (rii[i+2]+brightness-0.5f)*constrast+0.5f;
+ rio[i+3] = rii[i+3];
+
+ }
+
+
+ return 7;
+}
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_command.h
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_command.h (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_command.h 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,147 @@
+#ifndef __SEQUENCER_COMMAND_H__
+#define __SEQUENCER_COMMAND_H__
+
+#include "sequencer_common.h"
+
+
+class seq_CommandBase
+{
+public:
+
+ virtual int get_number_input(void)
+ {
+ return 0;
+ }
+
+
+ virtual int get_input_id(int imputn)
+ {
+ return -1;
+ }
+
+
+
+ virtual int exec_cpu(seqBucket *bucket)
+ {
+ return 5;
+ }
+ ;
+
+
+};
+
+
+
+
+class seq_CommandAlphaOver : public seq_CommandBase
+{
+public:
+
+ int get_number_input(void)
+ {
+ return 1;
+ }
+
+
+ int get_input_id(int imputn)
+ {
+ return -1;
+ }
+
+
+ int exec_cpu(seqBucket *bucket);
+
+
+ int get_implementation_devies(void);
+
+};
+
+
+
+class seq_CommandBrightenssAndContrast : public seq_CommandBase
+{
+public:
+
+
+ int outimgid;
+ int inimgid;
+
+
+ int get_number_input(void)
+ {
+ return 1;
+ }
+
+
+ int get_input_id(int imputn)
+ {
+ return -1;
+ }
+
+
+ int exec_cpu(seqBucket * bucket);
+
+
+ int get_implementation_devies(void);
+
+
+};
+
+
+
+
+class seq_CommandGenTest : public seq_CommandBase
+{
+public:
+
+ int outimgid;
+
+ int get_number_input(void)
+ {
+ return 0;
+ }
+
+
+ int get_input_id(int imputn)
+ {
+ return -1;
+ }
+
+
+ int exec_cpu(seqBucket *bucket);
+
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif /* __SEQUENCER_COMMAND_H__ */
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_common.h
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_common.h (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_common.h 2013-07-19 16:30:08 UTC (rev 58412)
@@ -0,0 +1,130 @@
+
+#ifndef __SEQUENCER_COMMON_H__
+#define __SEQUENCER_COMMON_H__
+
+#include <vector>
+
+#include "sequencer_main.h"
+
+
+typedef struct seqFrame seqFrame;
+
+
+class seq_CommandBase;
+
+typedef struct seqBucket
+{
+
+
+
+ struct seqBucket *next, *prev;
+
+
+
+
+
+ uint bid;
+
+
+ ThreadMutex bucket_mutex;
+ int refcount;
+
+
+ seqFrame *framep;
+ uint status;
+ uint devreq;
+
+ struct seqOutputImage * foi;
+
+ seqDevice *device_associated;
+
+
+
+ uint type; /* CPU or and GPU */
+
+ size_t dl_num;
+ seqBucket_deplist * dl;
+
+
+ size_t imagest_num;
+ seqImageStackInfo *ImStack;
+
+
+ seqImageStorage firstImgOutput;
+
+ seqImageStorage *internalImg;
+
+ void *commands;
+
+
+ std::vector<seq_CommandBase*> commands_cpp;
+
+
+
+
+} seqBucket;
+
+
+
+
+typedef enum seqOutput_Type
+{
+ SEQ_OUTPUT_TYPE_IMAGE = 1,
+ SEQ_OUTPUT_TYPE_SOUND = 2
+
+} seqOutput_Type;
+
+
+class seqOutput
+{
+ public:
+ seqOutput_Type type;
+} ;
+
+
+class seqOutputImage : public seqOutput
+{
+
+public:
+
+ size_t num_buckets_no;
+ seqBucket *buckets_no;
+
+ std::vector<seqBucket*> buckets_cpp;
+
+
+ uint size[2];
+
+ uint textid;
+
+
+
+} ;
+
+
+
+
+typedef struct seqFrame
+{
+ struct seqFrame *next, *prev;
+
+
+ int refcount;
+
+ uint time;
+ uint id;
+
+ uchar dropflag;
+
+
+ uchar num_outputs;
+ seqOutput ** Outputs;
+
+
+
+
+
+} seqFrame;
+
+
+#endif /*__SEQUENCER_COMMON_H__*/
Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_device.cpp
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list