📄 radeon_vid.c
字号:
case 9: /*ToDo_Active: In mode 9 there is a possibility that HScale ratio may be set to an illegal value, so we have extra conditions in the if statement. For consistancy, these conditions be added to the other modes as well. */ /* four tap on both (unless Y is too wide) */ if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+2+2) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && !DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ /* Colour components are fetched in pairs */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* two tap on Y (because it is too big for four tap), four tap on UV */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+2+2) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y with the four tap filters, but UV's are generated with dual two tap configuration. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+1+1) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && !DisallowFourTapVertFiltering) { /*0.625 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y, U, and V with the two tap filters */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+1+1) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000)) { /*0.375 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale step the U and V by two to allow more bandwidth for fetching Y's, thus we won't drop Y's yet. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+.5+.5) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5)<=0x2000)) { /*>=0.3125 and >.333333~ */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 1; *P23StepSize = 2; } /* We step the Y, U, and V by two. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=2+.5+.5) / 16.0) && ((uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } /* We step the Y by two and the U and V by four. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=2+.25+.25) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 2; *P23StepSize = 4; } /* We step the Y, U, and V by four. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=1+.25+.25) / 16.0) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } /* We would like to step the Y by four and the U and V by eight, but we can't mix step by 3 and step by 4 for packed modes */ /* We step the Y, U, and V by eight. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.125+.125) / 16.0) && ((uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*8)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } /* We step the Y by eight and the U and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.0625+.0625) / 16.0) && ((uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 8; *P23StepSize = 16; } /* We step the Y, U, and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.25+.0625+.0625) / 16.0) && ((uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=(ClocksNeededFor16Pixels=.25+.0625+.0625) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } break; case 10: case 11: case 12: case 13: case 14: /* YUV12, VYUY422, YUYV422, YOverPkCRCB12, YWovenWithPkCRCB12 */ /* We scale the Y, U, and V with the four tap filters */ /* four tap on both (unless Y is too wide) */ if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+4+4) / 16.0) && !DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* two tap on Y (because it is too big for four tap), four tap on UV */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+4+4) / 16.0) && DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y with the four tap filters, but UV's are generated with dual two tap configuration. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+2+2) / 16.0) && !DisallowFourTapVertFiltering) { /*0.625 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y, U, and V with the two tap filters */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=4+2+2) / 16.0) { /*0.375 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale step the U and V by two to allow more bandwidth for fetching Y's, thus we won't drop Y's yet. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=4+1+1) / 16.0) { /*0.312 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 1; *P23StepSize = 2; } /* We step the Y, U, and V by two. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=2+1+1) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } /* We step the Y by two and the U and V by four. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=2+.5+.5) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 2; *P23StepSize = 4; } /* We step the Y, U, and V by four. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=1+.5+.5) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } /* We step the Y by four and the U and V by eight. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=1+.25+.25) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Can't mix step by 3 and step by 4 for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 4; *P23StepSize = 8; } /* We step the Y, U, and V by eight. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.25+.25) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } /* We step the Y by eight and the U and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.125+.125) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Step by 5 not supported for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 8; *P23StepSize = 16; } /* We step the Y, U, and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.25+.125+.125) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Step by 5 not supported for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { if (fieldvalue_OV0_SURFACE_FORMAT==10) { H_scale_ratio=(ClocksNeededFor16Pixels=.25+.125+.125) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=(ClocksNeededFor16Pixels=.5+.25+.25) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } } break; default: break; } besr.h_inc = (*(val_OV0_P1_H_INC)&0x3fff) | ((*(val_OV0_P23_H_INC)&0x3fff)<<16); besr.step_by = (*(val_OV0_P1_H_STEP_BY)&0x7) | ((*(val_OV0_P23_H_STEP_BY)&0x7)<<8);}/* ********************************************************* *//* ** Setup Black Bordering *//* ********************************************************* */static void ComputeBorders( vidix_playback_t *config, int VertUVSubSample ){ double tempBLANK_LINES_AT_TOP; unsigned TopLine,BottomLine,SourceLinesUsed,TopUVLine,BottomUVLine,SourceUVLinesUsed; uint32_t val_OV0_P1_ACTIVE_LINES_M1,val_OV0_P1_BLNK_LN_AT_TOP_M1; uint32_t val_OV0_P23_ACTIVE_LINES_M1,val_OV0_P23_BLNK_LN_AT_TOP_M1; if (floor(config->src.y)<0) { tempBLANK_LINES_AT_TOP = -floor(config->src.y); TopLine = 0; } else { tempBLANK_LINES_AT_TOP = 0; TopLine = (int)floor(config->src.y); } /* Round rSrcBottom up and subtract one */ if (ceil(config->src.y+config->src.h) > config->src.h) { BottomLine = config->src.h - 1; } else { BottomLine = (int)ceil(config->src.y+config->src.h) - 1; } if (BottomLine >= TopLine) { SourceLinesUsed = BottomLine - TopLine + 1; } else { /*CYCACC_ASSERT(0, "SourceLinesUsed less than or equal to zero.") */ SourceLinesUsed = 1; } { int SourceHeightInPixels; SourceHeightInPixels = BottomLine - TopLine + 1; } val_OV0_P1_ACTIVE_LINES_M1 = SourceLinesUsed - 1; val_OV0_P1_BLNK_LN_AT_TOP_M1 = ((int)tempBLANK_LINES_AT_TOP-1) & 0xfff; TopUVLine = ((int)(config->src.y/VertUVSubSample) < 0) ? 0: (int)(config->src.y/VertUVSubSample); /* Round rSrcTop down */ BottomUVLine = (ceil(((config->src.y+config->src.h)/VertUVSubSample)) > (config->src.h/VertUVSubSample)) ? (config->src.h/VertUVSubSample)-1 : (int)ceil(((config->src.y+config->src.h)/VertUVSubSample))-1; if (BottomUVLine >= TopUVLine) { SourceUVLinesUsed = BottomUVLine - TopUVLine + 1; } else { /*CYCACC_ASSERT(0, "SourceUVLinesUsed less than or equal to zero.") */ SourceUVLinesUsed = 1; } val_OV0_P23_ACTIVE_LINES_M1 = SourceUVLinesUsed - 1; val_OV0_P23_BLNK_LN_AT_TOP_M1 = ((int)(tempBLANK_LINES_AT_TOP/VertUVSubSample)-1) & 0x7ff; besr.p1_blank_lines_at_top = (val_OV0_P1_BLNK_LN_AT_TOP_M1 & 0xfff) | ((val_OV0_P1_ACTIVE_LINES_M1 & 0xfff) << 16); besr.p23_blank_lines_at_top = (val_OV0_P23_BLNK_LN_AT_TOP_M1 & 0x7ff) | ((val_OV0_P23_ACTIVE_LINES_M1 & 0x7ff) << 16);}static void ComputeXStartEnd( int is_400, uint32_t LeftPixel,uint32_t LeftUVPixel, uint32_t MemWordsInBytes,uint32_t BytesPerPixel, uint32_t SourceWidthInPixels, uint32_t P1StepSize, uint32_t BytesPerUVPixel,uint32_t SourceUVWidthInPixels, uint32_t P23StepSize, uint32_t *p1_x_start, uint32_t *p2_x_start ){ uint32_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -