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

📄 config.c

📁 ccs环境下实现图像的平移 用的是DM642
💻 C
📖 第 1 页 / 共 2 页
字号:
{
	float framerate[8]={24000/1001,24,25,30000/1001,30,50,60000/1001,60};
	if(input->frame_rate_code<1||input->frame_rate_code>8)
		{
			printf("\n Undefined frame_rate in all levels. \n");
			exit(0);
		}
	switch (input->level_id)
	{
	case 0x10:
		{
			if(input->img_width>352)
			{
				printf("\n Image Width exceeds level 2.0 restriction.\n");
				exit(-1);
			}
			else 
				if(input->img_height>288)
					{
						printf("\n Image height exceeds level 2.0 restriction.\n");
						exit(-1);
					}
				else
					{
						if(input->frame_rate_code>5)
						{
							printf("\n Current frame_rate is not support in Level_2.0 .\n");
							exit(-1);
						}
						else 
						{
							if((long)(input->img_width)*(long)(input->img_height)*(framerate[input->frame_rate_code-1])>2534400)
							{
								printf("\n Luma Sampling Rate invalid for level 2.0.\n");
								exit(-1);
							}
						}
					}
						
			if((long)(input->img_width)*(long)(input->img_height)/256>396)
			{
				printf("\n The number of macroblock per frame exceeds 396 in level 2.0.\n");
				exit(-1);
			}
			
			if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>11880)
			{
				printf(" \n The number of macroblock per second exceeds 11880 in level 2.0.\n");
				exit(-1);
			}
			
			if(input->chroma_format!=1)
			{
				printf("\n In level 2.0 only format 4:2:0 is supported.\n");
				exit(-1);
			}

			break;
		}

	case 0x20:
		{
			if(input->img_width>720)
			{
				printf("\n Image Width exceeds level 4.0's restriction.\n");
				exit(-1);
			}
			else 
				if(input->img_height>576)
					{
						printf("\n Imgage Height exceeds level 4.0's restriction.\n");
						exit(-1);
					}
				else
					{
						if(input->frame_rate_code>5)
						{
							printf("\n Current frame_rate is not support in Level_4.0 .\n");
							exit(-1);
						}
						else
						{
							if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>10368000)
							{
								printf("\n Luma Sampling Rate invalid for level 4.0.\n");
								exit(-1);
							}		
						}
					}
		
			if((long)(input->img_width)*(long)(input->img_height)/256>4050)
			{
				printf(" \n The number of macroblock per frame exceeds 1,620 for Level_4.0.\n");
				exit(-1);
			}
			
			if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>40500)
			{
				printf(" \n The number of macroblock per second exceeds 40500 in Level_4.0.\n");
				exit(-1);
			}
			
			if(input->chroma_format!=1)
			{
				printf("\n In level 4.0 only format 4:2:0 is supported.\n");
				exit(-1);
			}

			break;
		}

		case 0x22:
		{
			if(input->img_width>720)
			{
				printf("\n Imgage Width exceeds level 4.2's restriction.\n");
				exit(-1);
			}
			else 
				if(input->img_height>576)
					{
						printf("\n Image Height exceeds level 4.2's restriction.\n");
						exit(-1);
					}
				else
					{
						if(input->frame_rate_code>5)
						{
							printf("\n Current frame_rate is not support in Level_4.2 .\n");
							exit(-1);
						}
						else
						{
							if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>10368000)
							{
								printf("\n Luma Sampling Rate invalid for level 4.2.\n");
								exit(-1);
							}
						}
					}
			if((long)(input->img_width)*(long)(input->img_height)/256>1620)
			{
				printf(" \n The number of macroblock per frame exceeds 1,620 for Level_4.2.\n");
				exit(-1);
			}
			
			if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>40500)
			{
				printf(" \n The number of macroblock per second exceeds 40500 in Level_4.2.\n");
				exit(-1);
			}
			
			if(input->chroma_format!=1&&input->chroma_format!=2)
			{
				printf("\n In level 4.2 only format 4:2:0 and 4:2:2 are supported.\n");
				exit(-1);
			}

			break;
		}

	case 0x40:
		{
			if(input->img_width>1920)
			{
				printf("\n Imgage Width exceeds level 6.0's restriction.\n");
				exit(-1);
			}
			else 
				if(input->img_height>1152)
					{
						printf("\n Image Height exceeds level 6.0's restriction.\n");
						exit(-1);
					}
				else
					{
						if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>62668800)
							{
								printf("\n Luma Sampling Rate invalid for level 6.0.\n");
								exit(-1);
							}
					}	
			
			if((long)(input->img_width)*(long)(input->img_height)/256>8160)
			{
				printf(" \n The number of macroblock per frame exceeds 8160 for Level_6.0.\n");
				exit(-1);
			}
			
			if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>244800)
			{
				printf(" \n The number of macroblock per second exceeds 244800 in Level_6.0.\n");
				exit(-1);
			}
			
			if(input->chroma_format!=1)
			{
				printf("\n In level 6.0 only format 4:2:0 is supported.\n");
				exit(-1);
			}

			break;
		}

	case 0x42:
		{
			if(input->img_width>1920)
			{
				printf("\n Imgage Width exceeds level 6.2's restriction.\n");
				exit(-1);
			}
			else 
				if(input->img_height>1152)
					{
						printf("\n Imgage Height exceeds level 6.2's restriction.\n");
						exit(-1);
					}
				else
					{
						if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>62668800)
							{
								printf("\n Luma Sampling Rate invalid for level 6.2.\n");
								exit(-1);
							}
					}
			
			if((long)(input->img_width)*(long)(input->img_height)/256>8160)
			{
				printf(" \n The number of macroblock per frame exceeds 8160 for Level_6.2.\n");
				exit(-1);
			}
			
			if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>244800)
			{
				printf(" \n The number of macroblock per second exceeds 244800 in Level_6.2.\n");
				exit(-1);
			}
			
			if(input->chroma_format!=1&&input->chroma_format!=2)
			{
				printf("\n In level 6.2 only format 4:2:0 and 4:2:2 are supported.\n");
				exit(-1);
			}

			break;
		}

	default: 
		{
		printf("\n No such level_ID. \n");
		exit(-1);
		}
	}
	
}
/*
*************************************************************************
* Function:Checks the input parameters for consistency.
* Input:
* Output:
* Return: 
* Attention:
*************************************************************************
*/

