📄 umc_mpeg2_dec_mc.cpp
字号:
for (i = 0; i < video->mb_address_increment - 1; i++) {
CHECK_OFFSET_L(offs_y1+(vector[0]&1), pitch_l, 16+(vector[1]&1))
MCZERO_FRAME(COPY, 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;
}
return UMC_OK;
} //mc_mp2_420_skip
Status MPEG2VideoDecoderBase::mc_mp2_422_skip(IppVideoContext *video)
{
Ipp32s ref_index = (video->macroblock_motion_backward) ? frame_buffer.next_index : frame_buffer.prev_index;
Ipp8u *ref_Y_data = frame_buffer.frame_p_c_n[ref_index].Y_comp_data;
Ipp8u *ref_U_data = frame_buffer.frame_p_c_n[ref_index].U_comp_data;
Ipp8u *ref_V_data = frame_buffer.frame_p_c_n[ref_index].V_comp_data;
Ipp8u *cur_Y_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].Y_comp_data;
Ipp8u *cur_U_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].U_comp_data;
Ipp8u *cur_V_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].V_comp_data;
Ipp32u pitch_l = frame_buffer.Y_comp_pitch;
Ipp32u pitch_c = frame_buffer.U_comp_pitch;
Ipp32u flag1, flag2;
Ipp32s offs_uv1, offs_y1;
Ipp16s *vector = video->vector;
IppiSize roi = {16*(video->mb_address_increment - 1), 16};
Ipp32s i;
cur_Y_data += video->offset_l;
cur_U_data += video->offset_c;
cur_V_data += video->offset_c;
if (video->macroblock_motion_backward) vector += 2;
if (PictureHeader.picture_coding_type == P_FRAME) {
ref_Y_data += video->offset_l;
ref_U_data += video->offset_c;
ref_V_data += video->offset_c;
if(PictureHeader.picture_structure != FRAME_PICTURE) {
if(PictureHeader.picture_structure == BOTTOM_FIELD) {
cur_Y_data += pitch_l;
cur_U_data += pitch_c;
cur_V_data += pitch_c;
}
pitch_l <<= 1;
pitch_c <<= 1;
}
ippiCopy_8u_C1R( ref_Y_data, pitch_l, cur_Y_data, pitch_l, roi );
roi.width >>= 1;
ippiCopy_8u_C1R(ref_U_data, pitch_c, cur_U_data, pitch_c, roi);
ippiCopy_8u_C1R(ref_V_data, pitch_c, cur_V_data, pitch_c, roi);
return UMC_OK;
}
if(PictureHeader.picture_structure == FRAME_PICTURE) {
CALC_OFFSETS_FRAME_422(offs_y1, offs_uv1, flag1, flag2, vector[0], vector[1], HP_FLAG_CP)
} else {
CALC_OFFSETS_FIELD_422(offs_y1, offs_uv1, flag1, flag2, vector[0], vector[1], 0, HP_FLAG_CP)
pitch_l <<= 1;
pitch_c <<= 1;
}
for (i = 0; i < video->mb_address_increment - 1; i++) {
CHECK_OFFSET_L(offs_y1+(vector[0]&1), pitch_l, 16+(vector[1]&1))
MCZERO_FRAME_422(COPY, 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;
}
return UMC_OK;
} //mc_mp2_422_skip
Status MPEG2VideoDecoderBase::mc_mp2_420b_skip(IppVideoContext *video)
{
Ipp8u *ref_Y_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].Y_comp_data;
Ipp8u *ref_U_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].U_comp_data;
Ipp8u *ref_V_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].V_comp_data;
Ipp8u *ref_Y_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].Y_comp_data;
Ipp8u *ref_U_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].U_comp_data;
Ipp8u *ref_V_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].V_comp_data;
Ipp8u *cur_Y_data = video->blkCurrYUV[0];
Ipp8u *cur_U_data = video->blkCurrYUV[1];
Ipp8u *cur_V_data = video->blkCurrYUV[2];
Ipp32u flag1, flag2, flag3, flag4;
Ipp32s offs_uv1, offs_uv2, offs_y1, offs_y2;
Ipp32u pitch_l, pitch_c;
Ipp32u pitch_l2, pitch_c2;
Ipp32s i;
pitch_l2 = pitch_l = frame_buffer.Y_comp_pitch;
pitch_c2 = pitch_c = frame_buffer.U_comp_pitch;
cur_Y_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].Y_comp_data;
cur_U_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].U_comp_data;
cur_V_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].V_comp_data;
cur_Y_data += video->offset_l;
cur_U_data += video->offset_c;
cur_V_data += video->offset_c;
if (PictureHeader.picture_structure != FRAME_PICTURE) {
pitch_l2 = pitch_l + pitch_l;
pitch_c2 = pitch_c + pitch_c;
CALC_OFFSETS_FIELD_420(offs_y1, offs_uv1, flag1, flag2, video->vector[0], video->vector[1], 0, HP_FLAG_AV)
CALC_OFFSETS_FIELD_420(offs_y2, offs_uv2, flag3, flag4, video->vector[2], video->vector[3], 0, HP_FLAG_AV)
} else {
CALC_OFFSETS_FRAME_420(offs_y1, offs_uv1, flag1, flag2, video->vector[0], video->vector[1], HP_FLAG_AV)
CALC_OFFSETS_FRAME_420(offs_y2, offs_uv2, flag3, flag4, video->vector[2], video->vector[3], HP_FLAG_AV)
}
for (i = 0; i <= video->mb_address_increment - 3; i += 2) {
CHECK_OFFSET_L(offs_y1 + 16+(video->vector[0]&1), pitch_l2, 16+(video->vector[1]&1))
CHECK_OFFSET_L(offs_y2 + 16+(video->vector[2]&1), pitch_l2, 16+(video->vector[3]&1))
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1, pitch_l2, flag1,
ref_Y_data2 + offs_y2, pitch_l2, flag3,
cur_Y_data, pitch_l2, 0);
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1 + 16, pitch_l2, flag1,
ref_Y_data2 + offs_y2 + 16, pitch_l2, flag3,
cur_Y_data + 16, pitch_l2, 0);
FUNC_AVE_HP_B(16, 8, ref_U_data1 + offs_uv1, pitch_c2, flag2,
ref_U_data2 + offs_uv2, pitch_c2, flag4,
cur_U_data, pitch_c2, 0);
FUNC_AVE_HP_B(16, 8, ref_V_data1 + offs_uv1, pitch_c2, flag2,
ref_V_data2 + offs_uv2, pitch_c2, flag4,
cur_V_data, pitch_c2, 0);
cur_Y_data += 32;
offs_y1 += 32;
offs_y2 += 32;
cur_U_data += 16;
cur_V_data += 16;
offs_uv1 += 16;
offs_uv2 += 16;
}
if (i < video->mb_address_increment - 1) {
CHECK_OFFSET_L(offs_y1+(video->vector[0]&1), pitch_l2, 16+(video->vector[1]&1))
CHECK_OFFSET_L(offs_y2+(video->vector[2]&1), pitch_l2, 16+(video->vector[3]&1))
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1, pitch_l2, flag1,
ref_Y_data2 + offs_y2, pitch_l2, flag3,
cur_Y_data, pitch_l2, 0);
FUNC_AVE_HP_B(8, 8, ref_U_data1 + offs_uv1, pitch_c2, flag2,
ref_U_data2 + offs_uv2, pitch_c2, flag4,
cur_U_data, pitch_c2, 0);
FUNC_AVE_HP_B(8, 8, ref_V_data1 + offs_uv1, pitch_c2, flag2,
ref_V_data2 + offs_uv2, pitch_c2, flag4,
cur_V_data, pitch_c2, 0);
}
return UMC_OK;
} //mc_mp2_420b_skip
Status MPEG2VideoDecoderBase::mc_mp2_422b_skip(IppVideoContext *video)
{
Ipp8u *ref_Y_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].Y_comp_data;
Ipp8u *ref_U_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].U_comp_data;
Ipp8u *ref_V_data1 = frame_buffer.frame_p_c_n[frame_buffer.prev_index].V_comp_data;
Ipp8u *ref_Y_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].Y_comp_data;
Ipp8u *ref_U_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].U_comp_data;
Ipp8u *ref_V_data2 = frame_buffer.frame_p_c_n[frame_buffer.next_index].V_comp_data;
Ipp8u *cur_Y_data = video->blkCurrYUV[0];
Ipp8u *cur_U_data = video->blkCurrYUV[1];
Ipp8u *cur_V_data = video->blkCurrYUV[2];
Ipp32u flag1, flag2, flag3, flag4;
Ipp32s offs_uv1, offs_uv2, offs_y1, offs_y2;
Ipp32u pitch_l, pitch_c;
Ipp32u pitch_l2, pitch_c2;
Ipp32s i;
pitch_l2 = pitch_l = frame_buffer.Y_comp_pitch;
pitch_c2 = pitch_c = frame_buffer.U_comp_pitch;
cur_Y_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].Y_comp_data;
cur_U_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].U_comp_data;
cur_V_data = frame_buffer.frame_p_c_n[frame_buffer.curr_index].V_comp_data;
cur_Y_data += video->offset_l;
cur_U_data += video->offset_c;
cur_V_data += video->offset_c;
if (PictureHeader.picture_structure != FRAME_PICTURE) {
pitch_l2 = pitch_l + pitch_l;
pitch_c2 = pitch_c + pitch_c;
CALC_OFFSETS_FIELD_422(offs_y1, offs_uv1, flag1, flag2, video->vector[0], video->vector[1], 0, HP_FLAG_AV)
CALC_OFFSETS_FIELD_422(offs_y2, offs_uv2, flag3, flag4, video->vector[2], video->vector[3], 0, HP_FLAG_AV)
} else {
CALC_OFFSETS_FRAME_422(offs_y1, offs_uv1, flag1, flag2, video->vector[0], video->vector[1], HP_FLAG_AV)
CALC_OFFSETS_FRAME_422(offs_y2, offs_uv2, flag3, flag4, video->vector[2], video->vector[3], HP_FLAG_AV)
}
for (i = 0; i <= video->mb_address_increment - 3; i += 2) {
CHECK_OFFSET_L(offs_y1+(video->vector[0]&1), pitch_l2, 16+(video->vector[1]&1))
CHECK_OFFSET_L(offs_y2+(video->vector[2]&1), pitch_l2, 16+(video->vector[3]&1))
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1, pitch_l2, flag1,
ref_Y_data2 + offs_y2, pitch_l2, flag3,
cur_Y_data, pitch_l2, 0);
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1 + 16, pitch_l2, flag1,
ref_Y_data2 + offs_y2 + 16, pitch_l2, flag3,
cur_Y_data + 16, pitch_l2, 0);
FUNC_AVE_HP_B(16, 16, ref_U_data1 + offs_uv1, pitch_c2, flag2,
ref_U_data2 + offs_uv2, pitch_c2, flag4,
cur_U_data, pitch_c2, 0);
FUNC_AVE_HP_B(16, 16, ref_V_data1 + offs_uv1, pitch_c2, flag2,
ref_V_data2 + offs_uv2, pitch_c2, flag4,
cur_V_data, pitch_c2, 0);
cur_Y_data += 32;
offs_y1 += 32;
offs_y2 += 32;
cur_U_data += 16;
cur_V_data += 16;
offs_uv1 += 16;
offs_uv2 += 16;
}
if (i < video->mb_address_increment - 1) {
CHECK_OFFSET_L(offs_y1+(video->vector[0]&1), pitch_l2, 16+(video->vector[1]&1))
CHECK_OFFSET_L(offs_y2+(video->vector[2]&1), pitch_l2, 16+(video->vector[3]&1))
FUNC_AVE_HP_B(16, 16, ref_Y_data1 + offs_y1, pitch_l2, flag1,
ref_Y_data2 + offs_y2, pitch_l2, flag3,
cur_Y_data, pitch_l2, 0);
FUNC_AVE_HP_B(8, 16, ref_U_data1 + offs_uv1, pitch_c2, flag2,
ref_U_data2 + offs_uv2, pitch_c2, flag4,
cur_U_data, pitch_c2, 0);
FUNC_AVE_HP_B(8, 16, ref_V_data1 + offs_uv1, pitch_c2, flag2,
ref_V_data2 + offs_uv2, pitch_c2, flag4,
cur_V_data, pitch_c2, 0);
}
return UMC_OK;
} //mc_mp2_422b_skip
Status MPEG2VideoDecoderBase::mc_dualprime_frame_420(IppVideoContext *video)
{
Ipp32s pitch_l, pitch_c;
Ipp8u *ref_Y_data, *ref_U_data, *ref_V_data;
Ipp8u *cur_Y_data = video->blkCurrYUV[0];
Ipp8u *cur_U_data = video->blkCurrYUV[1];
Ipp8u *cur_V_data = video->blkCurrYUV[2];
Ipp32s nMCType, nMCTypeUV;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -