• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VFrame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VFrame的典型用法代码示例。如果您正苦于以下问题:C++ VFrame类的具体用法?C++ VFrame怎么用?C++ VFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VFrame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: process_package

void PhotoScaleUnit::process_package(LoadPackage *package)
{
	PhotoScalePackage *pkg = (PhotoScalePackage*)package;
	VFrame *input = server->plugin->get_input();
	int w = input->get_w();
	int h = input->get_h();

	
	switch(input->get_color_model())
	{
		case BC_RGB_FLOAT:
			SCAN_BORDER(float, 3, 0);
			break;
		case BC_RGBA_FLOAT:
			SCAN_BORDER(float, 4, 0);
			break;
		case BC_RGB888:
			SCAN_BORDER(unsigned char, 3, 0);
			break;
		case BC_YUV888:
			SCAN_BORDER(unsigned char, 3, 1);
			break;
		case BC_RGBA8888:
		case BC_YUVA8888:
			SCAN_BORDER(unsigned char, 4, 0);
			break;
	}
}
开发者ID:knutj,项目名称:cinelerra,代码行数:28,代码来源:photoscale.C


示例2: read_function

static void read_function(png_structp png_ptr, 
	png_bytep data, 
	png_uint_32 length)
{
	VFrame *input = (VFrame*)png_get_io_ptr(png_ptr);

	memcpy(data, input->get_data() + input->get_compressed_size(), length);
	input->set_compressed_size(input->get_compressed_size() + length);
}
开发者ID:rasilon,项目名称:cinelerra-cv,代码行数:9,代码来源:filepng.C


示例3: while

void DeviceV4L2Base::run()
{
	Thread::disable_cancel();
	int min_buffers = total_buffers / 2;
	if( min_buffers > 3 ) min_buffers = 3;

// Read buffers continuously
	while( !done )
	{
		int retry = 0;
		int qbfrs = q_bfrs;
		while( !done && (!qbfrs || (!retry && qbfrs < min_buffers)) )
		{
			Thread::enable_cancel();
			Timer::delay(10);
			Thread::disable_cancel();
			++retry;  qbfrs = q_bfrs;
		}
		if( done ) break;
		struct v4l2_buffer buffer;
		memset(&buffer, 0, sizeof(buffer));
		buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		buffer.memory = V4L2_MEMORY_MMAP;

// The driver returns the first buffer not queued, so only one buffer
// can be unqueued at a time.
		Thread::enable_cancel();
		qbfrs_lock->lock("DeviceV4L2Base::run");
		int result = vioctl(VIDIOC_DQBUF, &buffer);
		if( !result ) --q_bfrs;
		qbfrs_lock->unlock();
		Thread::disable_cancel();
		if(result < 0)
		{
			perror("DeviceV4L2Base::run VIDIOC_DQBUF");
			Thread::enable_cancel();
			Timer::delay(10);
			Thread::disable_cancel();
			continue;
		}

// Get output frame
		int bfr = buffer.index;
// Set output frame data size/time, queue video
		VFrame *frame = device_buffers[bfr];
		if(color_model == BC_COMPRESSED)
			frame->set_compressed_size(buffer.bytesused);
		struct timeval *tv = &buffer.timestamp;
		double bfr_time = tv->tv_sec + tv->tv_usec / 1000000.;
		frame->set_timestamp(bfr_time);
		if( !getq->q(bfr) ) video_lock->unlock();
	}
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:53,代码来源:devicev4l2base.C


示例4: write_function

static void write_function(png_structp png_ptr, png_bytep data, png_uint_32 length)
{
	VFrame *output = (VFrame*)png_get_io_ptr(png_ptr);

	if(output->get_compressed_allocated() < output->get_compressed_size() + length)
		output->allocate_compressed_data((output->get_compressed_allocated() + length) * 2);
	memcpy(output->get_data() + output->get_compressed_size(), data, length);
	output->set_compressed_size(output->get_compressed_size() + length);
}
开发者ID:rasilon,项目名称:cinelerra-cv,代码行数:9,代码来源:filepng.C


示例5: initialize

BC_Bitmap::BC_Bitmap(BC_WindowBase *parent_window, unsigned char *png_data)
{
// Decompress data into a temporary vframe
    VFrame frame;

    frame.read_png(png_data);

// Initialize the bitmap
    initialize(parent_window,
               frame.get_w(),
               frame.get_h(),
               parent_window->get_color_model(),
               0);

// Copy the vframe to the bitmap
    read_frame(&frame, 0, 0, w, h);
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-cv,代码行数:17,代码来源:bcbitmap.C


示例6: overlay

int RecVideoOverlay::
overlay(VFrame *out)
{
	VFrame *in = vframe;
	int xx = x * scale, yy = y * scale;
	int w = in->get_w(), h = in->get_h();
	int ww = w * scale, hh = h * scale;
	BC_WindowBase::get_cmodels()->transfer(out->get_rows(), in->get_rows(),
		out->get_y(), out->get_u(), out->get_v(),
		in->get_y(), in->get_u(), in->get_v(),
		0, 0, w, h, xx, yy, ww, hh,
		in->get_color_model(), out->get_color_model(), 0,
		in->get_bytes_per_line(), out->get_bytes_per_line());
	return ticks > 0 && --ticks == 0 ? 1 : 0;
}
开发者ID:TravisKraatz,项目名称:cinelerra,代码行数:15,代码来源:recordmonitor.C


示例7: get_resources

void BC_Toggle::calculate_extents(BC_WindowBase *gui, 
	VFrame **images,
	int bottom_justify,
	int *text_line,
	int *w,
	int *h,
	int *toggle_x,
	int *toggle_y,
	int *text_x,
	int *text_y, 
	int *text_w,
	int *text_h, 
	const char *caption)
{
	BC_Resources *resources = get_resources();
	VFrame *frame = images[0];
	*w = frame->get_w();
	*h = frame->get_h();
	*toggle_x = 0;
	*toggle_y = 0;
	*text_x = *w + 5;
	*text_y = 0;
	*text_w = 0;
	*text_h = 0;

	if(caption)
	{
		*text_w = gui->get_text_width(MEDIUMFONT, caption);
		*text_h = gui->get_text_height(MEDIUMFONT);

		if(resources->toggle_highlight_bg)
		{
			*text_w += resources->toggle_text_margin * 2;
			*text_h = MAX(*text_h, resources->toggle_highlight_bg->get_h());
		}

		if(*text_h > *h)
		{
			*toggle_y = (*text_h - *h) >> 1;
			*h = *text_h;
		}
		else
开发者ID:beequ7et,项目名称:cinelerra-cv,代码行数:42,代码来源:bctoggle.C


示例8: write_frames

int FileList::write_frames(VFrame ***frames, int len)
{
	return_value = 0;

//printf("FileList::write_frames 1\n");
	if(frames[0][0]->get_color_model() == BC_COMPRESSED)
	{
		for(int i = 0; i < asset->layers && !return_value; i++)
		{
			for(int j = 0; j < len && !return_value; j++)
			{
				VFrame *frame = frames[i][j];
				char *path = create_path(frame->get_number());
//printf("FileList::write_frames %d " _LD "\n", __LINE__, frame->get_number());


				FILE *fd = fopen(path, "wb");
				if(fd)
				{
					return_value = !fwrite(frames[i][j]->get_data(),
						frames[i][j]->get_compressed_size(),
						1,
						fd);

					fclose(fd);
				}
				else
				{
					eprintf("Error while opening \"%s\" for writing. \n%m\n", asset->path);
					return_value++;
				}
			}
		}
	}
	else
	{
//printf("FileList::write_frames 2\n");
		writer->write_frames(frames, len);
//printf("FileList::write_frames 100\n");
	}
	return return_value;
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:42,代码来源:filelist.C


示例9: read_frame

int FileYUV::read_frame(VFrame *frame)
{
	int result;
	VFrame *input = frame;

	// short cut for direct copy routines
	if (frame->get_color_model() == BC_COMPRESSED) {
		long frame_size = (long) // w*h + w*h/4 + w*h/4
			(stream->get_height() *	stream->get_width() * 1.5); 
		frame->allocate_compressed_data(frame_size);
		frame->set_compressed_size(frame_size);
		return stream->read_frame_raw(frame->get_data(), frame_size);
	}
	

	// process through a temp frame if necessary
	if (! cmodel_is_planar(frame->get_color_model()) ||
	    (frame->get_w() != stream->get_width()) ||
	    (frame->get_h() != stream->get_height())) 
	{
		ensure_temp(stream->get_width(), stream->get_height());
		input = temp;
	}

	uint8_t *yuv[3];
	yuv[0] = input->get_y();
	yuv[1] = input->get_u();
	yuv[2] = input->get_v();
	result = stream->read_frame(yuv);
	if (result) return result;

	// transfer from the temp frame to the real one
	if (input != frame) 
	{
		FFMPEG::convert_cmodel(input, frame);
	}
	
	return 0;
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:39,代码来源:fileyuv.C


示例10: load_configuration

int OilEffect::process_realtime(VFrame *input, VFrame *output)
{
    need_reconfigure |= load_configuration();



//printf("OilEffect::process_realtime %f %d\n", config.radius, config.use_intensity);
    this->input = input;
    this->output = output;

    if(EQUIV(config.radius, 0))
    {
        if(input->get_rows()[0] != output->get_rows()[0])
            output->copy_from(input);
    }
    else
    {
        if(input->get_rows()[0] == output->get_rows()[0])
        {
            if(!temp_frame) temp_frame = new VFrame(0,
                                                        -1,
                                                        input->get_w(),
                                                        input->get_h(),
                                                        input->get_color_model(),
                                                        -1);
            temp_frame->copy_from(input);
            this->input = temp_frame;
        }


        if(!engine)
        {
            engine = new OilServer(this, (PluginClient::smp + 1));
        }

        engine->process_packages();
    }



    return 0;
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:42,代码来源:oil.C


示例11: get_output

void InterpolateVideo::average()
{
	VFrame *frame = get_output();
	int w = frame->get_w();
	int h = frame->get_h();

	switch(frame->get_color_model())
	{
		case BC_RGB_FLOAT:
			AVERAGE(float, float, 3, 1);
			break;
		case BC_RGB888:
		case BC_YUV888:
			AVERAGE(unsigned char, int, 3, 0xff);
			break;
		case BC_RGBA_FLOAT:
			AVERAGE(float, float, 4, 1);
			break;
		case BC_RGBA8888:
		case BC_YUVA8888:
			AVERAGE(unsigned char, int, 4, 0xff);
			break;
	}
}
开发者ID:knutj,项目名称:cinelerra,代码行数:24,代码来源:interpolatevideo.C


示例12: write_frames

int FileYUV::write_frames(VFrame ***layers, int len)
{
	int result;

	// only one layer supported
	VFrame **frames = layers[0];
	VFrame *frame;

	for (int n = 0; n < len; n++) 
	{
		frame = frames[n];

		// short cut for direct copy routines
		if (frame->get_color_model() == BC_COMPRESSED) 
		{
			long frame_size = frame->get_compressed_size();
			if (incoming_asset->format == FILE_YUV) 
				return stream->write_frame_raw(frame->get_data(), frame_size);

			// decode and write an encoded frame
			if (FFMPEG::codec_id(incoming_asset->vcodec) != CODEC_ID_NONE) 
			{
				if (! ffmpeg) 
				{
					ffmpeg = new FFMPEG(incoming_asset);
					ffmpeg->init(incoming_asset->vcodec);
				}
				
				ensure_temp(incoming_asset->width, incoming_asset->height); 
				int result = ffmpeg->decode(frame->get_data(), frame_size, temp);

				// some formats are decoded one frame later
				if (result == FFMPEG_LATENCY) 
				{
					// remember to write the last frame
					pipe_latency++;
					return 0;
				}

				if (result) 
				{
					delete ffmpeg;
					ffmpeg = 0;
					return 1;
				}


				uint8_t *yuv[3];
				yuv[0] = temp->get_y();
				yuv[1] = temp->get_u();
				yuv[2] = temp->get_v();
				return stream->write_frame(yuv);
			}
		}

		// process through a temp frame only if necessary
		if (! cmodel_is_planar(frame->get_color_model()) ||
		    (frame->get_w() != stream->get_width()) ||
		    (frame->get_h() != stream->get_height())) 
		{
			ensure_temp(asset->width, asset->height);
			FFMPEG::convert_cmodel(frame, temp);
			frame = temp;
		}

		uint8_t *yuv[3];
		yuv[0] = frame->get_y();
		yuv[1] = frame->get_u();
		yuv[2] = frame->get_v();
		result = stream->write_frame(yuv);
		if (result) return result;
	}

	return 0;
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:75,代码来源:fileyuv.C


示例13: getpid


//.........这里部分代码省略.........
				file->asset->channels;
			unsigned char result_buffer[result_bytes];
			for(int i = 0; i < ring_buffers; i++)
			{
				Samples **samples = file->audio_thread->audio_buffer[i];
				for(int j = 0; j < file->asset->channels; j++)
				{
					samples[j]->to_filefork(result_buffer +
						i * Samples::filefork_size() * file->asset->channels +
						j * Samples::filefork_size());
				}
			}

			send_result(result, result_buffer, result_bytes);
			break;
		}

		case START_VIDEO_THREAD:
		{
			int buffer_size = *(int*)command_data;
			int color_model = *(int*)(command_data + sizeof(int));
			int ring_buffers = *(int*)(command_data + sizeof(int) * 2);
			int compressed = *(int*)(command_data + sizeof(int) * 3);
// allocate buffers here
			result = file->start_video_thread(buffer_size, 
				color_model,
				ring_buffers,
				compressed);

// Send buffer information back to server here
			int result_bytes = ring_buffers *
				file->asset->layers *
				buffer_size *
				VFrame::filefork_size();
			unsigned char result_buffer[result_bytes];

			for(int i = 0; i < ring_buffers; i++)
			{
				VFrame ***frames = file->video_thread->video_buffer[i];
				for(int j = 0; j < file->asset->layers; j++)
				{
					for(int k = 0; k < buffer_size; k++)
					{
//printf("FileFork::handle_command %d j=%d k=%d %p %p\n", __LINE__, j, k, frames[j][k], frames[j][k]->get_shmid()));
						frames[j][k]->to_filefork(result_buffer +
							i * file->asset->layers *
								buffer_size *
								VFrame::filefork_size() +
							j * buffer_size *
								VFrame::filefork_size() +
							k * VFrame::filefork_size());
					}
				}
			}

			send_result(result, result_buffer, result_bytes);
			break;
		}


		case START_VIDEO_DECODE_THREAD:
			result = file->start_video_decode_thread();
			send_result(result, 0, 0);
			break;

开发者ID:knutj,项目名称:cinelerra,代码行数:65,代码来源:filefork.C


示例14: if

int FileDB::read_frame(VFrame *frame)
{
	int sw, sh;
	mdb->attachDb();
	int result = seq_no < clip_size ? 0 : 1;
	if( !result ) {
		int n = seq_no++;
		if( !n ) { frame_id = -1; }
		else if( n >= prefix_size ) n += suffix_offset;
		result = mdb->get_sequences(clip_id, n);
		if( !result && mdb->timeline_sequence_no() == n )
			frame_id = mdb->timeline_frame_id();
	}
	VFrame *fp = frame->get_w() == swidth && frame->get_h() == sheight &&
			frame->get_color_model() == BC_YUV420P ? frame :
		!vframe ? (vframe = new VFrame(swidth,sheight,BC_YUV420P)) :
		vframe;
	if( !result ) {
		if( frame_id < 0 )
			memset(fp->get_y(), 0, swidth*sheight);
		else
			result = mdb->get_image(frame_id, fp->get_y(), sw,sh);
	}
//printf("seq_no=%d, result=%d\n",seq_no,result);
	mdb->detachDb();
	if( !result ) {
		memset(fp->get_u(),0x80,swidth/2 * sheight/2);
		memset(fp->get_v(),0x80,swidth/2 * sheight/2);
	}
	if( !result && fp == vframe ) {
		BC_CModels::transfer(frame->get_rows(), fp->get_rows(),
			frame->get_y(), frame->get_u(), frame->get_v(),
			fp->get_y(), fp->get_u(), fp->get_v(),
			0, 0, fp->get_w(), fp->get_h(),
			0, 0, frame->get_w(), frame->get_h(),
			fp->get_color_model(), frame->get_color_model(), 0,
			fp->get_bytes_per_line(), swidth);
	}
	return result;
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:40,代码来源:filedb.C


示例15: process_package

void MaskUnit::process_package(LoadPackage *package)
{
	MaskPackage *ptr = (MaskPackage*)package;

	int start_row = SHRT_MIN;         // part for which mask exists
	int end_row;
	if(engine->recalculate)
	{
		VFrame *mask;
		if(engine->feather > 0) 
			mask = engine->temp_mask;
		else
			mask = engine->mask;

SET_TRACE
// Generated oversampling frame
		int mask_w = mask->get_w();
		int mask_h = mask->get_h();
		int mask_color_model = mask->get_color_model();
		int oversampled_package_w = mask_w * OVERSAMPLE;
		int oversampled_package_h = (ptr->row2 - ptr->row1) * OVERSAMPLE;
//printf("MaskUnit::process_package 1\n");

SET_TRACE

		int local_first_nonempty_rowspan = SHRT_MIN;
		int local_last_nonempty_rowspan = SHRT_MIN;

		if (!row_spans || row_spans_h != mask_h * OVERSAMPLE) {
			int i;	
			if (row_spans) {   /* size change */
				for (i = 0; i < row_spans_h; i++) 
					free(row_spans[i]);
				delete [] row_spans;
			}
			row_spans_h = mask_h * OVERSAMPLE;
			row_spans = new short *[mask_h * OVERSAMPLE]; 
			for (i= 0; i<mask_h * OVERSAMPLE; i++) {
				/* we use malloc so we can use realloc */
				row_spans[i] = (short *)malloc(sizeof(short) * NUM_SPANS);
				/* [0] is initialized later */
				row_spans[i][1] = NUM_SPANS;
			}
		}

SET_TRACE
//printf("MaskUnit::process_package 1 %d\n", engine->point_sets.total);

SET_TRACE

// Draw bezier curves onto span buffer
//struct timeval start_time;
//gettimeofday(&start_time, 0);

		for(int k = 0; k < engine->point_sets.total; k++)
		{
			int old_x, old_y;
			old_x = SHRT_MIN; // sentinel
			ArrayList<MaskPoint*> *points = engine->point_sets.values[k];

			if(points->total < 2) continue;
//printf("MaskUnit::process_package 2 %d %d\n", k, points->total);
			for (int i = ptr->row1 * OVERSAMPLE; i < ptr->row2 * OVERSAMPLE; i++) 
				row_spans[i][0] = 2; /* initialize to zero */ 
			(ptr->row1*OVERSAMPLE, ptr->row2*OVERSAMPLE); // init just my rows
			for(int i = 0; i < points->total; i++)
			{
				MaskPoint *point1 = points->values[i];
				MaskPoint *point2 = (i >= points->total - 1) ? 
					points->values[0] : 
					points->values[i + 1];

				float x0 = point1->x;
				float y0 = point1->y;
				float x1 = point1->x + point1->control_x2;
				float y1 = point1->y + point1->control_y2;
				float x2 = point2->x + point2->control_x1;
				float y2 = point2->y + point2->control_y1;
				float x3 = point2->x;
				float y3 = point2->y;

				// possible optimization here... since these coordinates are bounding box for curve
				// we can continue with next curve if they are out of our range

				// forward differencing bezier curves implementation taken from GPL code at
				// http://cvs.sourceforge.net/viewcvs.py/guliverkli/guliverkli/src/subtitles/Rasterizer.cpp?rev=1.3

				float cx3, cx2, cx1, cx0, cy3, cy2, cy1, cy0;

				// [-1 +3 -3 +1]
				// [+3 -6 +3  0]
				// [-3 +3  0  0]
				// [+1  0  0  0]

		 		cx3 = (-  x0 + 3*x1 - 3*x2 + x3) * OVERSAMPLE;
				cx2 = ( 3*x0 - 6*x1 + 3*x2) * OVERSAMPLE;
				cx1 = (-3*x0 + 3*x1) * OVERSAMPLE;
				cx0 = (   x0) * OVERSAMPLE;

				cy3 = (-  y0 + 3*y1 - 3*y2 + y3) * OVERSAMPLE;
//.........这里部分代码省略.........
开发者ID:rasilon,项目名称:cinelerra-cv,代码行数:101,代码来源:maskengine.C


示例16: process_package

void BluebananaUnit::process_package(LoadPackage *package){
  BluebananaPackage *pkg = (BluebananaPackage*)package;
  BluebananaEngine *engine = (BluebananaEngine*)pkg->engine;

  VFrame *frame = engine->data;
  int w = frame->get_w();
  int h = frame->get_h();
  int ant = plugin->ants_counter;
  int gui_open = plugin->gui_open();
  int show_ants = plugin->config.mark && gui_open;
  int j;

  int active = plugin->config.active;
  int use_mask = plugin->config.use_mask;
  int capture_mask = plugin->config.capture_mask;
  int invert_selection = plugin->config.invert_selection;

  float *Hl = (plugin->config.Hsel_active &&
               (plugin->config.Hsel_lo!=0 ||
                plugin->config.Hsel_hi!=360)) ? plugin->hue_select_alpha_lookup : NULL;
  float *Sl = (plugin->config.Ssel_active &&
               (plugin->config.Ssel_lo!=0  ||
                plugin->config.Ssel_hi!=100)) ? plugin->sat_select_alpha_lookup : NULL;
  float *Vl = (plugin->config.Vsel_active &&
               (plugin->config.Vsel_lo!=0 ||
                plugin->config.Vsel_hi!=100)) ? plugin->val_select_alpha_lookup : NULL;

  float Hal = plugin->config.Hadj_active ? plugin->config.Hadj_val/60.f : 0.f;

  float *Sal = (plugin->config.Sadj_active &&
                (plugin->config.Sadj_lo!=0 ||
                 plugin->config.Sadj_hi!=100 ||
                 plugin->config.Sadj_gamma!=1)) ? plugin->sat_adj_lookup : NULL;
  float *Val = (plugin->config.Vadj_active &&
                (plugin->config.Vadj_lo!=0 ||
                 plugin->config.Vadj_hi!=100 ||
                 plugin->config.Vadj_gamma!=1)) ? plugin->val_adj_lookup : NULL;
  float *Ral = (plugin->config.Radj_active &&
                (plugin->config.Radj_lo!=0 ||
                 plugin->config.Radj_hi!=100 ||
                 plugin->config.Radj_gamma!=1)) ? plugin->red_adj_lookup : NULL;
  float *Gal = (plugin->config.Gadj_active &&
                (plugin->config.Gadj_lo!=0 ||
                 plugin->config.Gadj_hi!=100 ||
                 plugin->config.Gadj_gamma!=1)) ? plugin->green_adj_lookup : NULL;
  float *Bal = (plugin->config.Badj_active &&
                (plugin->config.Badj_lo!=0 ||
                 plugin->config.Badj_hi!=100 ||
                 plugin->config.Badj_gamma!=1)) ? plugin->blue_adj_lookup : NULL;

  float Sas = plugin->sat_adj_toe_slope;
  float Vas = plugin->val_adj_toe_slope;
  float Ras = plugin->red_adj_toe_slope;
  float Gas = plugin->green_adj_toe_slope;
  float Bas = plugin->blue_adj_toe_slope;

  float Aal = plugin->config.Oadj_active ? plugin->config.Oadj_val*.01 : 1.f;

  float Vscale = (plugin->config.Vadj_hi-plugin->config.Vadj_lo) / 100.f;
  float Vshift = plugin->config.Vadj_lo / 100.f;
  float Vgamma = plugin->config.Vadj_gamma;

  int doRGB = Ral || Gal || Bal;

  int doHSV = (Hal!=0) || Sal || Val;

  int doSEL = ( Hl || Sl || Vl ) && (active || show_ants);

  int shaping = plugin->config.Fsel_active && doSEL &&
    (plugin->config.Fsel_lo || plugin->config.Fsel_hi || plugin->config.Fsel_over);

  int byte_advance=0;
  int have_alpha=1;

#define SPLIT 128

  int tasks = engine->get_total_packages()*16;
  int taski,rowi,coli;

  /* do as much work entirely local to thread memory as possible */
  unsigned char row_fragment[SPLIT*16];
  float *selection_fullframe=NULL;
  float  selection[SPLIT];

  float Rvec[SPLIT];
  float Gvec[SPLIT];
  float Bvec[SPLIT];

  float Avec[SPLIT];
  float Hvec[SPLIT];
  float Svec[SPLIT];
  float Vvec[SPLIT];

  float *Rhist = pkg->Rhist;
  float *Ghist = pkg->Ghist;
  float *Bhist = pkg->Bhist;
  float *Hhist = pkg->Hhist;
  float *Shist = pkg->Shist;
  float *Vhist = pkg->Vhist;
  float Htotal=0.f;
//.........这里部分代码省略.........
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:101,代码来源:bluebananaengine.C


示例17: VFrame

int TimeFrontMain::process_buffer(VFrame **frame,
		int64_t start_position,
		double frame_rate)
//int TimeFrontMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
	VFrame **outframes = frame;
	VFrame *(framelist[1024]);
	framelist[0] = new VFrame (
		outframes[0]->get_w(),
		outframes[0]->get_h(),
		outframes[0]->get_color_model());
	read_frame(framelist[0],
		0,
		start_position,
		frame_rate);
	this->input = framelist[0];
	this->output = outframes[0];
	need_reconfigure |= load_configuration();
	if (config.shape == TimeFrontConfig::OTHERTRACK)
	{
//		this->output = frame[1];
		if (get_total_buffers() != 2) 
		{
			// FIXME, maybe this should go to some other notification area?
			printf("ERROR: TimeFront plugin - If you are using another track for timefront, you have to have it under shared effects\n");
			return 0;
		}
		if (outframes[0]->get_w() != outframes[1]->get_w() || outframes[0]->get_h() != outframes[1]->get_h())
		{
			printf("Sizes of master track and timefront track do not match\n");
			return 0;
		}
	}

// Generate new gradient
	if(need_reconfigure)
	{
		need_reconfigure = 0;

		if(!gradient) gradient = new VFrame(
			outframes[0]->get_w(),
			outframes[0]->get_h(),
			BC_A8);

			
		if (config.shape != TimeFrontConfig::OTHERTRACK &&
		    config.shape != TimeFrontConfig::ALPHA)
		{
			if(!engine) engine = new TimeFrontServer(this,
				get_project_smp() + 1,
				get_project_smp() + 1);
			engine->process_packages();
		}
		
	}
	if (config.shape == TimeFrontConfig::ALPHA)
	{
		if(!gradient) gradient = new VFrame(
			outframes[0]->get_w(),
			outframes[0]->get_h(),
			BC_A8);
		VFrame *tfframe = framelist[0];
		switch (tfframe->get_color_model())
		{
			case BC_YUVA8888:
			case BC_RGBA8888:
				GRADIENTFROMCHANNEL(unsigned char, 4, 255, 3);


				break;
			case BC_RGBA_FLOAT:
				GRADIENTFROMCHANNEL(float, 4, 1.0f, 3);
				break;
			
			default:
				{
					printf("TimeFront plugin error: ALPHA used, but project color model does not have alpha\n");
					return 1;
					break;
				}
		}

	} else
	if (config.shape == TimeFrontConfig::OTHERTRACK)
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:84,代码来源:timefront.C


示例18: get_flip

void SceneNode::render(VFrame *frame, int do_camera)
{
	const int debug = 0;
	if(debug) printf("SceneNode::render %d this=%p title=%s image=%p x=%f y=%f frame=%p do_camera=%d\n", 
		__LINE__, 
		this,
		title,
		image,
		this->x,
		this->y,
		frame,
		do_camera);

	VFrame *temp = 0;
	VFrame *temp2 = 0;
	if(image)
	{
		float x = this->x;
		float y = this->y;
		float sx = this->sx;
		float sy = this->sy;
		float ry = this->ry;
		if(parent) 
			parent->transform_coord(&x, &y, &sx, &sy, &ry);

		if(do_camera) scene->transform_camera(frame, 
			&x, 
			&y, 
			&sx, 
			&sy, 
			get_flip());

		if(debug) printf("SceneNode::render %d at_y=%f\n", 
			__LINE__, 
			((SceneCamera*)scene->cameras.get(0))->at_y);

// Render everything into a temporary, then overlay the temporary
// 		if(!EQUIV(ry, 0) || get_flip())
// 		{
		temp = new VFrame(image->get_w(), 
			image->get_h(), 
			image->get_color_model());
//		}
		if(debug) printf("SceneNode::render %d\n", __LINE__);


// 1st comes our image
		temp->copy_from(image);

// Then come the subnodes without camera transforms
		if(debug) printf("SceneNode::render %d this=%p nodes=%d\n", __LINE__, this, nodes.size());
		for(int i = 0; i < nodes.size(); i++)
			nodes.get(i)->render(temp, 0);



		if(debug) printf("SceneNode::render %d\n", __LINE__);

// Then comes rotation into temp2
		VFrame *src = temp;
		if(!EQUIV(ry, 0))
		{
			src = temp2 = new VFrame(image->get_w(), 
				image->get_h(), 
				image->get_color_model());
			if(!scene->affine) scene->affine = 
				new AffineEngine(scene->cpus, scene->cpus);
			scene->affine->rotate(temp2,
				temp,
				ry);
			if(debug) printf("SceneNode::render %d ry=%f\n", __LINE__, ry);
		}

// Then comes flipping
		if(get_flip())
			src->flip_horiz();

		if(debug) printf("SceneNode::render %d src=%p x=%f y=%f sx=%f sy=%f\n", 
			__LINE__, 
			src,
			x,
			y,
			sx,
			sy);

// Overlay on the output frame
		if(!scene->overlayer) scene->overlayer = new OverlayFrame(scene->cpus);

		if(get_flip())
		{
			scene->overlayer->overlay(frame, 
				src, 
				0, 
				0, 
				image->get_w(), 
				image->get_h(), 
				frame->get_w() - x - image->get_w() * sx, 
				y, 
				frame->get_w() - x, 
				y + image->get_h() * sy, 
//.........这里部分代码省略.........
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:101,代码来源:scenegraph.C


示例19: main

int Overlay::handle_opengl()
{
#ifdef HAVE_GL
	static const char *get_pixels_frag =
		"uniform sampler2D src_tex;\n"
		"uniform sampler2D dst_tex;\n"
		"uniform vec2 dst_tex_dimensions;\n"
		"uniform vec3 chroma_offset;\n"
		"void main()\n"
		"{\n"
		"	vec4 result_color;\n"
		"	vec4 dst_color = texture2D(dst_tex, gl_FragCoord.xy / dst_tex_dimensions);\n"
		"	vec4 src_color = texture2D(src_tex, gl_TexCoord[0].st);\n"
		"	src_color.rgb -= chroma_offset;\n"
		"	dst_color.rgb -= chroma_offset;\n";

	static const char *put_pixels_frag =
		"	result_color.rgb += chroma_offset;\n"
		"	result_color.rgb = mix(dst_color.rgb, result_color.rgb, src_color.a);\n"
		"	result_color.a = max(src_color.a, dst_color.a);\n"
		"	gl_FragColor = result_color;\n"
		"}\n";

	static const char *blend_add_frag =
		"	result_color.rgb = dst_color.rgb + src_color.rgb;\n";

	static const char *blend_max_frag =
		"	result_color.r = max(abs(dst_color.r, src_color.r);\n"
		"	result_color.g = max(abs(dst_color.g, src_color.g);\n"
		"	result_color.b = max(abs(dst_color.b, src_color.b);\n";

	static const char *blend_min_frag =
		"	result_color.r = min(abs(dst_color.r, src_color.r);\n"
		"	result_color.g = min(abs(dst_color.g, src_color.g);\n"
		"	result_color.b = min(abs(dst_color.b, src_color.b);\n";

	static const char *blend_subtract_frag =
		"	result_color.rgb = dst_color.rgb - src_color.rgb;\n";


	static const char *blend_multiply_frag =
		"	result_color.rgb = dst_color.rgb * src_color.rgb;\n";

	static const char *blend_divide_frag =
		"	result_color.rgb = dst_color.rgb / src_color.rgb;\n"
		"	if(src_color.r == 0.0) result_color.r = 1.0;\n"
		"	if(src_color.g == 0.0) result_color.g = 1.0;\n"
		"	if(src_color.b == 0.0) result_color.b = 1.0;\n";


	VFrame *src = temp;
	VFrame *dst = get_output(output_layer);

	dst->enable_opengl();
	dst->init_screen();

	const char *shader_stack[] = { 0, 0, 0 };
	int current_shader = 0;




// Direct copy layer
	if(config.mode == TRANSFER_REPLACE)
	{
		src->to_texture();
		src->bind_texture(0);
		dst->enable_opengl();
		dst->init_screen();

// Multiply alpha
		glDisable(GL_BLEND);
		src->draw_texture();
	}
	else
	if(config.mode == TRANSFER_NORMAL)
	{
		dst->enable_opengl();
		dst->init_screen();

// Move destination to screen
		if(dst->get_opengl_state() != VFrame::SCREEN)
		{
			dst->to_texture();
			dst->bind_texture(0);
			dst->draw_texture();
		}

		src->to_texture();
		src->bind_texture(0);
		dst->enable_opengl();
		dst->init_screen();

		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		src->draw_texture();
	}
	else
	{
// Read destination back to texture
//.........这里部分代码省略.........
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:101,代码来源:overlay.C


示例20: process_package

void BrightnessUnit::process_package(LoadPackage *package)
{
	BrightnessPackage *pkg = (BrightnessPackage*)package;


	VFrame *output = plugin->output;
	VFrame *input = plugin->input;
	




#define DO_BRIGHTNESS(max, type, components, is_yuv) \
{ \
	type **input_rows = (type**)input->get_rows(); \
	type **output_rows = (type**)output->get_rows(); \
	int row1 = pkg->row1; \
	int row2 = pkg->row2; \
	int width = output->get_w(); \
	int r, g, b; \
 \
	if(!EQUIV(plugin->config.brightness, 0)) \
	{ \
		int offset = (int)(plugin->config.brightness / 100 * max); \
/*printf("DO_BRIGHTNESS offset=%d\n", offset);*/ \
 \
		for(int i = row1; i < row2; i++) \
		{ \
			type *input_row = input_rows[i]; \
			type *output_row = output_rows[i]; \
 \
			for(int j = 0; j < width; j++) \
			{ \
				r = input_row[j * components] + offset; \
 \
 				if(!is_yuv) \
				{ \
					g = input_row[j * components + 1] + offset; \
					b = input_row[j * components + 2] + offset; \
				} \
 \
				CLAMP(r, 0, max); \
				if(!is_yuv) \
				{ \
					CLAMP(g, 0, max); \
					CLAMP(b, 0, max); \
				} \
 \
				output_row[j * components] = r; \
 \
 				if(!is_yuv) \
				{ \
					output_row[j * components + 1] = g; \
					output_row[j * components + 2] = b; \
				} \
				else \
				{ \
					output_row[j * components + 1] = input_row[j * components + 1]; \
					output_row[j * components + 2] = input_row[j * components + 2]; \
				} \
 \
 				if(components == 4)  \
					output_row[j * components + 3] = input_row[j * components + 3]; \
			} \
		} \
 \
/* Data to be processed is now in the output buffer */ \
		input_rows = output_rows; \
	} \
 \
	if(!EQUIV(plugin->config.contrast, 0)) \
	{ \
		float contrast = (plugin->config.contrast < 0) ?  \
			(plugin->config.contrast + 100) / 100 :  \
			(plugin->config.contrast + 25) / 25; \
/*printf("DO_BRIGHTNESS contrast=%f\n", contrast);*/ \
 \
		int scalar = (int)(contrast * 0x100); \
		int offset = (max << 8) / 2 - max * scalar / 2; \
		int y, u, v; \
 \
		for(int i = row1; i < row2; i++) \
		{ \
			type *input_row = input_rows[i]; \
			type *output_row = output_rows[i]; \
 \
 			if(plugin->config.luma) \
			{ \
				for(int j = 0; j < width; j++) \
				{ \
					if(is_yuv) \
					{ \
						y = input_row[j * components]; \
					} \
					else \
					{ \
						r = input_row[j * components]; \
						g = input_row[j * components + 1]; \
						b = input_row[j * components + 2]; \
						if(max == 0xff) \
//.........这里部分代码省略.........
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:101,代码来源:brightness.C



注:本文中的VFrame类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VG类代码示例发布时间:2022-05-31
下一篇:
C++ VFolder类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap