
Recherche avancée
Autres articles (43)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (5345)
-
C++ Realtime OpenGL videogame streaming library
23 août 2013, par MufasaI need to select a video encoder and library to take raw RGB frames in realtime from a videogame and send them to a remote client. The remote client is sending back mouse events. Right now I have a setup where the server is using
glReadPixels
to read frame data, then sending information in the form of 16x16 tiles with runlength encoding that have changed since the last read. (The videogame has a lot of solid color areas). My client works to control the game. But the transmission of frames to the client, and mouse events from the client, is too slow. Both use a TCP socket to communicate.I'm looking into using ffmpeg or x264 to encode into H.264 video ; do you think this could reduce latency ? I'm on windows and I can't figure out how to set up x264 libraries in Visual Studio, but I have got ffmpeg libraries installed.
Another name I have heard is live555 but I don't know much about that.
Do you have any recommendations ?
-
Playing With Emscripten and ASM.js
1er mars 2014, par Multimedia Mike — GeneralThe last 5 years or so have provided a tremendous amount of hype about the capabilities of JavaScript. I think it really kicked off when Google announced their Chrome web browser in September, 2008 along with its V8 JS engine. This seemed to spark an arms race in JS engine performance along with much hyperbole that eventually all software could, would, and/or should be written in straight JavaScript for maximum portability and future-proofing, perhaps aided by Emscripten, a tool which magically transforms C and C++ code into JS. The latest round of rhetoric comes courtesy of something called asm.js which purports to narrow the gap between JS and native code performance.
I haven’t been a believer, to express it charitably. But I wanted to be certain, so I set out to devise my own experiment to test modern JS performance.
Up Front Summary
I was extremely surprised that my experiment demonstrated JS performance FAR beyond my expectations. There might be something to these claims of magnficent JS speed in numerical applications. Basically, here were my thoughts during the process :- There’s no way that JavaScript can come anywhere close to C performance for a numerically intensive operation ; a simple experiment should demonstrate this.
- Here’s a straightforward C program to perform a simple yet numerically intensive operation.
- Let’s compile the C program on gcc and get some baseline performance numbers.
- Let’s use Emscripten to convert the C program to JavaScript and run it under Chrome.
- Ha ! Pitiful JS performance, just as I expected !
- Try the same program under Firefox, since Firefox is supposed to have some crazy optimization for asm.js code, allegedly emitted by Emscripten.
- LOL ! Firefox performs even worse than Chrome !
- Wait a minute… the Emscripten documentation mentioned using optimization levels for generating higher performance JS, so try ‘-O1′.
- Umm… wow : Chrome’s performance increased dramatically ! What about Firefox ? Not only is Firefox faster than Chrome, it’s faster than the gcc-generated code !
- As my faith in C is suddenly shaken to its core, I remembered to compile the gcc version with an explicit optimization level. The native C version pulled ahead of Firefox again, but the Firefox code is still close.
- Aha ! This is just desktop– but what about mobile ? One of the leading arguments for converting everything to pure JavaScript is that such programs will magically run perfectly in mobile browsers. So I wager that this is where the experiment will fall over.
- I proceed to try the same converted program on a variety of mobile platforms.
- The mobile platforms perform rather admirably as well.
- I am surprised.
The Experiment
I wanted to run a simple yet numerically-intensive and relevant benchmark, and something I am familiar with. I settled on JPEG image decoding. Again, I wanted to keep this simple, ideally in a single file because I didn’t know how hard it might be to deal with Emscripten. I found NanoJPEG, which is a straightforward JPEG decoder contained in a single C file.
I altered nanojpeg.c (to a new file called nanojpeg-static.c) such that the main() program would always load a 1920×1080 (a.k.a. 1080p) JPEG file (“bbb-1080p-title.jpg”, the Big Buck Bunny title), rather than requiring a command line argument. Then I used gettimeofday() to profile the core decoding function (njDecode()).
Compiling with gcc and profiling execution :
gcc -Wall nanojpeg-static.c -o nanojpeg-static ./nanojpeg-static
Optimization levels such as -O0, -O3, or -Os can be applied to the compilation command.
For JavaScript conversion, I installed Emscripten and converted using :
/path/to/emscripten/emcc nanojpeg-static.c -o nanojpeg.html \ —preload-file bbb-1080p-title.jpg -s TOTAL_MEMORY=32000000
The ‘–preload-file’ option makes the file available to the program via standard C-style file I/O functions. The ‘-s TOTAL_MEMORY’ was necessary because the default of 16 MB wasn’t enough. Again, the -O optimization levels can be sent in.
For running, the .html file is loaded (via webserver) in a web browser.
Want To Try It Yourself ?
I put the files here : http://multimedia.cx/emscripten/. The .c file, the JPEG file, and the Emscripten-converted files using -O0, -O1, -O2, -O3, -Os, and no optimization switch.Results and Charts
Here is the spreadsheet with the raw results.I ran this experiment using Ubuntu Linux 12.04 on an Intel Atom N450-based netbook. For this part, I was able to compare the Chrome and Firefox browser results against the C results :
These are the results for a 2nd generation Android Nexus 7 using both Chrome and Firefox :
Here is the result for an iPad 2 running iOS 7 and Safari– there is no Firefox for iOS and while there is a version of Chrome for iOS, it apparently isn’t able to leverage an optimized JS engine. Chrome takes so long to complete this experiment that there’s no reason to muddy the graph with the results :
Interesting that -O1 tends to provide better optimization than levels 2 or 3, and that -Os (optimize for size) seems to be a good all-around choice.
Don’t Get Too Smug
JavaScript can indeed get amazing performance in this day and age. Please be advised, however, that this isn’t the best that a C decoder implementation can possibly do. This version doesn’t leverage any SIMD extensions. According to profiling (using gprof against the C code), sample saturation in color conversion dominates followed by inverse DCT functions, common cases for SIMD ASM or intrinsics. Allegedly, there will be some support for JS SIMD optimizations some day. We’ll see.Implications For Development
I’m still not especially motivated to try porting the entire Native Client game music player codebase to JavaScript. I’m still wondering about the recommended development flow. How are you supposed to develop for Emscripten and asm.js ? From what I can tell, Emscripten is not designed as a simple aide for porting C/C++ code to JS. No, it reduces the code into JS code you can’t possibly maintain. This seems to imply that the C/C++ code needs to be developed and debugged in its entirety and then converted to JS, which seems arduous. -
OpenCV and GoPro - empty frames in VideoCapture stream
19 mai 2014, par NovatarI have a GoPro Hero 3+ (Black) which is connected to a video capture card (AverMedia Game Broadcaster HD). I simply want to get the video stream in OpenCV. With a Logitech Webcam there are no problems. The used code is below.
VideoCapture cap;
cap.open(0);
waitKey(300);
//cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
//cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720);
if (cap.isOpened()){
cout << "Cam identified" << endl;
}
namedWindow("dst", 1);
while (1){
Mat frame;
if (!cap.read(frame)) {
std::cout << "Unable to read frame from video stream" << std::endl;
continue;
}
imshow("dst", frame);
[...]
}With the GoPro the following happens : OpenCV is able to open the VideoCapture ("Cam identified") but can’t read any frames (just a gray screen and the output : "Unable to read frame from video stream"). I also checked this with frame.empty() ;.
I know that the video capture card works correct because Unity opens a WebCamTexture with the GoPro stream without any issues. I read about codec problems in OpenCv and so I already tried to compile OpenCV with FFMPEG support. Now the recorded MP4-Videos of the GoPro can be displayed but the stream still doesn’t work.
I use OpenCV 2.48, Windows 7 and Visual Studio 2013.
EDIT : Here is the code of libVLC solution :
struct ctx
{
uint8_t* pixeldata;
std::mutex imagemutex;
};
static void display(void *data, void *id);
static void unlock(void *data, void *id, void *const *p_pixels);
static void *lock(void *data, void **p_pixels);
struct ctx ctx;
libvlc_instance_t *inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
int main(int argc, char* argv[])
{
ctx.pixeldata = new uint8_t[1280 * 720 * 3];
char const *vlc_argv[] =
{
"-vvv",
"--no-audio", /* skip any audio track */
"--no-xlib", /* tell VLC to not use Xlib */
};
int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);
inst = libvlc_new(vlc_argc, vlc_argv);
const char *options[] =
{
":dshow-vdev=AVerMedia HD Capture",
":dshow-adev=none",
//":dshow-size=1280x720",
":dshow-fps=24",
":dshow-chroma=YUY2",
":dshow-video-input=1",
":dshow-video-output=1",
":dshow-aspect-ratio=16\:9",
":live-caching=80",
NULL
};
m = libvlc_media_new_location(inst, "dshow://");
for (const char **opt = options; *opt; opt++)
libvlc_media_add_option(m, *opt);
mp = libvlc_media_player_new_from_media(m);
libvlc_media_release(m);
libvlc_video_set_callbacks(mp, lock, unlock, display, &ctx);
libvlc_video_set_format(mp, "RV24", 1280, 720, 1280 * 3);
libvlc_media_player_play(mp);
namedWindow("all", 1);
Mat frame(720, 1280, CV_8UC3);
while (1){
ctx.imagemutex.lock();
memcpy(gesamt.data, ctx.pixeldata, 1280 * 720 * sizeof(uint8_t) * 3);
ctx.imagemutex.unlock();
imshow("all", gesamt);
if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
libvlc_media_player_stop(mp);
libvlc_media_player_release(mp);
libvlc_release(inst);
delete[] ctx.pixeldata;
return 0;
}
void display(void *data, void *id){
(void)data;
assert(id == NULL);
}
void unlock(void *data, void *id, void *const *p_pixels){
struct ctx *ctx = (struct ctx*)data;
ctx->imagemutex.unlock();
assert(id == NULL);
}
void *lock(void *data, void **p_pixels){
struct ctx *ctx = (struct ctx*)data;
ctx->imagemutex.lock();
*p_pixels = ctx->pixeldata;
return NULL;
}