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

📄 mae_fe_mcomp.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 5 页
字号:
         // calls one of the mc?? leaf functions for first chroma (cb)         if (!s->codstyl)           MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv);         else           MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv);         // **********  Cr  **********         avg = 0; // only set for bidir to avg final pixel         bwd = 0; // bwd==0 means fwd         // Determine if reference block is out-of frame         x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cr (16x16, bi)", src_x_uv[0], src_y_uv[0], s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);         oof = x_fwd_pixel[x_fwd_blk_in].oof;         // Determine whether to use top/bot field only based on fp & ft         previous_cr = (s->fp && !s->ft) ? previous_cr_bot : previous_cr_top;         future_cr = (s->fp && !s->bt) ? future_cr_bot : future_cr_top;         // ptr is the pointer to the reference block         // destptr is the pointer to the destination block         ptr = previous_cr + src_y_uv[0] * linesize_uv + src_x_uv[0];         destptr = current_cr + (chroma_ypos * linesize_uv) + (s->xpos >> 1);         // calls one of the mc?? leaf functions for second chroma (cr)         if (!s->codstyl)           MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv);         else           MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv);         // Determine if reference block is out-of frame         x_bwd_pixel[x_bwd_blk_in].oof = MAE_create_oof_mask("Cr (16x16, bi)", src_x_uv[1], src_y_uv[1], s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);         oof = x_bwd_pixel[x_bwd_blk_in].oof;         // ptr is the pointer to the reference block         // destptr is the pointer to the destination block and does not change         ptr = future_cr + src_y_uv[1] * linesize_uv + src_x_uv[1];         // We are now finding a reference block from the BWD frame and we are averaging         // this result with the result from the previous function call         avg = 1;         bwd = 1;         // calls one of the mc?? leaf functions for second chroma (cr)         if (!s->codstyl)           MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv);         else           MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv);         if (s->bc) {           // **********  Cb1  **********           avg = 0; // only set for bidir to avg final pixel           bwd = 0; // bwd==0 means fwd             // Determine if reference block is out-of frame           x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cb1 (16x16, bi)", src_x_uv[0], src_y_uv[0]+8, s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);           oof = x_fwd_pixel[x_fwd_blk_in].oof;           // Determine whether to use top/bot field only based on fp & ft           previous_cb = (s->fp && !s->ft) ? previous_cb_bot : previous_cb_top;           future_cb = (s->fp && !s->bt) ? future_cb_bot : future_cb_top;             // ptr is the pointer to the reference block           // destptr is the pointer to the destination block           ptr = previous_cb + (src_y_uv[0] + 8) * linesize_uv + src_x_uv[0];           destptr = current_cb + ((chroma_ypos + 8) * linesize_uv) + (s->xpos >> 1);             // calls one of the mc?? leaf functions for first chroma (cb)           if (!s->codstyl)             MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv);           else             MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv);             // We are now finding a reference block from the BWD frame and we are averaging           // this result with the result from the previous function call           avg = 1;           bwd = 1;             // Determine if reference block is out-of frame           x_bwd_pixel[x_bwd_blk_in].oof = MAE_create_oof_mask("Cb1 (16x16, bi)", src_x_uv[1], src_y_uv[1]+8, s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);           oof = x_bwd_pixel[x_bwd_blk_in].oof;           // ptr is the pointer to the reference block           // destptr is the pointer to the destination block and does not change           ptr = future_cb + (src_y_uv[1] + 8) * linesize_uv + src_x_uv[1];             // calls one of the mc?? leaf functions for first chroma (cb)           if (!s->codstyl)             MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv);           else             MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv);             // **********  Cr1  **********           avg = 0; // only set for bidir to avg final pixel           bwd = 0; // bwd==0 means fwd             // Determine if reference block is out-of frame           x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cr1 (16x16, bi)", src_x_uv[0], src_y_uv[0]+8, s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);           oof = x_fwd_pixel[x_fwd_blk_in].oof;           // Determine whether to use top/bot field only based on fp & ft           previous_cr = (s->fp && !s->ft) ? previous_cr_bot : previous_cr_top;           future_cr = (s->fp && !s->bt) ? future_cr_bot : future_cr_top;             // ptr is the pointer to the reference block           // destptr is the pointer to the destination block           ptr = previous_cr + (src_y_uv[0] + 8) * linesize_uv + src_x_uv[0];           destptr = current_cr + ((chroma_ypos + 8) * linesize_uv) + (s->xpos >> 1);             // calls one of the mc?? leaf functions for second chroma (cr)           if (!s->codstyl)             MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 7, bwd, s->mbmode,s->mbtype, s->mcprecuv);           else             MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], oof, 7, bwd, s->mbmode,s->mbtype, s->mcprecuv);             // We are now finding a reference block from the BWD frame and we are averaging           // this result with the result from the previous function call           avg = 1;           bwd = 1;             // Determine if reference block is out-of frame           x_bwd_pixel[x_bwd_blk_in].oof = MAE_create_oof_mask("Cr1 (16x16, bi)", src_x_uv[1], src_y_uv[1]+8, s->linesz>>1, height_uv, 24, ring_size_uv, 8, 8, s->codstyl);           oof = x_bwd_pixel[x_bwd_blk_in].oof;           // ptr is the pointer to the reference block           // destptr is the pointer to the destination block and does not change           ptr = future_cr + (src_y_uv[1] + 8) * linesize_uv + src_x_uv[1];             // calls one of the mc?? leaf functions for second chroma (cr)           if (!s->codstyl)             MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 7, bwd, s->mbmode,s->mbtype, s->mcprecuv);           else             MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[1], oof, 7, bwd, s->mbmode,s->mbtype, s->mcprecuv);         } // if (s->bc)         break;    default:         MAE_ASSERT_MSG("Header Error: mbmode/mc_mode out of range\n");  }}void MAE_motion_16x8(MAEContext *s) {  uint32 mc_mode;  int mvx[8], mvy[8];  uint8 *ptr,*destptr;  int rnd,avg,qpel,bwd,qpeluv;  int dxy_y[4], dxy_uv[4];  uint8 dxy_y_e[4], dxy_uv_e[4];  int src_y_y_oof[4],src_y_uv_oof[4];  int linesize_y,linesize_uv;  int dst_linesize_y,dst_linesize_uv;  int linesize_y_clip,linesize_uv_clip;  int y_clip_min_y, uv_clip_min_y;  int y_clip_min_x, uv_clip_min_x;  int height_y_clip,height_uv_clip;  int height_y,height_uv;  int ring_size_y,ring_size_uv;  uint32 bn;  uint32 exp_bc;  int chroma_ypos;  uint64 oof;  int src_ypos, src_chroma_ypos;  int y_blk_offset;  int uv_blk_offset;  int mvy_shift;  uint8 * previous_y;  uint8 * previous_cb;  uint8 * previous_cr;  uint8 * future_y;  uint8 * future_cb;  uint8 * future_cr;  // For pointing to global structure so don't have to change code  // Okay to copy here since malloc'ed if necessary in mae_fe before call  uint8 *current_y       = gCM.cur_y_oof;  uint8 *current_cb      = gCM.cur_cb_oof;  uint8 *current_cr      = gCM.cur_cr_oof;  uint8 *previous_y_top  = (s->fp) ? gCM.prev_y_top_oof_fp1 : gCM.prev_y_top_oof_fp0;  uint8 *previous_cb_top = (s->fp) ? gCM.prev_cb_top_oof_fp1 : gCM.prev_cb_top_oof_fp0;  uint8 *previous_cr_top = (s->fp) ? gCM.prev_cr_top_oof_fp1 : gCM.prev_cr_top_oof_fp0;  uint8 *future_y_top    = (s->fp) ? gCM.fut_y_top_oof_fp1 : gCM.fut_y_top_oof_fp0;  uint8 *future_cb_top   = (s->fp) ? gCM.fut_cb_top_oof_fp1 : gCM.fut_cb_top_oof_fp0;  uint8 *future_cr_top   = (s->fp) ? gCM.fut_cr_top_oof_fp1 : gCM.fut_cr_top_oof_fp0;  uint8 *previous_y_bot  = (s->fp) ? gCM.prev_y_bot_oof_fp1 : gCM.prev_y_bot_oof_fp0;  uint8 *previous_cb_bot = (s->fp) ? gCM.prev_cb_bot_oof_fp1 : gCM.prev_cb_bot_oof_fp0;  uint8 *previous_cr_bot = (s->fp) ? gCM.prev_cr_bot_oof_fp1 : gCM.prev_cr_bot_oof_fp0;  uint8 *future_y_bot    = (s->fp) ? gCM.fut_y_bot_oof_fp1 : gCM.fut_y_bot_oof_fp0;  uint8 *future_cb_bot   = (s->fp) ? gCM.fut_cb_bot_oof_fp1 : gCM.fut_cb_bot_oof_fp0;  uint8 *future_cr_bot   = (s->fp) ? gCM.fut_cr_bot_oof_fp1 : gCM.fut_cr_bot_oof_fp0;       // If 4:2:2, use 8 blocks, otherwise 6 blocks  exp_bc = s->bc ? 8 : 6;  // the "- 24" is needed because of the out-of-frame calc  chroma_ypos = (s->fp && s->ps) ? (s->ypos - 12) : (s->ypos - 24);  chroma_ypos = s->bc ? chroma_ypos : (s->ypos >> 1);  // Set values for rnd and qpel  rnd = s->rndctl;  qpel = (s->mcprec == MAE_QUARTER_PEL) ? 1 : 0;  qpeluv = ((s->mcprecuv == MAE_QUARTER_PEL) & (s->codstyl)) ? 1 : 0;  height_y = s->height;  height_uv = (s->bc) ? (s->height - 48) : height_y >> 1;  // Set linesize & height  // Linesize & height are half for chroma  linesize_y_clip = (s->linesz - 18);  linesize_uv_clip = (s->linesz >> 1) - 10;  height_y_clip = (s->height - 10);  height_uv_clip = (height_uv - 10);  y_clip_min_y = (s->codstyl) ? 32 : 1;  uv_clip_min_y = (s->codstyl) ? 16 : 1;  y_clip_min_x = (s->codstyl) ? 40 : 1;  uv_clip_min_x = (s->codstyl) ? 16 : 1;  height_y = (s->fp) ? (height_y >> 1) : height_y;  height_uv = (s->fp) ? (height_uv >> 1) : height_uv;  linesize_y = (s->fp) ? (s->linesz << 1) : s->linesz;  linesize_uv = (s->fp) ? (s->linesz) : (s->linesz>>1);  dst_linesize_y = (s->ps) ? linesize_y : (linesize_y >> 1);  dst_linesize_uv = (s->ps) ? linesize_uv : (linesize_uv >> 1);  src_ypos = s->ypos;  src_chroma_ypos = chroma_ypos;  y_blk_offset = (s->ps) ? 8 : 0;  uv_blk_offset = (s->ps) ? 4 : 0;  mvy_shift = (s->ps) ? 0 : 1;  ring_size_uv = (s->fp) ? 12 : 24;  ring_size_y = (s->fp) ? 24 : 48;  // Fetch motion vectors  // For 16x8, we get 4 luma mv's and 2 chroma mv's  MAE_Get_4MV(s, mvx, mvy);  // dxy_y[0] is used to index into the leaf functions (mc??)  // At this point, mvy & mvx are in qpel units.  // By masking and shifting, you get the mc?? value  dxy_y[0] = ((mvy[0] & 3) << 2) | (mvx[0] & 3);  dxy_y[1] = ((mvy[2] & 3) << 2) | (mvx[2] & 3);  dxy_y_e[0] = ((mvx[0] & 3) << 2) | (mvy[0] & 3);  dxy_y_e[1] = ((mvx[2] & 3) << 2) | (mvy[2] & 3);  // src_[xy]_y gives the location of the ref block for y  src_x_y[0] = s->xpos + (mvx[0] >> 2);  src_y_y[0] = src_ypos + ((mvy[0] >> 2) << mvy_shift);  // Clips so that ref block does not more than 16 pixels  // outside of frame  // EricS:  This will have to change for out-of-frame pixels  src_x_y[0] = mae_clip(src_x_y[0], y_clip_min_x, linesize_y_clip);    if (src_x_y[0] == linesize_y_clip)    dxy_y[0] &= ~3;  src_y_y[0] = mae_clip(src_y_y[0], y_clip_min_y, height_y_clip);  if (src_y_y[0] == height_y_clip)    dxy_y[0] &= ~12;  // src_[xy]_y gives the location of the ref block for y  src_x_y[1] = s->xpos + (mvx[2] >> 2);  src_y_y[1] = src_ypos + ((mvy[2] >> 2) << mvy_shift);  // Clips so that ref block does not more than 16 pixels  // outside of frame  // EricS:  This will have to change for out-of-frame pixels  src_x_y[1] = mae_clip(src_x_y[1], y_clip_min_x, linesize_y_clip);    if (src_x_y[1] == linesize_y_clip)    dxy_y[1] &= ~3;  src_y_y[1] = mae_clip(src_y_y[1], y_clip_min_y, height_y_clip);

⌨️ 快捷键说明

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