Fast way of copying byte array in C/C++ (With measurements)

UPD 2017: these are early experimnts on c++ compiler optimizations. I don’t think it is useful any more. I have the following code for copying several buffers from one object to another: 1 2 3 4 5 6 7 8 9 // Copy several buffers (images) for( int i = 0; i < MIN( conf_.size(), src.conf_.size() ); ++ i ) { // Copy pixels for( int j = 0; j < MIN( sizeOfBuffer_, src....

October 15, 2013 · SergeM

How to cheat on video encoder comparisons

Source:[Diary Of An x264 Developer](http://x264dev.multimedia.cx/archives/472" target="_blank)Filed under: [benchmark](http://x264dev.multimedia.cx/archives/category/benchmark" rel="category tag" style="letter-spacing: 0px;" title="View all posts in benchmark),[H.264](http://x264dev.multimedia.cx/archives/category/h264" rel="category tag" style="letter-spacing: 0px;" title="View all posts in H.264),[stupidity](http://x264dev.multimedia.cx/archives/category/stupidity" rel="category tag" style="letter-spacing: 0px;" title="View all posts in stupidity),[test sequences](http://x264dev.multimedia.cx/archives/category/test-sequences" rel="category tag" style="letter-spacing: 0px;" title="View all posts in test sequences) ::Over the past few years, practically everyone and their dog has published some sort of encoder comparison.  Sometimes they’re actually intended to be something for the world to rely on, like the old Doom9 comparisons and the MSU comparisons....

October 11, 2013 · SergeM

Using h264/multiview codec from Intel Media SDK

I needed to launch multiview compression using codec from Intel MVC. Approximately a half a year ago I launched it normally. Yesterday it tried and I got such an error: $ ./sample_encode.exe h264 -i input.yuv -o output.h264 -w 1920 -h 1080 Return on error: error code -3, .\src\pipeline_encode.cpp 865 Return on error: error code 1, .\src\sample_encode.cpp 343 Frame number: 0 I started debug and found out the error appears in...

October 11, 2013 · SergeM

Using ls command

ls -w1 */ - show only subdirectories in current directory (*/) and display in 1 column (-w1) ls -c - sort by date

October 8, 2013 · SergeM

Некоторые заметки о приведении типов в СиПлюсПлюс

АлёнаC++: http://alenacpp.blogspot.ru/2005/08/c.html static_cast между указателями корректно, только если один из указателей - это указатель на void или если это приведение между объектами классов, где один класс является наследником другого. То есть для приведения к какому-либо типу от void*, который возвращает malloc, следует использовать static_cast. int * p = static_cast<int*>(malloc(100)); Если приведение не удалось, возникнет ошибка на этапе компиляции. Однако, если это приведение между указателями на объекты классов вниз по иерархии и оно не удалось, результат операции undefined....

October 4, 2013 · SergeM

Math morphology in Adobe After Effects

Errosion and dilation in AE is implemented in Minimax filter. See settings bellow:

September 18, 2013 · SergeM

Opencv and "OpenCV Error: Bad flag"

I had pretty simple code with opencv: cv::Mat t; t = cv::imread( “qq.bmp” ) ; cv::imwrite( “q.bmp”, t ); cv::namedWindow( “asdads”, CV_WINDOW_AUTOSIZE ); cv::imshow( “asdads”, t ); cv::waitKey( -1 ); return 0; It caused crash in debug configuration: OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport ed array type) in unknown function, file ......\src\opencv\modules\core\src\ar ray.cpp, line 2482 In release configuration it was ok. Finally i found the solution....

August 5, 2013 · SergeM

OpenCV. Copy image from unsigned char buffer, resize and save to file

How to copy image from unsigned char buffer, resize and save to file. If you use single-channel image. #include <opencv/cv.h> #include <opencv/highgui.h> int coeff = 4; cv::Mat src( height, width, CV_8UC1, (void *) source_byte_beffer ) ); cv::Mat small(height/ coeff, width/ coeff, CV_8UC1 ); cv::Size s_half(width/ coeff, height/ coeff); cv::resize( src, small, s_half, 1, 1, cv::INTER_LINEAR ); // resize from src to small IplImage* writeImage; writeImage=cvCloneImage(&(IplImage)src); cvSaveImage("src1.bmp", writeImage); cvReleaseImage( &writeImage ); writeImage=cvCloneImage(&(IplImage)small); cvSaveImage("little....

July 9, 2013 · SergeM

SVN copy certain subdirectories to a branch

There was always a problem for me to copy only certain directories from one branch to another. For example we have following directory structure: trunk - project1 - project2 -subdir1 -subdir2 -subdir3 We want to copy only subdir2 to a branch /branches/branch1 with saving all the structure of projects.branches/branch1 - project1 - project2 -subdir2</span><span style="font-family: Times, Times New Roman, serif; font-size: 14px;"> We want to copy only subdir2 to a branch /branches/branch1 with saving all the structure of projects....

July 3, 2013 · SergeM

Trim frames from raw YUV video using FFMPEG

Trim 5 frames starting from 160-th frame and write to png sequence ffmpeg -pix_fmt yuv420p -s 1920x1088 -r 1 -i input_video.yuv -r 1 -ss 160 -frames 5 output_sequence_%d.png size of input video is 1920x1088, format YUV420 progressive. UPD: ffmpeg is renamed to avconv. Using it for trimming AVI video: avconv -ss 00:58:00 -t 00:59:30 -i ./video.avi frame_%05d.png UPD2: it seems ffmpeg is back.

July 2, 2013 · SergeM