📄 motion_functions.c
字号:
motion_y = pos_y - 2 * decoder->v_offset - 2 * 0; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); // $PP //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); LumaOffset = 0; table[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, ref_field[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, decoder->stride, 8); if (decoder->bDumpFiles && !decoder->bUseCModel) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(ref_field[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride), motion_x, motion_y, MBT_16x8, Y1_LUMA_BLOCK); motion_x /= 2; motion_y /= 2; xy_half = ((motion_y & 1) << 1) | (motion_x & 1); offset = (((decoder->offset + motion_x) >> 1) + ((((decoder->v_offset + motion_y) >> 1) + 0 / 2) * decoder->uv_stride));// $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); table[4 + xy_half] (decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), ref_field[1] + offset, decoder->uv_stride, 8 / 2); for (i = 0; i < 4; i++) memcpy ((void*)&UBlock[0 + i * 8], ref_field[1] + offset + i * decoder->uv_stride, 8); ChromaOffset = 64; table[4 + xy_half] (decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), ref_field[2] + offset, decoder->uv_stride, 8 / 2); for (i = 0; i < 4; i++) memcpy ((void*)&VBlock[0 + i * 8], ref_field[2] + offset + i * decoder->uv_stride, 8); }#endif //#ifdef NO_PERF do { if (((decoder->bitstream_bits) > 0)) { do { (decoder->bitstream_buf) |= (((decoder->bitstream_ptr)[0] << 8) | (decoder-> bitstream_ptr)[1]) << ((decoder->bitstream_bits)); (decoder->bitstream_ptr) += 2; } while (0); (decoder->bitstream_bits) -= 16; } } while (0); // $PP if (decoder->iRefType == FORWARD_REFERENCES) decoder->fwd_bot_motion_vertical_field_select = (int)(((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); else decoder->bwd_bot_motion_vertical_field_select = (int)(((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); ref_field = motion->ref2[(((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1)))]; do { (decoder->bitstream_buf) <<= (1); (decoder->bitstream_bits) += (1); } while (0); motion_x = motion->pmv[1][0] + get_motion_delta (decoder, motion->f_code[0]); motion_x = bound_motion_vector (motion_x, motion->f_code[0]); motion->pmv[1][0] = motion_x; do { if (((decoder->bitstream_bits) > 0)) { do { (decoder->bitstream_buf) |= (((decoder->bitstream_ptr)[0] << 8) | (decoder-> bitstream_ptr)[1]) << ((decoder->bitstream_bits)); (decoder->bitstream_ptr) += 2; } while (0); (decoder->bitstream_bits) -= 16; } } while (0); motion_y = motion->pmv[1][1] + get_motion_delta (decoder, motion->f_code[1]); motion_y = bound_motion_vector (motion_y, motion->f_code[1]); motion->pmv[1][1] = motion_y;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + motion_x; pos_y = 2 * decoder->v_offset + motion_y + 2 * 8; if ((pos_x > decoder->limit_x)) { pos_x = ((int) pos_x < 0) ? 0 : decoder->limit_x; motion_x = pos_x - 2 * decoder->offset; } if ((pos_y > decoder->limit_y_8)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y_8; motion_y = pos_y - 2 * decoder->v_offset - 2 * 8; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); // $PP LumaOffset = 128; table[xy_half] (decoder->dest[0] + 8 * decoder->stride + decoder->offset, ref_field[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, decoder->stride, 8); if (decoder->bDumpFiles && !decoder->bUseCModel) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(ref_field[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride), motion_x, motion_y, MBT_16x8, Y3_LUMA_BLOCK); motion_x /= 2; motion_y /= 2; xy_half = ((motion_y & 1) << 1) | (motion_x & 1); offset = (((decoder->offset + motion_x) >> 1) + ((((decoder->v_offset + motion_y) >> 1) + 8 / 2) * decoder->uv_stride)); // $PP ChromaOffset = 32; table[4 + xy_half] (decoder->dest[1] + 8 / 2 * decoder->uv_stride + (decoder->offset >> 1), ref_field[1] + offset, decoder->uv_stride, 8 / 2); for (i = 4; i < 8; i++) memcpy ((void*)&UBlock[0 + i * 8], ref_field[1] + offset + (i-4) * decoder->uv_stride, 8); ChromaOffset = 96; table[4 + xy_half] (decoder->dest[2] + 8 / 2 * decoder->uv_stride + (decoder->offset >> 1), ref_field[2] + offset, decoder->uv_stride, 8 / 2); for (i = 4; i < 8; i++) memcpy ((void*)&VBlock[0 + i * 8], ref_field[2] + offset + (i-4) * decoder->uv_stride, 8); if (decoder->bDumpFiles && !decoder->bUseCModel) { MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(&UBlock[0]), motion_x, motion_y, MBT_16x8, U_CHROMA_BLOCK); MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(&VBlock[0]), motion_x, motion_y, MBT_16x8, V_CHROMA_BLOCK); MotionCompInterChecksOutput (decoder, decoder->dest[0] + 0 * decoder->stride + decoder->offset, decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), MBT_16x8, decoder->stride, decoder->uv_stride); } }#endif //#ifdef NO_PERF}void motion_fi_dmv_420 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y, other_x, other_y;#ifdef NO_PERF unsigned int pos_x, pos_y, xy_half, offset;#endif //NO_PERF do { if (((decoder->bitstream_bits) > 0)) { do { (decoder->bitstream_buf) |= (((decoder->bitstream_ptr)[0] << 8) | (decoder-> bitstream_ptr)[1]) << ((decoder->bitstream_bits)); (decoder->bitstream_ptr) += 2; } while (0); (decoder->bitstream_bits) -= 16; } } while (0); // $PP if (decoder->iRefType == FORWARD_REFERENCES) decoder->fwd_top_motion_vertical_field_select = 0; else decoder->bwd_top_motion_vertical_field_select = 0; // $PP if (decoder->iRefType == FORWARD_REFERENCES) decoder->fwd_bot_motion_vertical_field_select = 1; else decoder->bwd_bot_motion_vertical_field_select = 1; motion_x = motion->pmv[0][0] + get_motion_delta (decoder, motion->f_code[0]); motion_x = bound_motion_vector (motion_x, motion->f_code[0]); motion->pmv[1][0] = motion->pmv[0][0] = motion_x; do { if (((decoder->bitstream_bits) > 0)) { do { (decoder->bitstream_buf) |= (((decoder->bitstream_ptr)[0] << 8) | (decoder-> bitstream_ptr)[1]) << ((decoder->bitstream_bits)); (decoder->bitstream_ptr) += 2; } while (0); (decoder->bitstream_bits) -= 16; } } while (0); other_x = ((motion_x + (motion_x > 0)) >> 1) + get_dmv (decoder); motion_y = motion->pmv[0][1] + get_motion_delta (decoder, motion->f_code[1]); motion_y = bound_motion_vector (motion_y, motion->f_code[1]); motion->pmv[1][1] = motion->pmv[0][1] = motion_y; other_y = (((motion_y + (motion_y > 0)) >> 1) + get_dmv (decoder) + decoder->dmv_offset); // $PP decoder->other_x = other_x; decoder->other_y = other_y;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + motion_x; pos_y = 2 * decoder->v_offset + motion_y + 2 * 0; if ((pos_x > decoder->limit_x)) { pos_x = ((int) pos_x < 0) ? 0 : decoder->limit_x; motion_x = pos_x - 2 * decoder->offset; } if ((pos_y > decoder->limit_y_16)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y_16; motion_y = pos_y - 2 * decoder->v_offset - 2 * 0; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); // $PP LumaOffset = 0; //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); mpeg2_mc.put[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, motion->ref[0][0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, decoder->stride, 16); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride), motion_x, motion_y, MBT_16x16, Y1_LUMA_BLOCK, FORWARD_REFERENCES); motion_x /= 2; motion_y /= 2; xy_half = ((motion_y & 1) << 1) | (motion_x & 1); offset = (((decoder->offset + motion_x) >> 1) + ((((decoder->v_offset + motion_y) >> 1) + 0 / 2) * decoder->uv_stride)); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); mpeg2_mc.put[4 + xy_half] (decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][1] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK, FORWARD_REFERENCES); ChromaOffset = 64; mpeg2_mc.put[4 + xy_half] (decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][2] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK, FORWARD_REFERENCES); MotionCompInterChecksOutput (decoder, decoder->dest[0] + 0 * decoder->stride + decoder->offset, decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), MBT_16x16, decoder->stride, decoder->uv_stride); } pos_x = 2 * decoder->offset + other_x; pos_y = 2 * decoder->v_offset + other_y + 2 * 0; if ((pos_x > decoder->limit_x)) { pos_x = ((int) pos_x < 0) ? 0 : decoder->limit_x; other_x = pos_x - 2 * decoder->offset; } if ((pos_y > decoder->limit_y_16)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y_16; other_y = pos_y - 2 * decoder->v_offset - 2 * 0; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); LumaOffset = 0; //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); mpeg2_mc.avg[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, motion->ref[1][0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, decoder->stride, 16); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[1][0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride), motion_x, motion_y, MBT_16x16, Y1_LUMA_BLOCK, BACKWARD_REFERENCES); other_x /= 2; other_y /= 2; xy_half = ((other_y & 1) << 1) | (other_x & 1); offset = (((decoder->offset + other_x) >> 1) + ((((decoder->v_offset + other_y) >> 1) + 0 / 2) * decoder->uv_stride)); ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); mpeg2_mc.avg[4 + xy_half] (decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[1][1] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[1][1] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK, BACKWARD_REFERENCES); ChromaOffset = 64; mpeg2_mc.avg[4 + xy_half] (decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[1][2] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[1][2] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK, BACKWARD_REFERENCES); MotionCompInterChecksOutput (decoder, decoder->dest[0] + 0 * decoder->stride + decoder->offset, decoder->dest[1] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), MBT_16x16, decoder->stride,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -