mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-11 08:38:05 +02:00
[g3dvl] simplify motion vector calculation
This commit is contained in:
parent
bac8760f7f
commit
f2c6affa36
2 changed files with 29 additions and 49 deletions
|
|
@ -314,6 +314,9 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
|
|||
ureg_CMP(shader, ureg_writemask(ref[0], TGSI_WRITEMASK_XY),
|
||||
ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
|
||||
tc[1], tc[0]);
|
||||
ureg_CMP(shader, ureg_writemask(ref[1], TGSI_WRITEMASK_XY),
|
||||
ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
|
||||
tc[3], tc[2]);
|
||||
|
||||
ureg_IF(shader, ureg_scalar(info, TGSI_SWIZZLE_X), &bi_label);
|
||||
|
||||
|
|
@ -321,7 +324,7 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
|
|||
* result = tex(field.z ? tc[1] : tc[0], sampler[bkwd_pred ? 1 : 0])
|
||||
*/
|
||||
ureg_IF(shader, ureg_scalar(info, TGSI_SWIZZLE_Z), &label);
|
||||
ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[1]);
|
||||
ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[1]), sampler[1]);
|
||||
ureg_fixup_label(shader, label, ureg_get_instruction_number(shader));
|
||||
ureg_ELSE(shader, &label);
|
||||
ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[0]);
|
||||
|
|
@ -337,9 +340,6 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
|
|||
* else
|
||||
* ref[0..1] = tex(tc[2..3], sampler[0..1])
|
||||
*/
|
||||
ureg_CMP(shader, ureg_writemask(ref[1], TGSI_WRITEMASK_XY),
|
||||
ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
|
||||
tc[3], tc[2]);
|
||||
ureg_TEX(shader, ref[0], TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[0]);
|
||||
ureg_TEX(shader, ref[1], TGSI_TEXTURE_2D, ureg_src(ref[1]), sampler[1]);
|
||||
|
||||
|
|
|
|||
|
|
@ -208,62 +208,42 @@ vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
|
|||
static void
|
||||
get_motion_vectors(struct pipe_mpeg12_macroblock *mb, struct vertex2s mv[4])
|
||||
{
|
||||
switch (mb->mb_type) {
|
||||
case PIPE_MPEG12_MACROBLOCK_TYPE_BI:
|
||||
{
|
||||
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
|
||||
mv[2].x = mb->mv[1].top.x;
|
||||
mv[2].y = mb->mv[1].top.y;
|
||||
if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BI ||
|
||||
mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_FWD) {
|
||||
|
||||
} else {
|
||||
mv[2].x = mb->mv[1].top.x;
|
||||
mv[2].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
|
||||
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
|
||||
mv[0].x = mb->mv[0].top.x;
|
||||
mv[0].y = mb->mv[0].top.y;
|
||||
|
||||
mv[3].x = mb->mv[1].bottom.x;
|
||||
mv[3].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
|
||||
} else {
|
||||
mv[0].x = mb->mv[0].top.x;
|
||||
mv[0].y = mb->mv[0].top.y - (mb->mv[0].top.y % 4);
|
||||
|
||||
if (mb->mv[1].top.field_select) mv[2].y += 2;
|
||||
if (!mb->mv[1].bottom.field_select) mv[3].y -= 2;
|
||||
}
|
||||
mv[1].x = mb->mv[0].bottom.x;
|
||||
mv[1].y = mb->mv[0].bottom.y - (mb->mv[0].bottom.y % 4);
|
||||
|
||||
/* fall-through */
|
||||
if (mb->mv[0].top.field_select) mv[0].y += 2;
|
||||
if (!mb->mv[0].bottom.field_select) mv[1].y -= 2;
|
||||
}
|
||||
case PIPE_MPEG12_MACROBLOCK_TYPE_FWD:
|
||||
{
|
||||
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
|
||||
mv[0].x = mb->mv[0].top.x;
|
||||
mv[0].y = mb->mv[0].top.y;
|
||||
}
|
||||
|
||||
} else {
|
||||
mv[0].x = mb->mv[0].top.x;
|
||||
mv[0].y = mb->mv[0].top.y - (mb->mv[0].top.y % 4);
|
||||
if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BI ||
|
||||
mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) {
|
||||
|
||||
mv[1].x = mb->mv[0].bottom.x;
|
||||
mv[1].y = mb->mv[0].bottom.y - (mb->mv[0].bottom.y % 4);
|
||||
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
|
||||
mv[2].x = mb->mv[1].top.x;
|
||||
mv[2].y = mb->mv[1].top.y;
|
||||
|
||||
if (mb->mv[0].top.field_select) mv[0].y += 2;
|
||||
if (!mb->mv[0].bottom.field_select) mv[1].y -= 2;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
mv[2].x = mb->mv[1].top.x;
|
||||
mv[2].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
|
||||
|
||||
case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD:
|
||||
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
|
||||
mv[0].x = mb->mv[1].top.x;
|
||||
mv[0].y = mb->mv[1].top.y;
|
||||
mv[3].x = mb->mv[1].bottom.x;
|
||||
mv[3].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
|
||||
|
||||
} else {
|
||||
mv[0].x = mb->mv[1].top.x;
|
||||
mv[0].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
|
||||
|
||||
mv[1].x = mb->mv[1].bottom.x;
|
||||
mv[1].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
|
||||
|
||||
if (mb->mv[1].top.field_select) mv[0].y += 2;
|
||||
if (!mb->mv[1].bottom.field_select) mv[1].y -= 2;
|
||||
}
|
||||
if (mb->mv[1].top.field_select) mv[2].y += 2;
|
||||
if (!mb->mv[1].bottom.field_select) mv[3].y -= 2;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue