hornetseye-frame 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -8,15 +8,15 @@ require 'rbconfig'
8
8
  require 'tempfile'
9
9
 
10
10
  PKG_NAME = 'hornetseye-frame'
11
- PKG_VERSION = '0.8.0'
11
+ PKG_VERSION = '0.8.1'
12
+ CFG = RbConfig::CONFIG
12
13
  CXX = ENV[ 'CXX' ] || 'g++'
13
- STRIP = ENV[ 'STRIP' ] || 'strip'
14
14
  RB_FILES = FileList[ 'lib/**/*.rb' ]
15
15
  CC_FILES = FileList[ 'ext/*.cc' ]
16
16
  HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
17
17
  TC_FILES = FileList[ 'test/tc_*.rb' ]
18
18
  TS_FILES = FileList[ 'test/ts_*.rb' ]
19
- SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.so"
19
+ SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.#{CFG[ 'DLEXT' ]}"
20
20
  PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
21
21
  RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
22
22
  BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
@@ -28,17 +28,18 @@ EMAIL = %q{jan@wedesoft.de}
28
28
  HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-frame/}
29
29
 
30
30
  OBJ = CC_FILES.ext 'o'
31
- $CXXFLAGS = ENV[ 'CXXFLAGS' ] || ''
32
- $CXXFLAGS = "#{$CXXFLAGS} -fPIC -DNDEBUG -DHAVE_CONFIG_H"
33
- if RbConfig::CONFIG[ 'rubyhdrdir' ]
34
- $CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'rubyhdrdir' ]} " +
35
- "-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
31
+ $CXXFLAGS = "-DNDEBUG -DHAVE_CONFIG_H #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
32
+ if CFG[ 'rubyhdrdir' ]
33
+ $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
34
+ "-I#{CFG[ 'rubyhdrdir' ]}/#{CFG[ 'arch' ]}"
36
35
  else
37
- $CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'archdir' ]}"
36
+ $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'archdir' ]}"
38
37
  end
39
- $LIBRUBYARG = RbConfig::CONFIG[ 'LIBRUBYARG' ]
40
- $SITELIBDIR = RbConfig::CONFIG[ 'sitelibdir' ]
41
- $SITEARCHDIR = RbConfig::CONFIG[ 'sitearchdir' ]
38
+ $LIBRUBYARG = "-L#{CFG[ 'libdir' ]} #{CFG[ 'LIBRUBYARG' ]} #{CFG[ 'LDFLAGS' ]} " +
39
+ "#{CFG[ 'SOLIBS' ]} #{CFG[ 'DLDLIBS' ]}"
40
+ $SITELIBDIR = CFG[ 'sitelibdir' ]
41
+ $SITEARCHDIR = CFG[ 'sitearchdir' ]
42
+ $LDSHARED = CFG[ 'LDSHARED' ][ CFG[ 'LDSHARED' ].index( ' ' ) .. -1 ]
42
43
 
43
44
  task :default => :all
44
45
 
@@ -47,7 +48,6 @@ task :all => [ SO_FILE ]
47
48
 
48
49
  file SO_FILE => OBJ do |t|
49
50
  sh "#{CXX} -shared -o #{t.name} #{OBJ} -lswscale #{$LIBRUBYARG}"
50
- sh "#{STRIP} --strip-all #{t.name}"
51
51
  end
52
52
 
53
53
  task :test => [ SO_FILE ]
@@ -208,7 +208,7 @@ rule '.o' => '.cc' do |t|
208
208
  end
209
209
 
210
210
  file ".depends.mf" => :config_h do |t|
211
- sh "g++ -MM #{$CXXFLAGS} #{CC_FILES.join ' '} | " +
211
+ sh "g++ -MM #{CC_FILES.join ' '} | " +
212
212
  "sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
213
213
  "sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
214
214
  end
data/ext/colourspace.cc CHANGED
@@ -59,13 +59,13 @@ static void setupFormat( const string &typecode, int width, int height, char *me
59
59
  data[ 2 ] = (uint8_t *)memory + widtha * height;
60
60
  data[ 1 ] = (uint8_t *)data[ 2 ] + width2a * height2;
61
61
  lineSize[ 0 ] = widtha;
62
- lineSize[ 1 ] = ( ( width + 1 ) / 2 + 7 ) & ~0x7;
63
- lineSize[ 2 ] = ( ( width + 1 ) / 2 + 7 ) & ~0x7;
62
+ lineSize[ 1 ] = width2a;
63
+ lineSize[ 2 ] = width2a;
64
64
  } else if ( typecode == "I420" ) {
65
65
  *format = PIX_FMT_YUV420P;
66
66
  int
67
- width2 = width / 2,
68
- height2 = height / 2;
67
+ width2 = ( width + 1 ) / 2,
68
+ height2 = ( height + 1 ) / 2;
69
69
  data[ 0 ] = (uint8_t *)memory;
70
70
  data[ 1 ] = (uint8_t *)memory + width * height;
71
71
  data[ 2 ] = (uint8_t *)data[ 1 ] + width2 * height2;
@@ -75,13 +75,12 @@ static void setupFormat( const string &typecode, int width, int height, char *me
75
75
  } else if ( typecode == "YUY2" ) {
76
76
  *format = PIX_FMT_YUYV422;
77
77
  int
78
- width2 = ( width + 1 ) / 2,
79
78
  widtha = ( width + 3 ) & ~0x3;
80
79
  data[ 0 ] = (uint8_t *)memory;
81
80
  lineSize[ 0 ] = 2 * widtha;
82
81
  } else if ( typecode == "UYVY" ) {
83
82
  *format = PIX_FMT_UYVY422;
84
- int widtha = ( width + 1 ) & ~0x1;
83
+ int widtha = ( width + 3 ) & ~0x3;
85
84
  data[ 0 ] = (uint8_t *)memory;
86
85
  lineSize[ 0 ] = 2 * widtha;
87
86
  } else {
@@ -42,12 +42,17 @@ module Hornetseye
42
42
  when BGRA
43
43
  width * height * 4
44
44
  when UYVY
45
- width * height * 2
45
+ widtha = ( width + 3 ) & ~0x3
46
+ widtha * height * 2
46
47
  when YUY2
47
48
  widtha = ( width + 3 ) & ~0x3
48
49
  widtha * height * 2
49
50
  when YV12
50
- width * height * 3 / 2
51
+ width2 = ( width + 1 ) / 2
52
+ height2 = ( height + 1 ) / 2
53
+ widtha = ( width + 7 ) & ~0x7
54
+ width2a = ( width2 + 7 ) & ~0x7
55
+ widtha * height + 2 * width2a * height2
51
56
  when I420
52
57
  width * height * 3 / 2
53
58
  when MJPG
data/test/tc_frame.rb CHANGED
@@ -69,6 +69,13 @@ class TC_Frame < Test::Unit::TestCase
69
69
  assert_equal [ 320, 240 ], F( YV12, 320, 240 ).shape
70
70
  end
71
71
 
72
+ def test_frame_equal
73
+ assert_equal F( YV12, 320, 240 ), F( YV12, 320, 240 )
74
+ assert_not_equal F( YV12, 320, 240 ), F( YV12, 320, 200 )
75
+ assert_not_equal F( YV12, 320, 240 ), F( YV12, 240, 240 )
76
+ assert_not_equal F( YV12, 320, 240 ), F( I420, 320, 240 )
77
+ end
78
+
72
79
  def test_typecode
73
80
  assert_equal YV12, F.new( YV12, 320, 240 ).typecode
74
81
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 0
9
- version: 0.8.0
8
+ - 1
9
+ version: 0.8.1
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-10-25 00:00:00 +01:00
17
+ date: 2010-11-13 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency