📄 mae_fe_mcomp.c
字号:
if (src_y_y[1] == height_y_clip) dxy_y[1] &= ~12; // dxy_uv[0] is used to index into the leaf functions (mc??) // Since uv can only be on hpel boundaries, the only possible // leaf functions are mc00, mc20, mc02, or mc22 dxy_uv[0] = ((mvy[4] & 3) << 2) | (mvx[4] & 3); dxy_uv[0] = (s->codstyl) ? dxy_uv[0] : (dxy_uv[0] & 0xfffffffa); dxy_uv_e[0] = ((mvx[4] & 3) << 2) | (mvy[4] & 3); dxy_uv_e[0] = (s->codstyl) ? dxy_uv_e[0] : (dxy_uv_e[0] & 0xfffffffa); // src_[xy]_uv gives the location of the ref block for uv // xpos & ypos are in fpel units when referring to the luma (y) // since the chroma (uv) is sub-samples, xpos & ypos must be /2 // The mv's are in qpel units, so they must be shifted by 2 src_x_uv[0] = (s->xpos >> 1) + (mvx[4] >> 2); src_y_uv[0] = src_chroma_ypos + ((mvy[4] >> 2) << mvy_shift); // Clips so that ref block does not more than 8 pixels // outside of frame // EricS: This will have to change for out-of-frame pixels src_x_uv[0] = mae_clip(src_x_uv[0], uv_clip_min_x, linesize_uv_clip); if (src_x_uv[0] == (linesize_uv_clip)) dxy_uv[0] &= ~3; src_y_uv[0] = mae_clip(src_y_uv[0], uv_clip_min_y, height_uv_clip); if (src_y_uv[0] == height_uv_clip) dxy_uv[0] &= ~12; // dxy_uv[1] is used to index into the leaf functions (mc??) // Since uv can only be on hpel boundaries, the only possible // leaf functions are mc00, mc20, mc02, or mc22 dxy_uv[1] = ((mvy[6] & 3) << 2) | (mvx[6] & 3); dxy_uv[1] = (s->codstyl) ? dxy_uv[1] : (dxy_uv[1] & 0xfffffffa); dxy_uv_e[1] = ((mvx[6] & 3) << 2) | (mvy[6] & 3); dxy_uv_e[1] = (s->codstyl) ? dxy_uv_e[1] : (dxy_uv_e[1] & 0xfffffffa); // src_[xy]_uv gives the location of the ref block for uv // xpos & ypos are in fpel units when referring to the luma (y) // since the chroma (uv) is sub-samples, xpos & ypos must be /2 // The mv's are in qpel units, so they must be shifted by 2 src_x_uv[1] = (s->xpos >> 1) + (mvx[6] >> 2); src_y_uv[1] = src_chroma_ypos + ((mvy[6] >> 2) << mvy_shift); // Clips so that ref block does not more than 8 pixels // outside of frame // EricS: This will have to change for out-of-frame pixels src_x_uv[1] = mae_clip(src_x_uv[1], uv_clip_min_x, linesize_uv_clip); if (src_x_uv[1] == (linesize_uv_clip)) dxy_uv[1] &= ~3; src_y_uv[1] = mae_clip(src_y_uv[1], uv_clip_min_y, height_uv_clip); if (src_y_uv[1] == height_uv_clip) dxy_uv[1] &= ~12; // Get ypos for calculating oof src_y_y_oof[0] = (s->ps) ? src_y_y[0] : src_y_y[0] >> 1; src_y_y_oof[1] = (s->ps) ? src_y_y[1] : src_y_y[1] >> 1; src_y_uv_oof[0] = (s->ps) ? src_y_uv[0] : src_y_uv[0] >> 1; src_y_uv_oof[1] = (s->ps) ? src_y_uv[1] : src_y_uv[1] >> 1; // determines mbmode for each block mc_mode = 0; for(bn = 0; bn < exp_bc; bn++){ mc_mode |= (s->mbmode>>(14 - 2*bn)) & 0x3; } switch (mc_mode) { case MAE_MC_MODE_INTRA: MAE_ASSERT_MSG("Header Error: mc being called for INTRA mb\n"); break; case MAE_MC_MODE_FWD: // ********** Y (upper) ********** // avg is for bidirectional when the fwd and bwd pixels must be // averaged for the final reference pixel // bwd = 0 means fwd avg = 0; bwd = 0; // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Y (16x8, fwd)", src_x_y[0], src_y_y_oof[0], s->linesz, height_y, 48, ring_size_y, 16, 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_y = (s->fp && !s->ft) ? previous_y_bot : previous_y_top; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_y + src_y_y[0] * dst_linesize_y + src_x_y[0]; destptr = current_y + s->ypos * dst_linesize_y + s->xpos; // calls one of the mc?? leaf functions for upper luma (y upper) if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_y, linesize_y, 16, 8, avg, rnd, dxy_y_e[0], oof, 0, bwd, s->mbmode,s->mbtype, s->mcprec); else MAE_wmv9_vh_4t (destptr, ptr, linesize_y, linesize_y, 16, 8, avg, rnd, dxy_y_e[0], oof, 0, bwd, s->mbmode,s->mbtype, s->mcprec); // ********** Y (lower) ********** // avg is for bidirectional when the fwd and bwd pixels must be // averaged for the final reference pixel // bwd = 0 means fwd avg = 0; bwd = 0; // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Y (16x8, fwd)", src_x_y[1], (src_y_y_oof[1] + y_blk_offset), s->linesz, height_y, 48, ring_size_y, 16, 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_y = (s->fp && !s->fb) ? previous_y_bot : previous_y_top; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_y + (src_y_y[1] + y_blk_offset) * dst_linesize_y + src_x_y[1]; destptr = (s->ps) ? current_y + (s->ypos + 8) * dst_linesize_y + s->xpos : current_y + (s->ypos * dst_linesize_y) + dst_linesize_y + s->xpos; // calls one of the mc?? leaf functions for lower luma (y lower) if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_y, linesize_y, 16, 8, avg, rnd, dxy_y_e[1], oof, 2, bwd, s->mbmode,s->mbtype, s->mcprec); else MAE_wmv9_vh_4t (destptr, ptr, linesize_y, linesize_y, 16, 8, avg, rnd, dxy_y_e[1], oof, 2, bwd, s->mbmode,s->mbtype, s->mcprec); // ********** Cb (upper) ********** // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cb (16x8, fwd)", src_x_uv[0], src_y_uv_oof[0], s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // This needs to be changed such that cb has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cb = (s->fp && !s->ft) ? previous_cb_bot : previous_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] * dst_linesize_uv + src_x_uv[0]; destptr = current_cb + (chroma_ypos * dst_linesize_uv) + (s->xpos >> 1); // calls one of the mc?? leaf functions for first chroma (cb) if (!s->fp) { if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 8, avg, rnd, dxy_uv_e[0], 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[0], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv); } else { if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 4, avg, rnd, dxy_uv_e[0], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv); else MAE_wmv9_vh_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 4, avg, rnd, dxy_uv_e[0], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv); // ********** Cb (lower) ********** // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cb (16x8, fwd)", src_x_uv[1], (src_y_uv_oof[1] + uv_blk_offset), s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // This needs to be changed such that cb has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cb = (s->fp && !s->fb) ? previous_cb_bot : previous_cb_top; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_cb + (src_y_uv[1] + uv_blk_offset) * dst_linesize_uv + src_x_uv[1]; destptr = (s->ps) ? current_cb + (chroma_ypos + 4) * dst_linesize_uv + (s->xpos >> 1) : current_cb + (chroma_ypos * dst_linesize_uv) + dst_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, 4, 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, 4, avg, rnd, dxy_uv_e[1], oof, 4, bwd, s->mbmode,s->mbtype, s->mcprecuv); } // ********** Cr (upper) ********** // This needs to be changed such that cr has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cr = (s->fp && !s->ft) ? previous_cr_bot : previous_cr_top; // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cr (16x8, fwd)", src_x_uv[0], src_y_uv_oof[0], s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_cr + src_y_uv[0] * dst_linesize_uv + src_x_uv[0]; destptr = current_cr + (chroma_ypos * dst_linesize_uv) + (s->xpos >> 1); // calls one of the mc?? leaf functions for second chroma (cr) if (!s->fp) { 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); } else { if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 4, 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, 4, avg, rnd, dxy_uv_e[0], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv); // ********** Cr (lower) ********** // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cr (16x8, fwd)", src_x_uv[1], (src_y_uv_oof[1] + uv_blk_offset), s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // This needs to be changed such that cr has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cr = (s->fp && !s->fb) ? previous_cr_bot : previous_cr_top; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_cr + (src_y_uv[1] + uv_blk_offset) * dst_linesize_uv + src_x_uv[1]; destptr = (s->ps) ? current_cr + (chroma_ypos + 4) * dst_linesize_uv + (s->xpos >> 1) : current_cr + (chroma_ypos * dst_linesize_uv) + dst_linesize_uv + (s->xpos >> 1); // calls one of the mc?? leaf functions for first chroma (cr) if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 4, 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, 4, avg, rnd, dxy_uv_e[1], oof, 5, bwd, s->mbmode,s->mbtype, s->mcprecuv); } if (s->bc) { // ********** Cb1 (upper) ********** // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cb1 (16x8, fwd)", src_x_uv[0], src_y_uv_oof[0]+8, s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // This needs to be changed such that cb has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cb = (s->fp && !s->ft) ? previous_cb_bot : previous_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) * dst_linesize_uv + src_x_uv[0]; destptr = current_cb + ((chroma_ypos + 8) * dst_linesize_uv) + (s->xpos >> 1); // calls one of the mc?? leaf functions for first chroma (cb) if (!s->fp) { 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); } else { if (!s->codstyl) MAE_mpeg_hv_4t (destptr, ptr, linesize_uv, linesize_uv, 8, 4, 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, 4, avg, rnd, dxy_uv_e[0], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv); // ********** Cb1 (lower) ********** // Determine if reference block is out-of frame x_fwd_pixel[x_fwd_blk_in].oof = MAE_create_oof_mask("Cb1 (16x8, fwd)", src_x_uv[1], (src_y_uv_oof[1] + 8 + uv_blk_offset), s->linesz/2, height_uv, 24, ring_size_uv, 8, 4, s->codstyl); oof = x_fwd_pixel[x_fwd_blk_in].oof; // This needs to be changed such that cb has top & bottom field // Determine whether to use top/bot field only based on fp & ft previous_cb = (s->fp && !s->fb) ? previous_cb_bot : previous_cb_top; // ptr is the pointer to the reference block // destptr is the pointer to the destination block ptr = previous_cb + (src_y_uv[1] + 8 + uv_blk_offset) * dst_linesize_uv + src_x_uv[1]; destptr = (s->ps) ? current_cb + ((chroma_ypos + 12) * dst_linesize_uv) + (s->xpos >> 1) : current_cb + ((chroma_ypos + 8) * dst_linesize_uv) + dst_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, 4, 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, 4, avg, rnd, dxy_uv_e[1], oof, 6, bwd, s->mbmode,s->mbtype, s->mcprecuv); } // ********** Cr1 (upper) *******
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -