📄 umc_mpeg2_dec_mc.cpp
字号:
} break; case IPPVC_MC_16X8: for(r = 0; r < pMacro->motion_vector_count; r++) { pMacro->vector_luma[4*r + 3] = (pMacro->vector[4*r + 3] >> 1) << 1; pMacro->vector_luma[4*r + 2] = pMacro->vector[4*r + 2] >> 1; pMacro->vector_chroma[4*r + 3] = (pMacro->vector[4*r + 3] >> 1) << 1;//down pMacro->vector_chroma[4*r + 2] = pMacro->vector[4*r + 2] >> 2;//right offs = (pMacro->vector_chroma[4*r + 3] + pMacro->row_c + pMacro->motion_vertical_field_select[2*r+1])*pitch_uv + pMacro->vector_chroma[4*r + 2] + pMacro->col_c; flag1 = ((pMacro->vector[4*r + 2] & 1) << 3) | ((pMacro->vector[4*r + 3] & 1) << 2); flag2 = ((pMacro->vector[4*r + 2] & 2) << 2) | ((pMacro->vector[4*r + 3] & 1) << 2); i = ippiMC16x8_8u_C1( ref_Y_data + (pMacro->vector_luma[4*r + 3] + pMacro->row_l + 16*r + pMacro->motion_vertical_field_select[2*r+1])*pitch_y + pMacro->vector_luma[4*r + 2] + pMacro->col_l, pitch_y_2, diff+128*r,32, video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].Y_comp_data + pMacro->offset_l + pMacro->shift_y[r] + pMacro->odd_pitch_y, pitch_y_2, flag1, 0); VM_ASSERT(i == ippStsOk); i = ippiMC8x8_8u_C1( ref_U_data + offs + 8 * r * pitch_uv, pitch_uv_2, diff+256+64*r,16, video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].U_comp_data + pMacro->offset_c + pMacro->shift_uv[r] + pMacro->odd_pitch_uv, pitch_uv_2, flag2, 0); VM_ASSERT(i == ippStsOk); i = ippiMC8x8_8u_C1( ref_V_data + offs + 8 * r * pitch_uv, pitch_uv_2, diff+384+64*r,16, video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].V_comp_data + pMacro->offset_c + pMacro->shift_uv[r] + pMacro->odd_pitch_uv, pitch_uv_2, flag2, 0); VM_ASSERT(i == ippStsOk); }//for(r) } }}//mc_mp2_422void MPEG2VideoDecoderBase::mc_mp2_444(short* /*diff*/, int /*threadID*/){}//mc_mp2_444void MPEG2VideoDecoderBase::mc_mp2_420b_frame_skip(short* diff, int threadID){ IppVideoContext* video = &Video[threadID]; sMacroblock *pMacro = &Video[threadID].macroblock; sSlice *pSlice = &Video[threadID].slice; Ipp8u *ref_Y_data1, *ref_U_data1; Ipp8u *ref_Y_data2, *ref_U_data2; Ipp8u *ref_Y_data3, *ref_U_data3; Ipp8u *ref_Y_data4, *ref_U_data4; Ipp8u *cur_Y_data, *cur_U_data; // Used when U & V not merged Ipp8u *ref_V_data1 = 0, *ref_V_data2 = 0, *ref_V_data3 = 0, *ref_V_data4 = 0, *cur_V_data = 0; unsigned int flag1, flag2, flag3, flag4; int offs_uv1, offs_uv2, offs_y1, offs_y2; unsigned int pitch_Y, pitch_UV; unsigned int pitch_Y_2, pitch_UV_2; int i; ref_Y_data1 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].Y_comp_data; ref_U_data1 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].U_comp_data; ref_Y_data2 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].Y_comp_data; ref_U_data2 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].U_comp_data; ref_Y_data3 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].Y_comp_data; ref_U_data3 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].U_comp_data; ref_Y_data4 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].Y_comp_data; ref_U_data4 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].U_comp_data; cur_Y_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].Y_comp_data; cur_U_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].U_comp_data; cur_V_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].V_comp_data; ref_V_data1 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].V_comp_data; ref_V_data2 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].V_comp_data; ref_V_data3 = video->frame_buffer.frame_p_c_n[video->frame_buffer.prev_index].V_comp_data; ref_V_data4 = video->frame_buffer.frame_p_c_n[video->frame_buffer.next_index].V_comp_data; pitch_Y = video->frame_buffer.Y_comp_pitch; pitch_UV = video->frame_buffer.U_comp_pitch; pitch_Y_2 = video->frame_buffer.Y_comp_pitch << 1; pitch_UV_2 = video->frame_buffer.U_comp_pitch << 1; cur_Y_data += pMacro->offset_l; cur_U_data += pMacro->offset_c; cur_V_data += pMacro->offset_c; if(pMacro->prediction_type == IPPVC_MC_FRAME) { CALC_OFFSETS_FRAME(offs_y1, offs_uv1, flag1, flag2, pMacro->vector[0], pMacro->vector[1], HP_FLAG_MC) CALC_OFFSETS_FRAME(offs_y2, offs_uv2, flag3, flag4, pMacro->vector[2], pMacro->vector[3], HP_FLAG_MC) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { FUNC_MCB(16, 16, Frame, ref_Y_data1 + offs_y1, pitch_Y, flag1, ref_Y_data2 + offs_y2, pitch_Y, flag3, diff, 32, cur_Y_data, pitch_Y, 0); FUNC_MCB(8, 8, Frame, ref_U_data1 + offs_uv1, pitch_UV, flag2, ref_U_data2 + offs_uv2, pitch_UV, flag4, diff + 256, 16, cur_U_data, pitch_UV, 0); FUNC_MCB(8, 8, Frame, ref_V_data1 + offs_uv1, pitch_UV, flag2, ref_V_data2 + offs_uv2, pitch_UV, flag4, diff + 320, 16, cur_V_data, pitch_UV, 0); cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; offs_y2 += 16; offs_uv2 += 8; } } else { CALC_OFFSETS_FIELD(offs_y1, offs_uv1, flag1, flag2, pMacro->vector[0], pMacro->vector[1], pMacro->motion_vertical_field_select[0], HP_FLAG_MC) CALC_OFFSETS_FIELD(offs_y2, offs_uv2, flag3, flag4, pMacro->vector[2], pMacro->vector[3], pMacro->motion_vertical_field_select[1], HP_FLAG_MC) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { FUNC_MCB(16, 8, FieldDCT, ref_Y_data1 + offs_y1, pitch_Y_2, flag1, ref_Y_data2 + offs_y2, pitch_Y_2, flag3, diff, 64, cur_Y_data, pitch_Y_2, 0); FUNC_MCB(8, 4, FieldDCT, ref_U_data1 + offs_uv1, pitch_UV_2, flag2, ref_U_data2 + offs_uv2, pitch_UV_2, flag4, diff + 256, 32, cur_U_data, pitch_UV_2, 0); FUNC_MCB(8, 4, FieldDCT, ref_V_data1 + offs_uv1, pitch_UV_2, flag2, ref_V_data2 + offs_uv2, pitch_UV_2, flag4, diff + 320, 32, cur_V_data, pitch_UV_2, 0); cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; offs_y2 += 16; offs_uv2 += 8; } if( pMacro->motion_vector_count == 2) { CALC_OFFSETS_FIELD(offs_y1, offs_uv1, flag1, flag2, pMacro->vector[4], pMacro->vector[5], pMacro->motion_vertical_field_select[2], HP_FLAG_MC) CALC_OFFSETS_FIELD(offs_y2, offs_uv2, flag3, flag4, pMacro->vector[6], pMacro->vector[7], pMacro->motion_vertical_field_select[3], HP_FLAG_MC) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { FUNC_MCB(16, 8, FieldDCT, ref_Y_data1 + offs_y1, pitch_Y_2, flag1, ref_Y_data2 + offs_y2, pitch_Y_2, flag3, diff + 16, 64, cur_Y_data + pitch_Y, pitch_Y_2, 0); FUNC_MCB(8, 4, FieldDCT, ref_U_data1 + offs_uv1, pitch_UV_2, flag2, ref_U_data2 + offs_uv2, pitch_UV_2, flag4, diff + 256 + 8, 32, cur_U_data + pitch_UV , pitch_UV_2, 0); FUNC_MCB(8, 4, FieldDCT, ref_V_data1 + offs_uv1, pitch_UV_2, flag2, ref_V_data2 + offs_uv2, pitch_UV_2, flag4, diff + 320 + 8, 32, cur_V_data + pitch_UV, pitch_UV_2, 0); cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; offs_y2 += 16; offs_uv2 += 8; } } }}void MPEG2VideoDecoderBase::mc_mp2_420_frame_skip(int threadID){ IppVideoContext *video = &Video[threadID]; sMacroblock *pMacro = &Video[threadID].macroblock; int ref_index = (pMacro->macroblock_motion_backward) ? video->frame_buffer.next_index : video->frame_buffer.prev_index; Ipp8u *ref_Y_data = video->frame_buffer.frame_p_c_n[ref_index].Y_comp_data; Ipp8u *ref_U_data = video->frame_buffer.frame_p_c_n[ref_index].U_comp_data; Ipp8u *ref_V_data = video->frame_buffer.frame_p_c_n[ref_index].V_comp_data; Ipp8u *cur_Y_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].Y_comp_data; Ipp8u *cur_U_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].U_comp_data; Ipp8u *cur_V_data = video->frame_buffer.frame_p_c_n[video->frame_buffer.curr_index].V_comp_data; unsigned int pitch_Y = video->frame_buffer.Y_comp_pitch; unsigned int pitch_UV = video->frame_buffer.U_comp_pitch; unsigned int pitch_Y_2 = video->frame_buffer.Y_comp_pitch << 1; unsigned int pitch_UV_2 = video->frame_buffer.U_comp_pitch << 1; unsigned int flag1, flag2; int offs_uv1, offs_y1; short *vector = pMacro->vector; sSlice *pSlice = &Video[threadID].slice; IppiSize roi = {16*(pSlice->mb_address_increment - 1), 16}; int i; cur_Y_data += pMacro->offset_l; cur_U_data += pMacro->offset_c; cur_V_data += pMacro->offset_c; if (pMacro->macroblock_motion_backward) vector += 2; if (PictureHeader.picture_coding_type == P_FRAME) { if(PictureHeader.picture_structure != FRAME_PICTURE) { if(PictureHeader.picture_structure == BOTTOM_FIELD) { cur_Y_data += pitch_Y; cur_U_data += pitch_UV; cur_V_data += pitch_UV; } pitch_Y <<= 1; pitch_UV <<= 1; } ippiCopy_8u_C1R( ref_Y_data, pitch_Y, cur_Y_data, pitch_Y, roi ); roi.height >>= 1; roi.width >>= 1; ippiCopy_8u_C1R(ref_U_data, pitch_UV, cur_U_data, pitch_UV, roi); ippiCopy_8u_C1R(ref_V_data, pitch_UV, cur_V_data, pitch_UV, roi); return; } if(pMacro->prediction_type == IPPVC_MC_FRAME) { CALC_OFFSETS_FRAME(offs_y1, offs_uv1, flag1, flag2, vector[0], vector[1], HP_FLAG_CP) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { MCZERO_FRAME(ref_Y_data + offs_y1, ref_U_data + offs_uv1, ref_V_data + offs_uv1, flag1, flag2) cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; } } else { int *motion_vertical_field_select = pMacro->motion_vertical_field_select; Ipp8u* cur_Y_data_save = cur_Y_data; Ipp8u* cur_U_data_save = cur_U_data; Ipp8u* cur_V_data_save = cur_V_data; if (pMacro->macroblock_motion_backward) motion_vertical_field_select++; CALC_OFFSETS_FIELD(offs_y1, offs_uv1, flag1, flag2, vector[0], vector[1], motion_vertical_field_select[0], HP_FLAG_CP) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { MCZERO_FIELD0(ref_Y_data + offs_y1, ref_U_data + offs_uv1, ref_V_data + offs_uv1, flag1, flag2) cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; } if(pMacro->motion_vector_count == 2) { cur_Y_data = cur_Y_data_save; cur_U_data = cur_U_data_save; cur_V_data = cur_V_data_save; CALC_OFFSETS_FIELD(offs_y1, offs_uv1, flag1, flag2, vector[4], vector[5], motion_vertical_field_select[2], HP_FLAG_CP) for (i = 0; i < pSlice->mb_address_increment - 1; i++) { MCZERO_FIELD1(ref_Y_data + offs_y1, ref_U_data + offs_uv1, ref_V_data + offs_uv1, flag1, flag2) cur_Y_data += 16; cur_U_data += 8; cur_V_data += 8; offs_y1 += 16; offs_uv1 += 8; } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -