View Single Post
Old 14th August 2014, 20:19   #1  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
plugin development: HistByLine

Hi,
Getting back into writing plugins again - and I've lost all the files I've ever had so, starting over.

I modified and compiled DemosaicCPP. My test plugin simply copies a source to a destination clip, but the colour channels aren't being copied.

Code:
vi.pixel_type = VideoInfo::CS_YV12; // RGB would be CS_BGR32

--------

	dest_frame	=	env->NewVideoFrame(vi);
	dest_data	=	dest_frame->GetWritePtr();
	dest_pitch	=	dest_frame->GetPitch();
	dest_height	=	dest_frame->GetHeight();

--------

	if(src_vi.IsYV12()) {
		src_data	=	src_frame->GetReadPtr(PLANAR_Y);
		src_pitch	=	src_frame->GetPitch(PLANAR_Y);
		src_row_size=	src_frame->GetRowSize(PLANAR_Y);		// in bytes!
		src_height	=	src_frame->GetHeight(PLANAR_Y);
		src_inc		=	1;

-------

	unsigned int x, y;
	for (y = 0; y < src_height; ++y) {
		for (x = 0; x < src_row_size; ++x) {
			dest_data[x] = src_data[x] + 1;
		}
		src_data += src_pitch;
		// dest_data -= dest_pitch; // decrement in the case of RGB
		dest_data += dest_pitch;
	}
	return dest_frame;

--------
colorbars(pixel_type="YV12")
Myplugin(mode=0)
The luma values are correct, but u/v/ values are all 0 (giving a greenish look). I thought it was because YV12 was planar so I just extended the loop to double (y<src_height*2), but that crashed. What is the proper way to iterate this?

Thanks

p.s. using avisynth+, if that makes any difference.

Last edited by jmac698; 18th August 2014 at 15:09.
jmac698 is offline   Reply With Quote