⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 play_capture_hdmi.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 5 页
字号:
			}			switch (avi->color_space) {  // colorspace to which RGB should be converted to on YCbCr outputs				case 0: fprintf(stderr, "newavi - RGB for undefined YCbCr\n"); break;				case 1: fprintf(stderr, "newavi - RGB for YCbCr 601\n"); break;				case 2: fprintf(stderr, "newavi - RGB for YCbCr 709\n"); break;				case 3: // extended					switch (avi->ext_col) {						case 0: fprintf(stderr, "newavi - RGB for xvYCC 601\n"); break;						case 1: fprintf(stderr, "newavi - RGB for xvYCC 709\n"); break;						default: fprintf(stderr, "newavi - unknown extended color space code for RGB: %lu\n", avi->ext_col);					}					break;				default: fprintf(stderr, "newavi - unknown color space code for RGB: %lu\n", avi->color_space);			}			break;		case 1: 			fprintf(stderr, "newavi - YCbCr 4:2:2\n");			upsample_from_422 = TRUE;			if (0)  // prevent first line of next case from being executed			// no break;		case 2: 			fprintf(stderr, "newavi - YCbCr 4:4:4\n");			icf = EMhwlibInputColorFormat_24BPP;			switch (avi->color_space) {				case 0: fprintf(stderr, "newavi - no data on YCbCr colorspace, assuming VIC default!\n");					if ((avi->vic == 4) || (avi->vic == 5) || (avi->vic == 16) || (avi->vic == 19) || (avi->vic == 20) || ((avi->vic >= 31) && (avi->vic <= 34)) || (avi->vic == 39) || (avi->vic == 40) || (avi->vic == 41) || (avi->vic == 46) || (avi->vic == 47)) {						cs = EMhwlibColorSpace_YUV_709;					} else {						cs = EMhwlibColorSpace_YUV_601;					}					break;				case 1: cs = EMhwlibColorSpace_YUV_601; break;				case 2: cs = EMhwlibColorSpace_YUV_709; break;				case 3: // extended					switch (avi->ext_col) {						case 0: cs = EMhwlibColorSpace_xvYCC_601; break;						case 1: cs = EMhwlibColorSpace_xvYCC_709; break;						default: fprintf(stderr, "newavi - unknown extended color space code: %lu\n", avi->ext_col); break;					}					break;				default: fprintf(stderr, "newavi - unknown color space code: %lu\n", avi->color_space);			}			break;		default: 			fprintf(stderr, "newavi - unknown color sampling code: %lu\n", avi->color_format);		}				// handle changes		if (upsample_from_422 != pHDMI->upsample_from_422) {			pHDMI->upsample_from_422 = upsample_from_422;			// TODO switch chip			capsam_SiI9031_set_422_to_444_upsampling(pHDMI->pSiI9031, upsample_from_422);		}		if (cs != pHDMI->InputColorSpace) {			fprintf(stderr, "newavi - color space: %s\n", 				(cs == EMhwlibColorSpace_RGB_0_255) ? "RGB 0-255" : 				(cs == EMhwlibColorSpace_RGB_16_235) ? "RGB 16-235" : 				(cs == EMhwlibColorSpace_YUV_601) ? "YUV601" : 				(cs == EMhwlibColorSpace_YUV_709) ? "YUV709" : 				(cs == EMhwlibColorSpace_xvYCC_601) ? "xvYCC601" : 				(cs == EMhwlibColorSpace_xvYCC_709) ? "xvYCC709" : 				"unknown");			pHDMI->InputColorSpace = cs;			if (pUpdate && (pUpdate->APIVersion >= 1)) {				pUpdate->InputColorSpaceUpdate = TRUE;			}			// TODO switch chip			capsam_SiI9031_set_blanking_color(pHDMI->pSiI9031, cs);		}		if (icf != pHDMI->InputColorFormat) {			fprintf(stderr, "newavi - sampling mode: %s\n", (icf == EMhwlibInputColorFormat_24BPP) ? ((cs == EMhwlibColorSpace_RGB_0_255) ? "RGB" : "4:4:4") : "4:2:2");			pHDMI->InputColorFormat = icf;			if (pUpdate && (pUpdate->APIVersion >= 1)) {				pUpdate->InputColorFormatUpdate = TRUE;			}		}		if (pUpdate && (pUpdate->APIVersion >= 1)) {			pUpdate->InputColorSpaceValid = TRUE;			pUpdate->InputColorSpace = cs;			pUpdate->InputColorFormatValid = TRUE;			pUpdate->InputColorFormat = icf;		}	}		// Get aspect ratio from AVI	avi_asp.X = 0; avi_asp.Y = 0;	switch (avi->aspect_ratio) {		case DH_ar_no_info: break;  // no data in AVI about aspect ratio, use implicit aspect ratio from VIC		case DH_ar_4x3:  avi_asp.X =  4; avi_asp.Y =  3; break;		case DH_ar_16x9: avi_asp.X = 16; avi_asp.Y =  9; break;		default: 			if (force || (avi->aspect_ratio != pHDMI->last_avi.aspect_ratio)) 				fprintf(stderr, "newavi - unknown aspect ratio code: %lu\n", avi->aspect_ratio); 			break;	}		// Apply new video mode from AVI	asp = pHDMI->PictureAspectRatio;	if (force || (pHDMI->last_avi.vic != avi->vic) || ((pHDMI->TVStandard == EMhwlibTVStandard_Custom) && avi->vic)) {		fprintf(stderr, "newavi - VIC: %lu\n", avi->vic);		if ((avi->vic > 0) && (avi->vic < (sizeof(capsam_hdmi_cea861_modes) / sizeof(enum EMhwlibTVStandard)))) {			// Use TVStandard from VIC			if (capsam_hdmi_cea861_modes[avi->vic] != pHDMI->TVStandard) {				fprintf(stderr, "newavi - video mode from VIC %lu: %s\n", avi->vic, CEA861VICNames[avi->vic]);				pHDMI->TVStandard = capsam_hdmi_cea861_modes[avi->vic];				if (pUpdate && (pUpdate->APIVersion >= 1)) {					pUpdate->TVStandardUpdate = TRUE;				}			}			if (pUpdate && (pUpdate->APIVersion >= 1)) {				pUpdate->TVStandardValid = TRUE;				pUpdate->TVStandard = pHDMI->TVStandard;			}			if (pHDMI->last_avi.vic != avi->vic) {				fprintf(stderr, "\n\n\t\t%s %s\n\n\n", 					CEA861VICNames[avi->vic], 					(pHDMI->InputColorSpace == EMhwlibColorSpace_RGB_0_255) ? "RGB 0-255" : 					(pHDMI->InputColorSpace == EMhwlibColorSpace_RGB_16_235) ? "RGB 16-235" : 					(pHDMI->InputColorSpace == EMhwlibColorSpace_YUV_601) ? "YCbCr601" : 					(pHDMI->InputColorSpace == EMhwlibColorSpace_YUV_709) ? "YCbCr709" : 					(pHDMI->InputColorSpace == EMhwlibColorSpace_xvYCC_601) ? "xvYCC601" : 					(pHDMI->InputColorSpace == EMhwlibColorSpace_xvYCC_709) ? "xvYCC709" : 					"unknown");			}			// 640x480 or first of two identical modes: 4:3			if ((avi->vic == 1) || ((avi->vic + 1 < (sizeof(capsam_hdmi_cea861_modes) / sizeof(enum EMhwlibTVStandard))) && (capsam_hdmi_cea861_modes[avi->vic] == capsam_hdmi_cea861_modes[avi->vic + 1]))) {				asp.X = 4;				asp.Y = 3;			} else {  // otherwise 16:9				asp.X = 16;				asp.Y = 9;			}			if (RMMemcmp(&asp, &(pHDMI->PictureAspectRatio), sizeof(struct EMhwlibAspectRatio))) {				fprintf(stderr, "newavi - aspect ratio from VIC %lu: %lu by %lu\n", avi->vic, asp.X, asp.Y);			}		} else {			if (avi->vic != 0) fprintf(stderr, "Error, unknown CEA 861-C timing descriptor in AVI: %lu\n", avi->vic);			if (pUpdate && (pUpdate->APIVersion >= 1)) {				pUpdate->VideoUpdate = TRUE;			}			if ((! avi_asp.X) || (! avi_asp.Y)) {				capsam_get_aspect_ratio_from_video_mode(pHDMI->TVStandard, NULL, FALSE, &asp.X, &asp.Y);			} else {				asp = avi_asp;			}		}	}		if (avi_asp.X && avi_asp.Y && RMMemcmp(&avi_asp, &asp, sizeof(struct EMhwlibAspectRatio))) {		fprintf(stderr, "newavi - aspect ratio in AVI (%lux%lu) does not match VIC %ld (%lux%lu)\n", 			avi_asp.X, avi_asp.Y, avi->vic, asp.X, asp.Y);		asp = avi_asp;	}	if (RMMemcmp(&asp, &(pHDMI->PictureAspectRatio), sizeof(struct EMhwlibAspectRatio))) {		pHDMI->PictureAspectRatio = asp;		if (pUpdate && (pUpdate->APIVersion >= 1)) {			pUpdate->PictureAspectRatioUpdate = TRUE;		}	}	if (pUpdate && (pUpdate->APIVersion >= 1)) {		pUpdate->PictureAspectRatioValid = TRUE;		pUpdate->PictureAspectRatio = pHDMI->PictureAspectRatio;	}		// set to neutral zoom window	x = ZOOM_0; y = ZOOM_0; w = ZOOM_1; h = ZOOM_1;		// report active format	if (force || (avi->active_format != pHDMI->last_avi.active_format)) {		enum DH_active_format_aspect_ratio act = (enum DH_active_format_aspect_ratio)(avi->active_format & 0x0F);		fprintf(stderr, "newavi - %sactive format: %u - %s\n", (avi->active_format & 0x10) ? "" : "in", act, 			(act == DH_af_reserved_0) ? "No info" : 			(act == DH_af_16x9_top) ? "16:9 content: at top of 4:3 frame, fills up 16:9 frame" : 			(act == DH_af_14x9_top) ? "14:9 content: at top of 4:3 frame, centered on 16:9 frame" : 			(act == DH_af_64x27_centered) ? "Cinemascope widescreen (2.35:1, 64:27) content: centered on 4:3 or 16:9 frame" : 			(act == DH_af_same_as_picture) ? "content fills up frame" : 			(act == DH_af_4x3_centered) ? "4:3 content: fills up 4:3 frame, centered on 16:9 frame" : 			(act == DH_af_16x9_centered) ? "16:9 content: centered on 4:3 frame, fills up 16:9 frame" : 			(act == DH_af_14x9_centered) ? "14:9 content: centered on 4:3 frame, centered on 16:9 frame" : 			(act == DH_af_4x3_centered_prot_14x9) ? "4:3 content with essential content in 14:9 centered portion" : 			(act == DH_af_16x9_centered_prot_14x9) ? "16:9 content with essential content in 14:9 centered portion" : 			(act == DH_af_16x9_centered_prot_4x3) ? "16:9 content with essential content in 4:3 centered portion" : 			"unknown format code!");		if (pUpdate && (pUpdate->APIVersion >= 1)) {			pUpdate->ContentAFDUpdate = TRUE;		}	}	if (pUpdate && (pUpdate->APIVersion >= 1)) {		pUpdate->ContentAFDValid = TRUE;		pUpdate->ContentAFD.ActiveFormat = (enum EMhwlibActiveFormat)(avi->active_format & 0x0F);		pUpdate->ContentAFD.ActiveFormatValid = (avi->active_format & 0x10) ? TRUE : FALSE;		pUpdate->ContentAFD.FrameAspectRatio = pHDMI->PictureAspectRatio;	}		if (force || 		(avi->h_bar != pHDMI->last_avi.h_bar) || 		(avi->top != pHDMI->last_avi.top) || 		(avi->bottom != pHDMI->last_avi.bottom) || 		(avi->v_bar != pHDMI->last_avi.v_bar) || 		(avi->left != pHDMI->last_avi.left) || 		(avi->right != pHDMI->last_avi.right)) {		if (pUpdate && (pUpdate->APIVersion >= 1)) {			pUpdate->ContentBarInfoUpdate = TRUE;		}	}	if (pUpdate && (pUpdate->APIVersion >= 1)) {		pUpdate->ContentBarInfoValid = TRUE;		pUpdate->ContentBarInfo.FrameSizeX = 0;  // TODO		pUpdate->ContentBarInfo.FrameSizeY = 0;		pUpdate->ContentBarInfo.VerticalBarDataValid = avi->v_bar;		pUpdate->ContentBarInfo.HorizontalBarDataValid = avi->h_bar;		pUpdate->ContentBarInfo.EndLeftBarPixelNum = avi->left;		pUpdate->ContentBarInfo.StartRightBarPixelNum = avi->right;		pUpdate->ContentBarInfo.EndTopBarLineNum = avi->top;		pUpdate->ContentBarInfo.StartBottomBarLineNum = avi->bottom;	}		// report scan info	switch (avi->scan_info) {	case DH_overscanned:		scan = EMhwlibScanInfo_Overscanned;		break;	case DH_underscanned:		scan = EMhwlibScanInfo_Underscanned;		break;	default:  // no info, determine default scan mode from video code		scan = (avi->vic > 1) ? EMhwlibScanInfo_Overscanned : EMhwlibScanInfo_Underscanned;	}	if (force || (avi->scan_info != pHDMI->last_avi.scan_info) || (avi->vic != pHDMI->last_avi.vic)) {		fprintf(stderr, "newavi - picture scan info: %s\n", 			(avi->scan_info == DH_overscanned) ? "overscanned (will be cropped)" : 			(avi->scan_info == DH_underscanned) ? "underscanned (will not be cropped)" : 			(scan == DH_overscanned) ? "no data, overscanned VIC (will be cropped)" : 			(scan == DH_underscanned) ? "no data, underscanned VIC (will not be cropped)" : 			"no data");		if (pUpdate && (pUpdate->APIVersion >= 1)) {			pUpdate->ContentScanInfoUpdate = TRUE;		}	}	if (pUpdate && (pUpdate->APIVersion >= 1)) {		pUpdate->ContentScanInfoValid = TRUE;		pUpdate->ContentScanInfo = scan;	}		/* TODO move to main		// apply active format	if (avi->active_format & 0x10) {		enum EMhwlibActiveFormat act = (enum EMhwlibActiveFormat)(avi->active_format & 0x0F);		struct EMhwlibActiveFormatDescription afd;		struct EMhwlibAspectRatio scaler_ar;		RMbool output_variable_ar, variable_output;		struct EMhwlibActiveFormatDescription output_afd;				afd.ActiveFormat = act;		afd.ActiveFormatValid = TRUE;		afd.FrameAspectRatio = pHDMI->PictureAspectRatio;				err = get_scaler_output_aspect_ratio(			dcc_info->pRUA, 			dcc_info->disp_info->osd_scaler[input], 			(dcc_info->route == DCCRoute_Secondary) ? DispVCRMixer : DispMainMixer, 			&scaler_ar, &variable_output);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Can not get scaler output aspect ratio! %s\n", RMstatusToString(err)));			// fallback, this assumes full screen scaler window.			scaler_ar.X = disp_opt->ar_x;			scaler_ar.Y = disp_opt->ar_y;		}		RMDBGLOG((LOCALDBG, "Scaler output aspect ratio: %lu:%lu\n", scaler_ar.X, scaler_ar.Y));		output_afd.FrameAspectRatio.X = disp_opt->ar_x;		output_afd.FrameAspectRatio.Y = disp_opt->ar_y;		output_afd.ActiveFormat = disp_opt->active_format;		output_afd.ActiveFormatValid = disp_opt->active_format_valid;		if (variable_output) {			get_output_variable_aspect_ratio(disp_opt->standard, &output_variable_ar);		} else {			output_variable_ar = FALSE;		}		err = apply_active_format_rel(			afd, scaler_ar, 			output_variable_ar, &output_afd, 			&x, &y, &w, &h, 			&update_zoom);		if (variable_output && (			(output_afd.FrameAspectRatio.X != disp_opt->ar_x) || 			(output_afd.FrameAspectRatio.Y != disp_opt->ar_y) || 			(output_afd.ActiveFormatValid && (output_afd.ActiveFormat != disp_opt->active_format)) || 			(output_afd.ActiveFormatValid != disp_opt->active_format_valid)		)) {			apply_active_format_output(dcc_info->pRUA, 				(dcc_info->route == DCCRoute_Secondary) ? DispVCRMixer : DispMainMixer, 				disp_opt->dh_info->pDH, 				output_afd);			disp_opt->ar_x = output_afd.FrameAspectRatio.X;			disp_opt->ar_y = output_afd.FrameAspectRatio.Y;			disp_opt->active_format_valid = output_afd.ActiveFormatValid;			disp_opt->active_format = output_afd.ActiveFormat;		}		if (RMFAILED(err) && (force || (avi->active_format != pHDMI->last_avi.active_format))) {			fprintf(stderr, "newavi - failed to apply active format: %u\n", act);		}	} else if (pHDMI->last_avi.active_format & 0x10) {		// no more active format, return to full screen		update_zoom = TRUE;	}		// apply horizontal bars	if (avi->h_bar) {		if (avi->bottom && (avi->bottom > avi->top)) {  // sanity check			if (force || 				(avi->h_bar != pHDMI->last_avi.h_bar) || 				(avi->top != pHDMI->last_avi.top) || 				(avi->bottom != pHDMI->last_avi.bottom)			) fprintf(stderr, "newavi - horizontal bars to line %ld, from line %ld\n", avi->top, avi->bottom);			y = avi->top;			h = avi->bottom - avi->top - 1;			update_zoom = TRUE;		}	} else if (pHDMI->last_avi.h_bar) {		// no more horizontal bars, return to full height		update_zoom = TRUE;	}		// apply vertical bars	if (avi->v_bar) {		if (avi->right && (avi->right > avi->left)) {  // sanity check			if (force || 				(avi->v_bar != pHDMI->last_avi.v_bar) || 				(avi->left != pHDMI->last_avi.left) || 				(avi->right != pHDMI->last_avi.right)			) fprintf(stderr, "newavi - vertical bars to col %ld, from col %ld\n", avi->left, avi->right);			x = avi->left * (avi->in_pixel_rep + 1);			w = (avi->right - avi->left - 1) * (avi->in_pixel_rep + 1);			update_zoom = TRUE;		}	} else if (pHDMI->last_avi.v_bar) {		// no more vertical bars, return to full width		update_zoom = TRUE;	}		// determine default scan mode from video mode	scan = (avi->vic > 1) ? EMhwlibScanInfo_Overscanned : EMhwlibScanInfo_Underscanned;	// override scan mode from AVI	if (avi->scan_info != pHDMI->last_avi.scan_info) {		// unused for now		fprintf(stderr, "newavi - picture scan info: %s\n", 			(avi->scan_info == DH_overscanned) ? "overscanned (will be cropped)" : 			(avi->scan_info == DH_underscanned) ? "underscanned (will not be cropped)" : 			"no data");	}	switch (avi->scan_info) {	case DH_overscanned:		scan = EMhwlibScanInfo_Overscanned;		break;	case DH_underscanned:		scan = EMhwlibScanInfo_Underscanned;		break;	}	// picture is overscanned, need to crop "dirty" edge	if (scan == EMhwlibScanInfo_Overscanned) {		RMuint32 adj = (ZOOM_0 * pHDMI->overscan_crop + 100) / 200;  // cut off half of the percentage on each side		fprintf(stderr, "newavi - applying %lu%% overscan crop\n", pHDMI->overscan_crop);		if ((x >= ZOOM_0) && (w >= ZOOM_0)) {			x += adj;			w -= (adj * 2);		} else {			// TODO			fprintf(stderr, "newavi - vertical bar info present, overscan crop not applied\n");		}		if ((y >= ZOOM_0) && (h >= ZOOM_0)) {			y += adj;			h -= (adj * 2);		} else {			// TODO			fprintf(stderr, "newavi - horizontal bar info present, overscan crop not applied\n");		}	}		// update bar information	if ((! pHDMI->zoom_force) && (

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -