コード例 #1
0
ファイル: copy_pixels.c プロジェクト: OpenHEVC/gpac
void dx_copy_pixels(GF_VideoSurface *dst_s, const GF_VideoSurface *src_s, const GF_Window *src_wnd)
{
	/*handle YUV input*/
	if (get_yuv_base(src_s->pixel_format)==GF_PIXEL_YV12) {
		if (format_is_yuv(dst_s->pixel_format)) {
			/*generic YV planar to YUV (planar or not) */
			write_yv12_to_yuv(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->pixel_format, src_s->width, src_s->height, src_wnd, src_s->u_ptr, src_s->v_ptr);
			return;
		}
	} else if (get_yuv_base(src_s->pixel_format)==GF_PIXEL_YV12_10) {
		if (format_is_yuv(dst_s->pixel_format)) {
			/*generic YV planar to YUV (planar or not) */
			gf_color_write_yv12_10_to_yuv(dst_s, src_s->video_buffer, src_s->u_ptr, src_s->v_ptr, src_s->pitch_y, src_s->width, src_s->height, src_wnd);
			return;
		}
	} else if (format_is_yuv(src_s->pixel_format)) {
		if (format_is_yuv(dst_s->pixel_format)) {
			write_yvyu_to_yuv(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->pixel_format, src_s->width, src_s->height, src_wnd);
			return;
		}
	} else {
		switch (dst_s->pixel_format) {
		case GF_PIXEL_RGB_555:
			rgb_to_555(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
			return;
		case GF_PIXEL_RGB_565:
			rgb_to_565(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
			return;
		case GF_PIXEL_RGB_24:
		case GF_PIXEL_RGBS:
		case GF_PIXEL_BGR_24:
			rgb_to_24(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
			return;
		case GF_PIXEL_RGB_32:
		case GF_PIXEL_RGBD:
		case GF_PIXEL_RGBDS:
		case GF_PIXEL_BGR_32:
			rgb_to_32(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
			return;
		}
	}

	gf_stretch_bits(dst_s, (GF_VideoSurface*) src_s, NULL, (GF_Window *)src_wnd, 0xFF, 0, NULL, NULL);
}
コード例 #2
0
ファイル: lcd_test.cpp プロジェクト: Hletian/ebox_stm32
void setup()
{
    ebox_init();
    PB8.mode(OUTPUT_PP);
    lcd.begin(1);
    lcd.clear(RED);
    uart1.begin(9600);
    
    lcd.column_order(1);
    lcd.row_order(1);

    lcd.front_color = RED;
    lcd.back_color = BLACK;
    hsv.s = 1;
    hsv.v = 0.5;
    hsv.h = 0;

    lcd.front_color = RED;
    if(index >= 0x50)index = 0x20;
    for(int i = 0; i < 160; i++){
        hsv.h = i*36/16;
        hsv.h %= 360;
        HSV_to_RGB(hsv,rgb);
        rgb_to_565(rgb,_color[i]);
       lcd.front_color = _color[i];
       lcd.draw_h_line(0,i,128);
    }
    lcd.disp_char8x16(0,0,index++);
    
    lcd.printf(2,2,"1231asddfgdsfgthkfhddddj2nhd");
    

    lcd.front_color = GREEN;
    lcd.draw_circle(50,50,50);
    lcd.draw_line(64,50,r,100);
    

}
コード例 #3
0
ファイル: copy_pixels.c プロジェクト: DmitrySigaev/DSMedia
void R2D_copyPixels(M4VideoSurface *vs, unsigned char *src, u32 src_stride, u32 src_w, u32 src_h, u32 src_pf, M4Window *src_wnd)
{
	/*handle YUV input*/
	if (get_yuv_base(src_pf)==M4PF_YV12) {
		if (formx2d_is_yuv(vs->pixel_format)) {
			/*generic YV planar to YUV (planar or not) */
			VR_write_yv12_to_yuv(vs, src, src_stride, src_pf, src_w, src_h, src_wnd);
		} else {
			/*YVplanar to RGB*/
			unsigned char *pY, *pU, *pV, *pTmp;

			/*setup start point in src*/
			pY = src;
			pU = pY + src_w*src_h;
			pV = pY + 5*src_w*src_h/4;

			pY += src_stride*src_wnd->y + src_wnd->x;
			pU += (src_stride * src_wnd->y / 2 + src_wnd->x) / 2;
			pV += (src_stride * src_wnd->y / 2 + src_wnd->x) / 2;
			assert(src_stride==src_w);
			
			if (src_pf != M4PF_YV12) {
				pTmp = pU;
				pU = pV;
				pV = pTmp;
			}


			switch (vs->pixel_format) {
			case M4PF_RGB_555:
				yuv2rgb_555(vs->video_buffer, vs->pitch, pY, pU, pV, src_stride, src_stride/2, src_wnd->w, src_wnd->h);
				break;
			case M4PF_RGB_565:
				yuv2rgb_565(vs->video_buffer, vs->pitch, pY, pU, pV, src_stride, src_stride/2, src_wnd->w, src_wnd->h);
				break;
			/*to do: add RB flip*/
			case M4PF_RGB_24:
			case M4PF_BGR_24:
				yuv2bgr_24(vs->video_buffer, vs->pitch, pY, pU, pV, src_stride, src_stride/2, src_wnd->w, src_wnd->h);
				break;
			/*to do: add RB flip*/
			case M4PF_RGB_32:
			case M4PF_BGR_32:
				yuv2rgb_32(vs->video_buffer, vs->pitch, pY, pU, pV, src_stride, src_stride/2, src_wnd->w, src_wnd->h);
				break;
			}
		}
		/*other output formats are ignored*/
		return;
	}

	switch (vs->pixel_format) {
	case M4PF_RGB_555:
		rgb_to_555(vs, src, src_stride, src_w, src_w, src_pf, src_wnd);
		break;
	case M4PF_RGB_565:
		rgb_to_565(vs, src, src_stride, src_w, src_w, src_pf, src_wnd);
		break;
	case M4PF_RGB_24:
	case M4PF_BGR_24:
		rgb_to_24(vs, src, src_stride, src_w, src_w, src_pf, src_wnd);
		break;
	case M4PF_RGB_32:
	case M4PF_BGR_32:
		rgb_to_32(vs, src, src_stride, src_w, src_w, src_pf, src_wnd);
		break;
	}
}