📄 motion_functions.c
字号:
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); // $PP LumaOffset = 128; table[xy_half] (decoder->dest[0] + 1 * decoder->stride + decoder->offset, (motion->ref[0][0] + (pos_x >> 1) + ((pos_y & ~1) + field) * decoder->stride), 2 * decoder->stride, 8); if (decoder->bDumpFiles && !decoder->bUseCModel) MotionCompInterChecksRefBlocks (decoder, (unsigned char*)(motion->ref[0][0] + (pos_x >> 1) + ((pos_y & ~1) + field) * 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 >> 1) + (motion_y & ~1) + field) * decoder->uv_stride)); // $PP ChromaOffset = 32; table[4 + xy_half] (decoder->dest[1] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&UBlock[0 + i * 8], motion->ref[0][1] + offset + (i-4) * decoder->uv_stride * 2, 8); ChromaOffset = 96; table[4 + xy_half] (decoder->dest[2] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&VBlock[0 + i * 8], motion->ref[0][2] + offset + (i-4) * decoder->uv_stride * 2, 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_fr_dmv_420 (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;#ifdef NO_PERF unsigned int pos_x, pos_y, xy_half, offset; int i;#endif //NO_PERF unsigned char UBlock[64] = {0}; unsigned char VBlock[64] = {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); 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); dmv_x = get_dmv (decoder); motion_y = ((motion->pmv[0][1] >> 1) + get_motion_delta (decoder, motion->f_code[1])); motion->pmv[1][1] = motion->pmv[0][1] = motion_y << 1; dmv_y = get_dmv (decoder); m = decoder->top_field_first ? 1 : 3; other_x = ((motion_x * m + (motion_x > 0)) >> 1) + dmv_x; other_y = ((motion_y * m + (motion_y > 0)) >> 1) + dmv_y - 1; // $PP decoder->other_x = other_x; decoder->other_y = other_y; decoder->fwd_top_motion_vertical_field_select = (other_y | 1) & 1; decoder->bwd_top_motion_vertical_field_select = 0;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + other_x; pos_y = decoder->v_offset + other_y; 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)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y; other_y = pos_y - decoder->v_offset; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); // $PP //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); LumaOffset = 0; mpeg2_mc.put[xy_half] (decoder->dest[0] + 0 * decoder->stride + decoder->offset, (motion->ref[0][0] + (pos_x >> 1) + ((pos_y | 1) + 0) * decoder->stride), 2 * decoder->stride, 8); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][0] + (pos_x >> 1) + ((pos_y | 1) + 0) * decoder->stride), other_x, other_y, MBT_16x8, Y1_LUMA_BLOCK, FORWARD_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 >> 1) + (other_y | 1) + 0) * 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 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 4); for (i = 0; i < 4; i++) memcpy ((void*)&UBlock[0 + i * 8], motion->ref[0][1] + offset + i * decoder->uv_stride * 2, 8); // $PP ChromaOffset = 64; mpeg2_mc.put[4 + xy_half] (decoder->dest[2] + 0 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 4); for (i = 0; i < 4; i++) memcpy ((void*)&VBlock[0 + i * 8], motion->ref[0][2] + offset + i * decoder->uv_stride * 2, 8); }#endif //#ifdef NO_PERF m = decoder->top_field_first ? 3 : 1; other_x = ((motion_x * m + (motion_x > 0)) >> 1) + dmv_x; other_y = ((motion_y * m + (motion_y > 0)) >> 1) + dmv_y + 1; // $PP decoder->other_x1 = other_x; decoder->other_y1 = other_y; decoder->fwd_bot_motion_vertical_field_select = 0; decoder->bwd_bot_motion_vertical_field_select = 1;#ifdef NO_PERF if (!decoder->bUseCModel) { pos_x = 2 * decoder->offset + other_x; pos_y = decoder->v_offset + other_y; 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)) { pos_y = ((int) pos_y < 0) ? 0 : decoder->limit_y; other_y = pos_y - decoder->v_offset; } xy_half = ((pos_y & 1) << 1) | (pos_x & 1); // $PP LumaOffset = 128; mpeg2_mc.put[xy_half] (decoder->dest[0] + 1 * decoder->stride + decoder->offset,(motion->ref[0][0] + (pos_x >> 1) + ((pos_y & ~1) + 0) * decoder->stride), 2 * decoder->stride, 8); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][0] + (pos_x >> 1) + ((pos_y & ~1) + 0) * decoder->stride), other_x, other_y, MBT_16x8, Y3_LUMA_BLOCK, FORWARD_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 >> 1) + (other_y & ~1) + 0) * decoder->uv_stride)); // $PP ChromaOffset = 32; mpeg2_mc.put[4 + xy_half] (decoder->dest[1] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&UBlock[0 + i * 8], motion->ref[0][1] + offset + (i-4) * decoder->uv_stride * 2, 8); ChromaOffset = 96; mpeg2_mc.put[4 + xy_half] (decoder->dest[2] + 1 * decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&VBlock[0 + i * 8], motion->ref[0][2] + offset + (i-4) * decoder->uv_stride * 2, 8); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(&UBlock[0]), other_x, other_y, MBT_16x8, U_CHROMA_BLOCK, FORWARD_REFERENCES); MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(&VBlock[0]), other_x, other_y, MBT_16x8, 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_16x8, decoder->stride, decoder->uv_stride); } 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) * decoder->stride; // $PP //memset ((void*)&LumaData[0], 0, sizeof(uint8_t) * 4 *64); LumaOffset = 0; mpeg2_mc.avg[xy_half] (decoder->dest[0] + decoder->offset, motion->ref[0][0] + offset, 2 * decoder->stride, 8); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][0] + offset), motion_x, motion_y, MBT_16x8, Y1_LUMA_BLOCK, BACKWARD_REFERENCES); LumaOffset = 128; mpeg2_mc.avg[xy_half] (decoder->dest[0] + decoder->stride + decoder->offset, motion->ref[0][0] + decoder->stride + offset, 2 * decoder->stride, 8); if (decoder->bDumpFiles) MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(motion->ref[0][0] + decoder->stride + offset), motion_x, motion_y, MBT_16x8, Y3_LUMA_BLOCK, BACKWARD_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 >> 1) + (motion_y & ~1)) * decoder->uv_stride)); // $PP ChromaOffset = 0; //memset ((void*)&ChromaData[0], 0, sizeof(uint8_t) * 2 *64); mpeg2_mc.avg[4 + xy_half] (decoder->dest[1] + (decoder->offset >> 1), motion->ref[0][1] + offset, 2 * decoder->uv_stride, 4); for (i = 0; i < 4; i++) memcpy ((void*)&UBlock[0 + i * 8], motion->ref[0][1] + offset + i * decoder->uv_stride, 8); ChromaOffset = 64; mpeg2_mc.avg[4 + xy_half] (decoder->dest[1] + decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][1] + decoder->uv_stride + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&UBlock[0 + i * 8], motion->ref[0][1] + offset + (i-4) * decoder->uv_stride, 8); ChromaOffset = 32; mpeg2_mc.avg[4 + xy_half] (decoder->dest[2] + (decoder->offset >> 1), motion->ref[0][2] + offset, 2 * decoder->uv_stride, 4); for (i = 0; i < 4; i++) memcpy ((void*)&VBlock[0 + i * 8], motion->ref[0][2] + offset + i * decoder->uv_stride, 8); ChromaOffset = 96; mpeg2_mc.avg[4 + xy_half] (decoder->dest[2] + decoder->uv_stride + (decoder->offset >> 1), motion->ref[0][2] + decoder->uv_stride + offset, 2 * decoder->uv_stride, 4); for (i = 4; i < 8; i++) memcpy ((void*)&VBlock[0 + i * 8], motion->ref[0][2] + offset + (i-4) * decoder->uv_stride, 8); if (decoder->bDumpFiles) { MotionCompInterChecksRefBlocksDMV (decoder, (unsigned char*)(&UBlock[0]), motion_x, motion_y, MBT_16x8,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -