📄 motion_functions.c
字号:
decoder->uv_stride); } }#endif //#ifdef NO_PERF}#if 0void motion_fr_frame_422 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y; unsigned int pos_x, pos_y, xy_half, offset; 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_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); offset = (pos_x >> 1) + (pos_y >> 1) * decoder->stride; // $PP //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); LumaOffset = 0; table[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, motion->ref[0][0] + offset, decoder->stride, 16); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][0] + offset), motion_x, motion_y, MBT_16x16, Y1_LUMA_BLOCK); offset = (offset + (motion_x & (motion_x < 0))) >> 1; motion_x /= 2; xy_half = ((pos_y & 1) << 1) | (motion_x & 1); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); //memset ((void*)&ChromaData1[0], 0, sizeof(uint8_t) * 4 *64); table[4 + xy_half] (decoder->dest[1] + 0 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, decoder->uv_stride, 16); memcpy ((void*)&ChromaData1[0], (void*)&ChromaData[0], 8 * 16); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); table[4 + xy_half] (decoder->dest[2] + 0 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, decoder->uv_stride, 16); memcpy ((void*)&ChromaData1[8 * 16], (void*)&ChromaData[0], 8 * 16); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][1] + offset), motion_x, motion_y, MBT_16x16, U_CHROMA_BLOCK); MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][1] + offset + 8 * decoder->uv_stride), motion_x, motion_y, MBT_16x16, U2_CHROMA_BLOCK); MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][2] + offset), motion_x, motion_y, MBT_16x16, V_CHROMA_BLOCK); MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][2] + offset + 8 * decoder->uv_stride), motion_x, motion_y, MBT_16x16, V2_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_fr_field_422 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y, field; unsigned int pos_x, pos_y, xy_half, offset; unsigned char UBlock[128] = {0}; unsigned char VBlock[128] = {0}; 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); field = (((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); // $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))); 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] >> 1) + get_motion_delta (decoder, motion->f_code[1])); motion->pmv[0][1] = motion_y << 1;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + motion_x; pos_y = decoder->v_offset + motion_y; 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)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y; motion_y = pos_y - decoder->v_offset; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); offset = (pos_x >> 1) + ((pos_y & ~1) + field) * decoder->stride; // $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] + offset, 2 * decoder->stride, 8); offset = (offset + (motion_x & (motion_x < 0))) >> 1; motion_x /= 2; xy_half = ((pos_y & 1) << 1) | (motion_x & 1); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 * 64); //memset ((void*)&ChromaData1[0], 0, sizeof(uint8_t) * 4 * 64); table[4 + xy_half] (decoder->dest[1] + 0 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 8); memcpy ((void*)&ChromaData1[0], (void*)&ChromaData[0], 8 * 8); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 * 64); table[4 + xy_half] (decoder->dest[2] + 0 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 8); memcpy ((void*)&ChromaData1[128], (void*)&ChromaData[0], 8 * 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); field = (((uint32_t) ((decoder->bitstream_buf))) >> (32 - (1))); // $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))); 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] >> 1) + get_motion_delta (decoder, motion->f_code[1])); motion->pmv[1][1] = motion_y << 1;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + motion_x; pos_y = decoder->v_offset + motion_y; 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)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y; motion_y = pos_y - decoder->v_offset; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); offset = (pos_x >> 1) + ((pos_y & ~1) + field) * decoder->stride; // $PP LumaOffset = 128; table[xy_half] (decoder->dest[0] + 1 * decoder->stride + decoder->offset, motion->ref[0][0] + offset, 2 * decoder->stride, 8); offset = (offset + (motion_x & (motion_x < 0))) >> 1; motion_x /= 2; xy_half = ((pos_y & 1) << 1) | (motion_x & 1); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 * 64); table[4 + xy_half] (decoder->dest[1] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 8); memcpy ((void*)&ChromaData1[64], (void*)&ChromaData[0], 8 * 8); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 * 64); table[4 + xy_half] (decoder->dest[2] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 8); memcpy ((void*)&ChromaData1[96], (void*)&ChromaData[0], 8 * 8); }#endif //#ifdef NO_PERF}void motion_fr_dmv_422 (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const *const table){ int motion_x, motion_y, dmv_x, dmv_y, m, other_x, other_y; unsigned int pos_x, pos_y, xy_half, offset; 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_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_p
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -