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

📄 mae_fe.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 5 页
字号:
    // just in case the last macroblock is an Intra, but we had non-Intra    // macroblocks in the frame before#ifdef HAVE_MAE    s.fwd_y_top_ptr	= (uint32) forward_y_top_ptr;    s.fwd_cb_top_ptr	= (uint32) forward_cb_top_ptr;    s.fwd_cr_top_ptr	= (uint32) forward_cr_top_ptr;    s.fwd_y_bot_ptr	= (uint32) forward_y_bot_ptr;    s.fwd_cb_bot_ptr	= (uint32) forward_cb_bot_ptr;    s.fwd_cr_bot_ptr	= (uint32) forward_cr_bot_ptr;    s.bwd_y_top_ptr	= (uint32) backward_y_top_ptr;    s.bwd_cb_top_ptr	= (uint32) backward_cb_top_ptr;    s.bwd_cr_top_ptr	= (uint32) backward_cr_top_ptr;    s.bwd_y_bot_ptr	= (uint32) backward_y_bot_ptr;    s.bwd_cb_bot_ptr	= (uint32) backward_cb_bot_ptr;    s.bwd_cr_bot_ptr	= (uint32) backward_cr_bot_ptr;#else    s.fwd_y_top_ptr	= mae_fe_cfg->fwd_y_top_ptr;    s.fwd_cb_top_ptr	= mae_fe_cfg->fwd_cb_top_ptr;    s.fwd_cr_top_ptr	= mae_fe_cfg->fwd_cr_top_ptr;    s.fwd_y_bot_ptr	= mae_fe_cfg->fwd_y_bot_ptr;    s.fwd_cb_bot_ptr	= mae_fe_cfg->fwd_cb_bot_ptr;    s.fwd_cr_bot_ptr	= mae_fe_cfg->fwd_cr_bot_ptr;    s.bwd_y_top_ptr	= mae_fe_cfg->bwd_y_top_ptr;    s.bwd_cb_top_ptr	= mae_fe_cfg->bwd_cb_top_ptr;    s.bwd_cr_top_ptr	= mae_fe_cfg->bwd_cr_top_ptr;    s.bwd_y_bot_ptr	= mae_fe_cfg->bwd_y_bot_ptr;    s.bwd_cb_bot_ptr	= mae_fe_cfg->bwd_cb_bot_ptr;    s.bwd_cr_bot_ptr	= mae_fe_cfg->bwd_cr_bot_ptr;#endif  };  //loop through the blocks in the MB;   for(bn = 0; bn < exp_bc; bn++){    RTL_printf("\n\n.------------.\n| Block %d    |\n`------------'\n",bn);    // create mbmode based on block    blk_mbmode = (mb_in->mbmode>>(14 - 2*bn)) & 0x3;    blk_xformsize = (mb_in->xformsize>>(14 - 2*bn)) & 0x3;    // For prototyping, keep track if fwd or bwd are done    if ((blk_mbmode == 0x1) || (blk_mbmode == 0x3)) any_fwd = 1;    if ((blk_mbmode == 0x2) || (blk_mbmode == 0x3)) any_bwd = 1;    // keep track of which 8x8s are Intra for Overlap Smoothing filer    if(bn < 4) {      i = ((mb_in->ypos/8 + (bn>>1))*mae_fe_cfg->linesiz/8) + (mb_in->xpos/8) + (bn & 0x1);      xmotiony[i] = (blk_mbmode == 0x0) ? MAE_IBLOCKMV : mb_in->mv[bn] >> 16;      ymotiony[i] = (blk_mbmode == 0x0) ? MAE_IBLOCKMV : mb_in->mv[bn] & 0xffff;    } else {      i = (mb_in->ypos/16*mae_fe_cfg->linesiz/16) + (mb_in->xpos/16);      xmotionc[i] = (blk_mbmode == 0x0) ? MAE_IBLOCKMV : mb_in->mv_uv[0] >> 16;      ymotionc[i] = (blk_mbmode == 0x0) ? MAE_IBLOCKMV : mb_in->mv_uv[0] & 0xffff;    }    // create default block of 0's    for(i = 0; i < 64; i++) non_cb[i] = 0;     // Get block data unless cbp is set to 0 for block    // If cbp is 0 for block, use default block of 0's    if (((mb_in->cbp >> (7-bn)) & 0x1) == 0) block = non_cb;    else if(bn == 0) block = mb_in->blk_data0;    else if (bn == 1) block = mb_in->blk_data1;    else if (bn == 2) block = mb_in->blk_data2;    else if (bn == 3) block = mb_in->blk_data3;    else if (bn == 4) block = mb_in->blk_data4;    else if (bn == 5) block = mb_in->blk_data5;    else if (bn == 6) block = mb_in->blk_data6;    else if (bn == 7) block = mb_in->blk_data7;    else {      block = mb_in->blk_data0;      printf("ERROR: Invalid block number\n");    }    RTL_printf("\n\nIQ non-fixed point input Block:%d\n",bn);     for (x = 0; x < 8; x++) {      RTL_printf("%x \t%x \t%x \t%x \t%x \t%x \t%x \t%x \n",         block[(x*8)+0], block[(x*8)+1], block[(x*8)+2], block[(x*8)+3],         block[(x*8)+4], block[(x*8)+5], block[(x*8)+6], block[(x*8)+7]);     }    //convert block data to fixed point notation    for(c=0; c<64; c++){      fixed_point_block[c] = fixed_sign_extend(double_to_fixed((double)block[c]));    }    RTL_printf("\n\nIQ fixed point input Block:%d\n",bn);     for (x = 0; x < 8; x++) {      RTL_printf("%llx %llx %llx %llx %llx %llx %llx %llx \n",         fixed_point_block[(x*8)+0], fixed_point_block[(x*8)+1],         fixed_point_block[(x*8)+2], fixed_point_block[(x*8)+3],         fixed_point_block[(x*8)+4], fixed_point_block[(x*8)+5],         fixed_point_block[(x*8)+6], fixed_point_block[(x*8)+7]);     }        //need to pick the propper weighting matrix    if((bn<=3) && blk_mbmode==MBM_INTRA)       wm = wm_intra_y;    else if((bn<=3) && ( (blk_mbmode==MBM_FORWARD) || (blk_mbmode==MBM_BACKWARD) || (blk_mbmode==MBM_BIDIRECTIONAL) ) )      wm = wm_inter_y;    else if((bn>3) && blk_mbmode==MBM_INTRA)      wm = wm_intra_c;    else if((bn>3) && ( (blk_mbmode==MBM_FORWARD) || (blk_mbmode==MBM_BACKWARD) || (blk_mbmode==MBM_BIDIRECTIONAL) ) )      wm = wm_inter_c;    else {      wm = wm_intra_y;      printf("ERROR: Invalid weighing matrix selection\n");    }    // Obviously, this function performs the inverse quantization    perform_iquant(mae_fe_cfg, mb_in, fixed_point_block, bn, wm, blk_mbmode);#ifndef HAVE_MAE#ifdef REF_WMV9	if(nFrameType == IFRAME)	{		for(c=0; c<64; c++)				iquant_output[c] = (int)fixed_to_double(fixed_point_block[c]);	}	else 	{		for(c=0; c<64; c++)				iquant_output_16[c] = (int16)fixed_to_double(fixed_point_block[c]);	}	// Initialize some stuff for the intermediate checkers  	// ***************************************************  	// Increment the macro block number whenever we hit block number 0!!  	MAEBlkChecks.nMB		  = mb_num;       // increment the block number to match the _LUMA_BLOCK defines     MAEBlkChecks.nBlkType      = bn + 1;       if(nFrameType == IFRAME)  {      MAEBlkChecks.nOutputType    = IQUANT_DONE;      MAEBlkChecks.blk_after_iquant = iquant_output; // output of IQUANT  }    else  {      MAEBlkChecks.nOutputType    = IQUANT_DONE_16_BIT;      MAEBlkChecks.blk_after_iquant_16bit = iquant_output_16; // output of IQUANT  }#elif REF_MPEG2    // Perform the reverse operation here so that we get back 8-bit pointers.    // Needed to update the text file    for(c=0; c<64; c++)    {      iquant_output[c] = (int)fixed_to_double(fixed_point_block[c]);    }      // Initialize some stuff for the intermediate checkers    // ***************************************************    // Increment the macro block number whenever we hit block number 0!!    MAEBlkChecks.nMB      = mb_num;   	// increment the block number to match the _LUMA_BLOCK defines   	MAEBlkChecks.nBlkType		  = bn + 1; 	  	MAEBlkChecks.nOutputType	  = IQUANT_DONE;  	MAEBlkChecks.blk_after_iquant = iquant_output; // output of IQUANT	if (((mb_in->cbp >> (7-bn)) & 0x1) == 0)		MAEBlkChecks.bBlockCoded = BLOCK_NOT_CODED;	else		MAEBlkChecks.bBlockCoded = BLOCK_CODED;	MAEBlkChecks.nIntraWithinInter =	MAEBlkChecks.nStepSize		   = 0;#elif REF_DIVX    // Perform the reverse operation here so that we get back 8-bit pointers.    // Needed to update the text file    for(c=0; c<64; c++)          iquant_output_16[c] = (int16)fixed_to_double(fixed_point_block[c]);      // Initialize some stuff for the intermediate checkers    // ***************************************************    // Increment the macro block number whenever we hit block number 0!!    MAEBlkChecks.nMB      = mb_num;       // increment the block number to match the _LUMA_BLOCK defines     MAEBlkChecks.nBlkType		= bn + 1;       MAEBlkChecks.nOutputType    = IQUANT_DONE_16_BIT;    MAEBlkChecks.blk_after_iquant_16bit = iquant_output_16; // output of IQUANT#else //MPEG4    // Perform the reverse operation here so that we get back 8-bit pointers.    // Needed to update the text file    for(c=0; c<64; c++)    {      iquant_output[c] = (int)fixed_to_double(fixed_point_block[c]);    }      // Initialize some stuff for the intermediate checkers    // ***************************************************    // Increment the macro block number whenever we hit block number 0!!    MAEBlkChecks.nMB      = mb_num;     //  if (!bn)    //    MAEBlkChecks.nMB      = nMAEBlockNum++;       // increment the block number to match the _LUMA_BLOCK defines     MAEBlkChecks.nBlkType      = bn + 1;       MAEBlkChecks.nOutputType    = IQUANT_DONE;    MAEBlkChecks.blk_after_iquant = iquant_output; // output of IQUANT    MAEBlkChecks.nIntraWithinInter = mae_fe_cfg->bTrueInterP;#endif	    sprintf(szFrameNum, "%d", nFrameNum);      // Intermediate Checking stuff after IQUANT is done with the CModel    // ****************************************************************    memset(szFileName, 0, MAX_FILE_SIZE);  // if we are not doing pure intra, then we need  // to dump the inter file with zeros!!  if (!bPureIntra && ((nFrameType == PFRAME) || (nFrameType == BFRAME)))  {    strcpy(szFileName, FILE_AFTER_INTRA_IQUANT);  }  // check what frame type we are processing  else  {      if (nFrameType == PFRAME)        strcpy(szFileName, FILE_AFTER_INTER_P_IQUANT);      else if(nFrameType == BFRAME)        strcpy(szFileName, FILE_AFTER_INTER_B_IQUANT);      else if(nFrameType == IFRAME)        strcpy(szFileName, FILE_AFTER_INTRA_IQUANT);  }        strcat(szFileName, szFrameNum);    strcat(szFileName, MAE_FILE_EXTENSION);  // Dump the IQUANT output to the file only   // if this  MB is coded for MPEG1/2/4  // ****************************************    if(!mae_fe_cfg->codstyl)  {    if(mb_in->cbp)      InterChecksOnBlock(&MAEBlkChecks, szFileName);  }  // Do it always for WMV9  // *********************  else  {#ifdef REF_WMV9    MAEBlkChecks.nDeadZone = nDeadZone;#endif    InterChecksOnBlock(&MAEBlkChecks, szFileName);  }#endif    RTL_printf("\n\nIDCT fixed point input Block:%d\n",bn);     for (x = 0; x < 8; x++) {      RTL_printf("%llx \t%llx \t%llx \t%llx \t%llx \t%llx \t%llx \t%llx \n",         fixed_point_block[(x*8)+0], fixed_point_block[(x*8)+1],         fixed_point_block[(x*8)+2], fixed_point_block[(x*8)+3],         fixed_point_block[(x*8)+4], fixed_point_block[(x*8)+5],         fixed_point_block[(x*8)+6], fixed_point_block[(x*8)+7]);     }// Need to add this and remove similar code below xform calls    // For deblocking.  If block is all zeros, set m_rgbCodedBlockPattern2 = 0    sb0 = 0;    sb1 = 0;    sb2 = 0;    sb3 = 0;    // For deblocking.  If block is all zeros, set m_rgbCodedBlockPattern2 = 0  	for(i = 0; i < 4; i++)   	{    	  for(j = 0; j < 4; j++)   	  {        if(blk_xformsize == 3) { //4x4  		    sb0 |= (fixed_point_block[(i*4)+j] != 0);   		    sb1 |= (fixed_point_block[16+(i*4)+j] != 0);   		    sb2 |= (fixed_point_block[32+(i*4)+j] != 0);   		    sb3 |= (fixed_point_block[48+(i*4)+j] != 0);         } else if (blk_xformsize == 2) { //4x8  		    sb0 |= (fixed_point_block[(i*4)+j] != 0);   		    sb1 |= (fixed_point_block[32+(i*4)+j] != 0);   		    sb2 |= (fixed_point_block[16+(i*4)+j] != 0);   		    sb3 |= (fixed_point_block[48+(i*4)+j] != 0);         } else { //8x8 & 8x4          // If it is an Intra block, ignore the DC coeff           if(blk_mbmode == 0) {            if (i || j) 		          sb0 |= (fixed_point_block[(i*8)+j] != 0);           } else {  		      sb0 |= (fixed_point_block[(i*8)+j] != 0);           }  		    sb1 |= (fixed_point_block[(i*8)+j+4] != 0);   		    sb2 |= (fixed_point_block[((i+4)*8)+j] != 0);   		    sb3 |= (fixed_point_block[((i+4)*8)+j+4] != 0);         }  	  }  	}

⌨️ 快捷键说明

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