summarylogtreecommitdiffstats
path: root/rgb_demo.patch
blob: f2d5447e403509e792ffa538ce8b10d80602acaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/core/include/opencv2/core/core.hpp RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/core/include/opencv2/core/core.hpp
--- RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/core/include/opencv2/core/core.hpp	2011-02-05 01:48:42.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/core/include/opencv2/core/core.hpp	2011-12-27 02:34:39.000000000 +0100
@@ -56,6 +56,7 @@
 #include <algorithm>
 #include <cmath>
 #include <complex>
+#include <cstddef>
 #include <map>
 #include <new>
 #include <string>
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/features2d/src/matchers.cpp RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/features2d/src/matchers.cpp
--- RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/features2d/src/matchers.cpp	2011-02-05 01:48:41.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/features2d/src/matchers.cpp	2011-12-27 02:54:45.000000000 +0100
@@ -42,7 +42,7 @@
 #include "precomp.hpp"
 
 #ifdef HAVE_EIGEN2
-#include <Eigen/Array>
+#include <Eigen/Core>
 #endif
 
 using namespace std;
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap.cpp RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap.cpp
--- RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap.cpp	2011-02-05 01:48:42.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap.cpp	2011-12-27 03:00:54.000000000 +0100
@@ -171,7 +171,7 @@
             if (capture)
                 return capture;
         #endif
-        #if defined (HAVE_CAMV4L) || defined (HAVE_CAMV4L2)
+        #if defined (HAVE_CAMV4L)
             capture = cvCreateCameraCapture_V4L (index);
             if (capture)
                 return capture;
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap_ffmpeg.cpp RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap_ffmpeg.cpp
--- RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap_ffmpeg.cpp	2011-02-05 01:48:42.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap_ffmpeg.cpp	2011-12-27 02:52:46.000000000 +0100
@@ -466,7 +466,7 @@
         AVCodecContext *enc = &ic->streams[i]->codec;
 #endif
 
-        if( CODEC_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
+        if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
             AVCodec *codec = avcodec_find_decoder(enc->codec_id);
             if (!codec ||
             avcodec_open(enc, codec) < 0)
@@ -550,15 +550,27 @@
 		        continue;
     		}
 
-#if LIBAVFORMAT_BUILD > 4628
-        avcodec_decode_video(video_st->codec,
-                             picture, &got_picture,
-                             packet.data, packet.size);
-#else
-        avcodec_decode_video(&video_st->codec,
-                             picture, &got_picture,
-                             packet.data, packet.size);
-#endif
+
+		AVPacket avpkt;
+		av_init_packet(&avpkt);
+		avpkt.data = packet.data;
+		avpkt.size = packet.size;
+		//
+		// HACK for CorePNG to decode as normal PNG by default
+		// same method used by ffmpeg
+		avpkt.flags = AV_PKT_FLAG_KEY;
+		avcodec_decode_video2(video_st->codec,
+                              picture, &got_picture, &avpkt);
+//Functions Removed from ffmpeg on 4/19/11
+//#if LIBAVFORMAT_BUILD > 4628
+//        avcodec_decode_video(video_st->codec,
+//                             picture, &got_picture,
+//                             packet.data, packet.size);
+//#else
+//        avcodec_decode_video(&video_st->codec,
+//                             picture, &got_picture,
+//                             packet.data, packet.size);
+//#endif
 
         if (got_picture) {
             // we have a new picture, so memorize it
@@ -803,24 +815,25 @@
 #endif
 };
 
-static const char * icvFFMPEGErrStr(int err)
-{
-    switch(err) {
-    case AVERROR_NUMEXPECTED:
-		return "Incorrect filename syntax";
-    case AVERROR_INVALIDDATA:
-		return "Invalid data in header";
-    case AVERROR_NOFMT:
-		return "Unknown format";
-    case AVERROR_IO:
-		return "I/O error occurred";
-    case AVERROR_NOMEM:
-		return "Memory allocation error";
-    default:
-		break;
-    }
-  	return "Unspecified error";
-}
+//Deprecated Errors, should be using AVERROR(EINVAL) to return error strings
+//static const char * icvFFMPEGErrStr(int err)
+//{
+//    switch(err) {
+//    case AVERROR_NUMEXPECTED:
+//		return "Incorrect filename syntax";
+//    case AVERROR_INVALIDDATA:
+//		return "Invalid data in header";
+//    case AVERROR_NOFMT:
+//		return "Unknown format";
+//    case AVERROR_IO:
+//		return "I/O error occurred";
+//    case AVERROR_NOMEM:
+//		return "Memory allocation error";
+//    default:
+//		break;
+//    }
+//  	return "Unspecified error";
+//}
 
 /* function internal to FFMPEG (libavformat/riff.c) to lookup codec id by fourcc tag*/
 extern "C" {
@@ -899,7 +912,7 @@
 #endif
 
 #if LIBAVFORMAT_BUILD > 4621
-	c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
+	c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
 #else
 	c->codec_id = oc->oformat->video_codec;
 #endif
@@ -911,7 +924,7 @@
     //if(codec_tag) c->codec_tag=codec_tag;
 	codec = avcodec_find_encoder(c->codec_id);
 
-	c->codec_type = CODEC_TYPE_VIDEO;
+	c->codec_type = AVMEDIA_TYPE_VIDEO;
 
 	/* put sample parameters */
 	c->bit_rate = bitrate;
@@ -998,7 +1011,7 @@
         AVPacket pkt;
         av_init_packet(&pkt);
 
-        pkt.flags |= PKT_FLAG_KEY;
+        pkt.flags |= AV_PKT_FLAG_KEY;
         pkt.stream_index= video_st->index;
         pkt.data= (uint8_t *)picture;
         pkt.size= sizeof(AVPicture);
@@ -1018,7 +1031,7 @@
 			pkt.pts = c->coded_frame->pts;
 #endif
             if(c->coded_frame->key_frame)
-                pkt.flags |= PKT_FLAG_KEY;
+                pkt.flags |= AV_PKT_FLAG_KEY;
             pkt.stream_index= video_st->index;
             pkt.data= outbuf;
             pkt.size= out_size;
@@ -1215,7 +1228,7 @@
 	av_register_all ();
 
 	/* auto detect the output format from the name and fourcc code. */
-	fmt = guess_format(NULL, filename, NULL);
+	fmt = av_guess_format(NULL, filename, NULL);
 	if (!fmt)
         return false;
 
@@ -1238,7 +1251,7 @@
 #endif
 
     // alloc memory for context
-	oc = av_alloc_format_context();
+	oc = avformat_alloc_context();
 	assert (oc);
 
 	/* set file name */
@@ -1310,7 +1323,7 @@
     /* open the codec */
     if ( (err=avcodec_open(c, codec)) < 0) {
 		char errtext[256];
-		sprintf(errtext, "Could not open codec '%s': %s", codec->name, icvFFMPEGErrStr(err));
+		sprintf(errtext, "Could not open codec '%s': %s", codec->name, AVERROR(EINVAL));
 		CV_Error(CV_StsBadArg, errtext);
     }
 
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap_libv4l.cpp RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap_libv4l.cpp
--- RGBDemo-0.4.0-Source.orig/nestk/deps/opencv/modules/highgui/src/cap_libv4l.cpp	2011-02-05 01:48:42.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/deps/opencv/modules/highgui/src/cap_libv4l.cpp	2011-12-27 03:00:29.000000000 +0100
@@ -241,8 +241,10 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 
+#ifdef HAVE_CAMV4L
 #include <linux/videodev.h>
 #include <linux/videodev2.h>
+#endif
 
 #include <libv4l1.h>
 #include <libv4l2.h>
diff -Nur RGBDemo-0.4.0-Source.orig/nestk/ntk/numeric/levenberg_marquart_minimizer.cpp RGBDemo-0.4.0-Source/nestk/ntk/numeric/levenberg_marquart_minimizer.cpp
--- RGBDemo-0.4.0-Source.orig/nestk/ntk/numeric/levenberg_marquart_minimizer.cpp	2011-02-05 01:49:08.000000000 +0100
+++ RGBDemo-0.4.0-Source/nestk/ntk/numeric/levenberg_marquart_minimizer.cpp	2011-12-27 03:03:37.000000000 +0100
@@ -63,7 +63,7 @@
   }
 
 private:
-  mutable CostFunction& m_cost_function;
+  CostFunction& m_cost_function;
   mutable std::vector<double> m_current_input;
   mutable std::vector<double> m_current_output;
   int m_input_dimension;