📄 motion_functions.c
字号:
U_CHROMA_BLOCK, BACKWARD_REFERENCES); MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(&VBlock[0]), motion_x, motion_y, MBT_16x8, 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_16x8, decoder->stride, decoder->uv_stride); } }#endif //#ifdef NO_PERF}void motion_reuse_420 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y;#ifdef NO_PERF unsigned int xy_half, offset;#endif //NO_PERFunsigned int pos_x, pos_y; motion_x = motion->pmv[0][0]; motion_y = motion->pmv[0][1]; pos_x = 2 * decoder->offset + motion_x; pos_y = 2 * decoder->v_offset + motion_y + 2 * 0;#ifdef NO_PERF if (!decoder->bUseCModel) { 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); table[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) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride), motion_x, motion_y, MBT_16x16, 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), motion->ref[0][1] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][1] + offset), motion_x, motion_y, MBT_16x16, U_CHROMA_BLOCK); ChromaOffset = 64; table[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) { MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][2] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK); MotionCompInterChecksOutput (decoder, decoder->dest[0] + decoder->offset, decoder->dest[1] + (decoder->offset >> 1), decoder->dest[2] + (decoder->offset >> 1), MBT_16x16, decoder->stride, decoder->uv_stride); } }#endif //#ifdef NO_PERF}void motion_zero_420 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){#ifdef NO_PERF unsigned int offset;#endif //NO_PERF motion->pmv[0][0] = motion->pmv[0][1] = 0; motion->pmv[1][0] = motion->pmv[1][1] = 0;#ifdef NO_PERF if (!decoder->bUseCModel) { // $PP LumaOffset = 0; //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); table[0] (decoder->dest[0] + decoder->offset, (motion->ref[0][0] + decoder->offset + decoder->v_offset * decoder->stride), decoder->stride, 16); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][0] + decoder->offset + decoder->v_offset * decoder->stride), 0, 0, MBT_16x16, Y1_LUMA_BLOCK); offset = ((decoder->offset >> 1) + (decoder->v_offset >> 1) * decoder->uv_stride); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); table[4] (decoder->dest[1] + (decoder->offset >> 1), motion->ref[0][1] + offset, decoder->uv_stride, 8); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][1] + offset), 0, 0, MBT_16x16, U_CHROMA_BLOCK); // $PP ChromaOffset = 64; table[4] (decoder->dest[2] + (decoder->offset >> 1), motion->ref[0][2] + offset, decoder->uv_stride, 8); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][2] + offset), 0, 0, MBT_16x16, V_CHROMA_BLOCK); MotionCompInterChecksOutput (decoder, decoder->dest[0] + decoder->offset, decoder->dest[1] + (decoder->offset >> 1), decoder->dest[2] + (decoder->offset >> 1), MBT_16x16, decoder->stride, decoder->uv_stride); } }#endif //#ifdef NO_PERF}void motion_fi_field_420 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y; uint8_t **ref_field;#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 = (int)(((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); else decoder->bwd_top_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[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); 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;#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 //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); table[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, ref_field[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, decoder->stride, 16); 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_16x16, 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, 16 / 2); if (decoder->bDumpFiles && !decoder->bUseCModel) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(ref_field[1] + offset), motion_x, motion_y, MBT_16x16, U_CHROMA_BLOCK); // $PP ChromaOffset = 64; table[4 + xy_half] (decoder->dest[2] + 0 / 2 * decoder->uv_stride + (decoder->offset >> 1), ref_field[2] + offset, decoder->uv_stride, 16 / 2); if (decoder->bDumpFiles && !decoder->bUseCModel) { MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(ref_field[2] + offset), motion_x, motion_y, MBT_16x16, 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_16x16, decoder->stride, decoder->uv_stride); } }#endif //#ifdef NO_PERF}void motion_fi_16x8_420 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y; uint8_t **ref_field; unsigned char UBlock[64] = {0}; unsigned char VBlock[64] = {0};#ifdef NO_PERF unsigned int pos_x, pos_y, xy_half, offset; int i;#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 = (int)(((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); else decoder->bwd_top_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[0][0] + get_motion_delta (decoder, motion->f_code[0]); motion_x = bound_motion_vector (motion_x, motion->f_code[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); 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[0][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 * 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_8)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y_8;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -