hornetseye-frame 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +20 -16
- data/ext/colourspace.cc +69 -25
- data/ext/colourspace.hh +1 -1
- data/ext/frame.cc +5 -0
- data/ext/frame.hh +2 -1
- data/ext/init.cc +4 -1
- data/ext/rubyinc.hh +54 -0
- data/lib/hornetseye-frame/fourcc.rb +3 -2
- data/lib/hornetseye-frame/frame.rb +21 -0
- data/lib/hornetseye-frame/node.rb +45 -0
- data/lib/hornetseye_frame_ext.rb +1 -1
- data/test/tc_frame.rb +97 -0
- data/test/ts_frame.rb +19 -0
- metadata +9 -5
data/Rakefile
CHANGED
@@ -3,10 +3,11 @@ require 'date'
|
|
3
3
|
require 'rake/clean'
|
4
4
|
require 'rake/testtask'
|
5
5
|
require 'rake/packagetask'
|
6
|
+
require 'rake/loaders/makefile'
|
6
7
|
require 'rbconfig'
|
7
8
|
|
8
9
|
PKG_NAME = 'hornetseye-frame'
|
9
|
-
PKG_VERSION = '0.
|
10
|
+
PKG_VERSION = '0.3.0'
|
10
11
|
CXX = ENV[ 'CXX' ] || 'g++'
|
11
12
|
STRIP = ENV[ 'STRIP' ] || 'strip'
|
12
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
@@ -27,16 +28,16 @@ HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-frame/}
|
|
27
28
|
|
28
29
|
OBJ = CC_FILES.ext 'o'
|
29
30
|
$CXXFLAGS = ENV[ 'CXXFLAGS' ] || ''
|
30
|
-
$CXXFLAGS = "#{$CXXFLAGS} -fPIC"
|
31
|
-
if
|
32
|
-
$CXXFLAGS
|
33
|
-
"-I#{
|
31
|
+
$CXXFLAGS = "#{$CXXFLAGS} -fPIC -DNDEBUG"
|
32
|
+
if RbConfig::CONFIG[ 'rubyhdrdir' ]
|
33
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'rubyhdrdir' ]} " +
|
34
|
+
"-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
|
34
35
|
else
|
35
|
-
$CXXFLAGS
|
36
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'archdir' ]}"
|
36
37
|
end
|
37
|
-
$LIBRUBYARG =
|
38
|
-
$SITELIBDIR =
|
39
|
-
$SITEARCHDIR =
|
38
|
+
$LIBRUBYARG = RbConfig::CONFIG[ 'LIBRUBYARG' ]
|
39
|
+
$SITELIBDIR = RbConfig::CONFIG[ 'sitelibdir' ]
|
40
|
+
$SITEARCHDIR = RbConfig::CONFIG[ 'sitearchdir' ]
|
40
41
|
|
41
42
|
task :default => :all
|
42
43
|
|
@@ -44,7 +45,7 @@ desc 'Compile Ruby extension (default)'
|
|
44
45
|
task :all => [ SO_FILE ]
|
45
46
|
|
46
47
|
file SO_FILE => OBJ do |t|
|
47
|
-
sh "#{CXX} -shared -o #{t.name} #{OBJ} #{$LIBRUBYARG}"
|
48
|
+
sh "#{CXX} -shared -o #{t.name} #{OBJ} -lswscale #{$LIBRUBYARG}"
|
48
49
|
sh "#{STRIP} --strip-all #{t.name}"
|
49
50
|
end
|
50
51
|
|
@@ -93,6 +94,7 @@ Rake::PackageTask.new PKG_NAME, PKG_VERSION do |p|
|
|
93
94
|
end
|
94
95
|
|
95
96
|
begin
|
97
|
+
require 'rubygems'
|
96
98
|
require 'rubygems/builder'
|
97
99
|
$SPEC = Gem::Specification.new do |s|
|
98
100
|
s.name = PKG_NAME
|
@@ -166,12 +168,14 @@ rule '.o' => '.cc' do |t|
|
|
166
168
|
sh "#{CXX} #{$CXXFLAGS} -c -o #{t.name} #{t.source}"
|
167
169
|
end
|
168
170
|
|
169
|
-
file
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
file ".depends.mf" do |t|
|
172
|
+
sh "makedepend -f- -- #{$CXXFLAGS} -- #{CC_FILES.join ' '} > #{t.name}"
|
173
|
+
end
|
174
|
+
CC_FILES.each do |t|
|
175
|
+
file t.ext(".o") => t
|
176
|
+
end
|
177
|
+
import ".depends.mf"
|
174
178
|
|
175
179
|
CLEAN.include 'ext/*.o'
|
176
|
-
CLOBBER.include SO_FILE, 'doc', '.yardoc'
|
180
|
+
CLOBBER.include SO_FILE, 'doc', '.yardoc', '.depends.mf'
|
177
181
|
|
data/ext/colourspace.cc
CHANGED
@@ -21,17 +21,65 @@ extern "C" {
|
|
21
21
|
|
22
22
|
using namespace std;
|
23
23
|
|
24
|
-
static
|
24
|
+
static void setupFormat( const string &typecode, int width, int height, char *memory,
|
25
|
+
enum PixelFormat *format,
|
26
|
+
uint8_t **data, int *lineSize ) throw (Error)
|
25
27
|
{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
if ( typecode == "UBYTE" ) {
|
29
|
+
*format = PIX_FMT_GRAY8;
|
30
|
+
data[ 0 ] = (uint8_t *)memory;
|
31
|
+
lineSize[ 0 ] = width;
|
32
|
+
} else if ( typecode == "UBYTERGB" ) {
|
33
|
+
*format = PIX_FMT_RGB24;
|
34
|
+
data[ 0 ] = (uint8_t *)memory;
|
35
|
+
lineSize[ 0 ] = width * 3;
|
36
|
+
} else if ( typecode == "BGR " ) {
|
37
|
+
*format = PIX_FMT_BGR24;
|
38
|
+
data[ 0 ] = (uint8_t *)memory;
|
39
|
+
lineSize[ 0 ] = width * 3;
|
40
|
+
} else if ( typecode == "BGRA" ) {
|
41
|
+
*format = PIX_FMT_BGRA;
|
42
|
+
data[ 0 ] = (uint8_t *)memory;
|
43
|
+
lineSize[ 0 ] = width * 4;
|
44
|
+
} else if ( typecode == "YV12" ) {
|
45
|
+
*format = PIX_FMT_YUV420P;
|
46
|
+
int
|
47
|
+
width2 = ( width + 1 ) / 2,
|
48
|
+
height2 = ( height + 1 ) / 2,
|
49
|
+
widtha = ( width + 7 ) & ~0x7,
|
50
|
+
width2a = ( width2 + 7 ) & ~0x7;
|
51
|
+
data[ 0 ] = (uint8_t *)memory;
|
52
|
+
data[ 2 ] = (uint8_t *)memory + widtha * height;
|
53
|
+
data[ 1 ] = (uint8_t *)data[ 2 ] + width2a * height2;
|
54
|
+
lineSize[ 0 ] = widtha;
|
55
|
+
lineSize[ 1 ] = ( ( width + 1 ) / 2 + 7 ) & ~0x7;
|
56
|
+
lineSize[ 2 ] = ( ( width + 1 ) / 2 + 7 ) & ~0x7;
|
57
|
+
} else if ( typecode == "I420" ) {
|
58
|
+
*format = PIX_FMT_YUV420P;
|
59
|
+
int
|
60
|
+
width2 = width / 2,
|
61
|
+
height2 = height / 2;
|
62
|
+
data[ 0 ] = (uint8_t *)memory;
|
63
|
+
data[ 2 ] = (uint8_t *)memory + width * height;
|
64
|
+
data[ 1 ] = (uint8_t *)data[ 2 ] + width2 * height2;
|
65
|
+
lineSize[ 0 ] = width;
|
66
|
+
lineSize[ 1 ] = width2;
|
67
|
+
lineSize[ 2 ] = width2;
|
68
|
+
} else if ( typecode == "YUY2" ) {
|
69
|
+
*format = PIX_FMT_YUYV422;
|
70
|
+
int
|
71
|
+
width2 = ( width + 1 ) / 2,
|
72
|
+
widtha = ( width + 3 ) & ~0x3;
|
73
|
+
data[ 0 ] = (uint8_t *)memory;
|
74
|
+
lineSize[ 0 ] = 2 * widtha;
|
75
|
+
} else if ( typecode == "UYVY" ) {
|
76
|
+
*format = PIX_FMT_UYVY422;
|
77
|
+
int widtha = ( width + 1 ) & ~0x1;
|
78
|
+
data[ 0 ] = (uint8_t *)memory;
|
79
|
+
lineSize[ 0 ] = 2 * widtha;
|
80
|
+
} else {
|
81
|
+
ERRORMACRO( false, Error, , "Unsupported colourspace \"" << typecode << "\"" );
|
33
82
|
};
|
34
|
-
return retVal;
|
35
83
|
}
|
36
84
|
|
37
85
|
FramePtr frameToType( const FramePtr in, const string &target ) throw (Error)
|
@@ -40,22 +88,18 @@ FramePtr frameToType( const FramePtr in, const string &target ) throw (Error)
|
|
40
88
|
width = in->width(),
|
41
89
|
height = in->height();
|
42
90
|
FramePtr retVal( new Frame( target, width, height ) );
|
43
|
-
|
44
|
-
sourceData[
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
SwsContext *swsContext = sws_getContext( width, height,
|
56
|
-
stringToPixelFormat( in->typecode() ),
|
57
|
-
width, height,
|
58
|
-
stringToPixelFormat( target ),
|
91
|
+
enum PixelFormat sourceFormat;
|
92
|
+
uint8_t *sourceData[4];
|
93
|
+
int sourceLineSize[4];
|
94
|
+
setupFormat( in->typecode(), width, height, in->data(),
|
95
|
+
&sourceFormat, &sourceData[0], &sourceLineSize[0] );
|
96
|
+
enum PixelFormat destFormat;
|
97
|
+
uint8_t *destData[4];
|
98
|
+
int destLineSize[4];
|
99
|
+
setupFormat( retVal->typecode(), width, height, retVal->data(),
|
100
|
+
&destFormat, &destData[0], &destLineSize[0] );
|
101
|
+
SwsContext *swsContext = sws_getContext( width, height, sourceFormat,
|
102
|
+
width, height, destFormat,
|
59
103
|
SWS_FAST_BILINEAR, 0, 0, 0 );
|
60
104
|
sws_scale( swsContext, sourceData, sourceLineSize, 0,
|
61
105
|
height, destData, destLineSize );
|
data/ext/colourspace.hh
CHANGED
data/ext/frame.cc
CHANGED
data/ext/frame.hh
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#define FRAME_HH
|
18
18
|
|
19
19
|
#include <boost/smart_ptr.hpp>
|
20
|
-
#include
|
20
|
+
#include "rubyinc.hh"
|
21
21
|
#include <string>
|
22
22
|
|
23
23
|
class Frame
|
@@ -31,6 +31,7 @@ public:
|
|
31
31
|
int height(void);
|
32
32
|
char *data(void);
|
33
33
|
VALUE rubyObject(void) { return m_frame; }
|
34
|
+
void markRubyMember(void);
|
34
35
|
protected:
|
35
36
|
VALUE m_frame;
|
36
37
|
};
|
data/ext/init.cc
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU General Public License
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
16
|
-
#include
|
16
|
+
#include "rubyinc.hh"
|
17
17
|
#include "colourspace.hh"
|
18
18
|
|
19
19
|
#ifdef WIN32
|
@@ -32,7 +32,10 @@ extern "C" {
|
|
32
32
|
{
|
33
33
|
VALUE rbHornetseye = rb_define_module( "Hornetseye" );
|
34
34
|
VALUE cFrame = rb_define_class_under( rbHornetseye, "Frame_", rb_cObject );
|
35
|
+
VALUE cNode = rb_define_class_under( rbHornetseye, "Node", rb_cObject );
|
35
36
|
rb_define_method( cFrame, "to_type", RUBY_METHOD_FUNC( frameWrapToType ), 1 );
|
37
|
+
rb_define_method( cNode, "to_type_with_frame",
|
38
|
+
RUBY_METHOD_FUNC( frameWrapToType ), 1 );
|
36
39
|
rb_require( "hornetseye_frame_ext.rb" );
|
37
40
|
}
|
38
41
|
|
data/ext/rubyinc.hh
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
/* HornetsEye - Computer Vision with Ruby
|
2
|
+
Copyright (C) 2006, 2007 Jan Wedekind
|
3
|
+
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
16
|
+
#ifndef HORNETSEYE_RUBYINC_HH
|
17
|
+
#define HORNETSEYE_RUBYINC_HH
|
18
|
+
|
19
|
+
#ifdef RSHIFT
|
20
|
+
#undef RSHIFT
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#define gettimeofday rubygettimeofday
|
24
|
+
#define timezone rubygettimezone
|
25
|
+
#include <ruby.h>
|
26
|
+
// #include <version.h>
|
27
|
+
#undef timezone
|
28
|
+
#undef gettimeofday
|
29
|
+
#ifdef read
|
30
|
+
#undef read
|
31
|
+
#endif
|
32
|
+
#ifdef write
|
33
|
+
#undef write
|
34
|
+
#endif
|
35
|
+
#ifdef RGB
|
36
|
+
#undef RGB
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#ifndef RUBY_VERSION_NUMBER
|
40
|
+
#define RUBY_VERSION_NUMBER ( RUBY_VERSION_MAJOR * 10000 + \
|
41
|
+
RUBY_VERSION_MINOR * 100 + \
|
42
|
+
RUBY_VERSION_TEENY )
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#ifndef RUBY_METHOD_FUNC
|
46
|
+
#define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))func)
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#ifndef xfree
|
50
|
+
#define xfree free
|
51
|
+
#endif
|
52
|
+
|
53
|
+
#endif
|
54
|
+
|
@@ -47,10 +47,11 @@ module Hornetseye
|
|
47
47
|
|
48
48
|
module_function :FourCC
|
49
49
|
|
50
|
-
BGR = FourCC '
|
50
|
+
BGR = FourCC 'B', 'G', 'R', ' '
|
51
|
+
BGRA = FourCC 'B', 'G', 'R', 'A'
|
51
52
|
UYVY = FourCC 'U', 'Y', 'V', 'Y'
|
52
53
|
YUY2 = FourCC 'Y', 'U', 'Y', '2'
|
53
|
-
|
54
|
+
I420 = FourCC 'I', '4', '2', '0'
|
54
55
|
YV12 = FourCC 'Y', 'V', '1', '2'
|
55
56
|
MJPG = FourCC 'M', 'J', 'P', 'G'
|
56
57
|
|
@@ -39,6 +39,8 @@ module Hornetseye
|
|
39
39
|
case typecode
|
40
40
|
when BGR
|
41
41
|
width * height * 3
|
42
|
+
when BGRA
|
43
|
+
width * height * 4
|
42
44
|
when UYVY
|
43
45
|
width * height * 2
|
44
46
|
when YUY2
|
@@ -46,6 +48,8 @@ module Hornetseye
|
|
46
48
|
widtha * height * 2
|
47
49
|
when YV12
|
48
50
|
width * height * 3 / 2
|
51
|
+
when I420
|
52
|
+
width * height * 3 / 2
|
49
53
|
when MJPG
|
50
54
|
width * height * 2
|
51
55
|
else
|
@@ -81,6 +85,23 @@ module Hornetseye
|
|
81
85
|
self.class.height
|
82
86
|
end
|
83
87
|
|
88
|
+
alias_method :orig_to_type, :to_type
|
89
|
+
|
90
|
+
def to_type( target )
|
91
|
+
if target.is_a? Class
|
92
|
+
if ( target < INT_ and target != UBYTE ) or target < FLOAT_ or
|
93
|
+
target < COMPLEX_
|
94
|
+
to_type( UBYTE ).to_type target
|
95
|
+
elsif target < RGB_ and target != UBYTERGB
|
96
|
+
to_type( UBYTERGB ).to_type target
|
97
|
+
else
|
98
|
+
orig_to_type target
|
99
|
+
end
|
100
|
+
else
|
101
|
+
orig_to_type target
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
84
105
|
end
|
85
106
|
|
86
107
|
def Frame( typecode, width, height )
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# hornetseye-frame - Colourspace conversions and compression
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
# Namespace of Hornetseye computer vision library
|
18
|
+
module Hornetseye
|
19
|
+
|
20
|
+
class Node
|
21
|
+
|
22
|
+
alias_method :orig_to_type_with_frame, :to_type_with_frame
|
23
|
+
|
24
|
+
def to_type_with_frame( target )
|
25
|
+
if target.is_a? FourCC
|
26
|
+
if ( typecode < INT_ and typecode != UBYTE ) or typecode < FLOAT_
|
27
|
+
to_type( UBYTE ).to_type target
|
28
|
+
elsif typecode < COMPLEX_
|
29
|
+
real.to_type target
|
30
|
+
elsif typecode < RGB_ and typecode != UBYTERGB
|
31
|
+
to_type( UBYTERGB ).to_type target
|
32
|
+
else
|
33
|
+
orig_to_type_with_frame target
|
34
|
+
end
|
35
|
+
else
|
36
|
+
to_type_without_frame target
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
alias_method_chain :to_type, :frame
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
data/lib/hornetseye_frame_ext.rb
CHANGED
data/test/tc_frame.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# hornetseye-frame - Colourspace conversions and compression
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'test/unit'
|
18
|
+
begin
|
19
|
+
require 'rubygems'
|
20
|
+
rescue LoadError
|
21
|
+
end
|
22
|
+
Kernel::require 'hornetseye_frame'
|
23
|
+
|
24
|
+
class TC_Frame < Test::Unit::TestCase
|
25
|
+
|
26
|
+
UBYTERGB = Hornetseye::UBYTERGB
|
27
|
+
|
28
|
+
BGR = Hornetseye::BGR
|
29
|
+
UYVY = Hornetseye::UYVY
|
30
|
+
YUY2 = Hornetseye::YUY2
|
31
|
+
I420 = Hornetseye::I420
|
32
|
+
YV12 = Hornetseye::YV12
|
33
|
+
|
34
|
+
F = Hornetseye::Frame
|
35
|
+
|
36
|
+
def C( *args )
|
37
|
+
Hornetseye::RGB *args
|
38
|
+
end
|
39
|
+
|
40
|
+
def M( *args )
|
41
|
+
Hornetseye::MultiArray *args
|
42
|
+
end
|
43
|
+
|
44
|
+
def F( *args )
|
45
|
+
Hornetseye::Frame *args
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_frame_inspect
|
49
|
+
assert_equal 'Frame(YV12,320,240)', F( YV12, 320, 240 ).inspect
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_frame_to_s
|
53
|
+
assert_equal 'Frame(YV12,320,240)', F( YV12, 320, 240 ).to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_frame_typecode
|
57
|
+
assert_equal YV12, F( YV12, 320, 240 ).typecode
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_frame_width
|
61
|
+
assert_equal 320, F( YV12, 320, 240 ).width
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_frame_height
|
65
|
+
assert_equal 240, F( YV12, 320, 240 ).height
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_frame_shape
|
69
|
+
assert_equal [ 320, 240 ], F( YV12, 320, 240 ).shape
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_typecode
|
73
|
+
assert_equal YV12, F.new( YV12, 320, 240 ).typecode
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_shape
|
77
|
+
assert_equal [ 320, 240 ], F.new( YV12, 320, 240 ).shape
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_width
|
81
|
+
assert_equal 320, F.new( YV12, 320, 240 ).width
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_height
|
85
|
+
assert_equal 240, F.new( YV12, 320, 240 ).height
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_to_type
|
89
|
+
m = M( Hornetseye::UBYTERGB, 160, 120 ).new.fill! C( 32, 64, 128 )
|
90
|
+
[ UYVY, YUY2, I420, YV12 ].each do |c|
|
91
|
+
result = m.to_type( c ).to_type UBYTERGB
|
92
|
+
assert_equal ( m / 8.0 ).round, ( result / 8.0 ).round
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
data/test/ts_frame.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# hornetseye-frame - Colourspace conversions and compression
|
3
|
+
# Copyright (C) 2010 Jan Wedekind
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require 'tc_frame'
|
19
|
+
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 3
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-05 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -73,13 +73,17 @@ files:
|
|
73
73
|
- .document
|
74
74
|
- lib/hornetseye-frame/fourcc.rb
|
75
75
|
- lib/hornetseye-frame/frame.rb
|
76
|
+
- lib/hornetseye-frame/node.rb
|
76
77
|
- lib/hornetseye_frame_ext.rb
|
77
78
|
- ext/init.cc
|
78
79
|
- ext/frame.cc
|
79
80
|
- ext/colourspace.cc
|
80
81
|
- ext/frame.hh
|
81
82
|
- ext/colourspace.hh
|
83
|
+
- ext/rubyinc.hh
|
82
84
|
- ext/error.hh
|
85
|
+
- test/ts_frame.rb
|
86
|
+
- test/tc_frame.rb
|
83
87
|
has_rdoc: yard
|
84
88
|
homepage: http://wedesoft.github.com/hornetseye-frame/
|
85
89
|
licenses: []
|
@@ -113,5 +117,5 @@ rubygems_version: 1.3.7
|
|
113
117
|
signing_key:
|
114
118
|
specification_version: 3
|
115
119
|
summary: Colourspace conversions and compression
|
116
|
-
test_files:
|
117
|
-
|
120
|
+
test_files:
|
121
|
+
- test/tc_frame.rb
|