static void PatchInp ()
{
  // consistency check of QPs
	input->fixed_picture_qp = 1;/*lgp*/
  if (input->qp0 > MAX_QP || input->qp0 < MIN_QP)
  {
    snprintf(errortext, ET_SIZE, "Error input parameter quant_0,check configuration file");
    error (errortext, 400);
  }

  if (input->qpN > MAX_QP || input->qpN < MIN_QP)
  {
    snprintf(errortext, ET_SIZE, "Error input parameter quant_n,check configuration file");
    error (errortext, 400);
  }

  if (input->qpB > MAX_QP || input->qpB < MIN_QP)
  {
    snprintf(errortext, ET_SIZE, "Error input parameter quant_B,check configuration file");
    error (errortext, 400);
  }

  // consistency check no_multpred
  if (input->no_multpred<1) 
	  input->no_multpred=1;

  if (input->img_width % 16 != 0)   //add by wuzhongmou 0610
  {
    img->auto_crop_right = 16-(input->img_width % 16);
  }
  else
  {
    img->auto_crop_right=0;
  }
    if (input->InterlaceCodingOption!=FRAME_CODING)  //add by wuzhongmou 0610
  {
    if (input->img_height % 32 != 0)
    {
      img->auto_crop_bottom = 32-(input->img_height % 32);
    }
    else
    {
      img->auto_crop_bottom=0;
    }
  }
  else              
  {
    if (input->img_height % 16 != 0)     //add by wuzhongmou 0610
    {
      img->auto_crop_bottom = 16-(input->img_height % 16);
    }
    else
    {
      img->auto_crop_bottom=0;
    }
  }                                   //add by wuzhongmou 0610
  // check range of filter offsets
  if (input->alpha_c_offset > 6 || input->alpha_c_offset < -6)
  {
    snprintf(errortext, ET_SIZE, "Error input parameter LFAlphaC0Offset, check configuration file");
    error (errortext, 400);
  }

  if (input->beta_offset > 6 || input->beta_offset < -6)
  {
    snprintf(errortext, ET_SIZE, "Error input parameter LFBetaOffset, check configuration file");
    error (errortext, 400);
  }

  // Set block sizes
  input->blc_size[0][0]=16;
  input->blc_size[0][1]=16;
  input->blc_size[1][0]=16;
  input->blc_size[1][1]=16;
  input->blc_size[2][0]=16;
  input->blc_size[2][1]= 8;
  input->blc_size[3][0]= 8;
  input->blc_size[3][1]=16;
  input->blc_size[4][0]= 8;
  input->blc_size[4][1]= 8;

  // B picture consistency check
  if(input->successive_Bframe > input->jumpd)
  {
    snprintf(errortext, ET_SIZE, "Number of B-frames %d can not exceed the number of frames skipped", input->successive_Bframe);
    error (errortext, 400);
  }
  
  if(input->successive_Bframe==0)  //low_delay added by cjw 20070414
	input->low_delay=1;
  else
	input->low_delay=0;
  
  // Open Files
  if (strlen (input->infile) > 0 && (p_in=fopen(input->infile,"rb"))==NULL)
  {
    snprintf(errortext, ET_SIZE, "Input file %s does not exist",input->infile);    
  }
  
  if (strlen (input->ReconFile) > 0 && (p_dec=fopen(input->ReconFile, "wb"))==NULL)
  {
    snprintf(errortext, ET_SIZE, "Error open file %s", input->ReconFile);    
  }

 

  if (input->slice_row_nr==0)
  {
	  input->slice_row_nr=input->img_height/16;
  }

  // frame/field consistency check

  // input intra period and Seqheader check Add cjw, 20070327
  if(input->seqheader_period!=0 && input->intra_period==0)
  {
	 if(input->intra_period==0)
		snprintf(errortext, ET_SIZE, "\nintra_period  should not equal %d when seqheader_period equal %d", input->intra_period,input->seqheader_period);
	 error (errortext, 400);
  }

  // input intra period and Seqheader check Add cjw, 20070327
  if(input->seqheader_period==0 && input->vec_period!=0)
  {
	 snprintf(errortext, ET_SIZE, "\nvec_period  should not equal %d when seqheader_period equal %d", input->intra_period,input->seqheader_period);
	 error (errortext, 400);
  }

  // Added by LiShao, Tsinghua, 20070327
  ProfileCheck();
  LevelCheck();
}

⌨️ 快捷键说明

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