NUM_MACROBLOCK_TYPES
};
-/* vertices for two triangles covering four block */
-static const struct vertex2f const_rectangle[4][2][3] = {
- {
- { {0.0f, 0.0f}, {0.0f, 0.5f}, {0.5f, 0.0f} },
- { {0.5f, 0.0f}, {0.0f, 0.5f}, {0.5f, 0.5f} }
- }, {
- { {0.5f, 0.0f}, {0.5f, 0.5f}, {1.0f, 0.0f} },
- { {1.0f, 0.0f}, {0.5f, 0.5f}, {1.0f, 0.5f} }
- }, {
- { {0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 0.5f} },
- { {0.5f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f} }
- }, {
- { {0.5f, 0.5f}, {0.5f, 1.0f}, {1.0f, 0.5f} },
- { {1.0f, 0.5f}, {0.5f, 1.0f}, {1.0f, 1.0f} }
- }
+/* vertices for four quads covering the blocks */
+static const struct vertex2f const_quads[4][4] = {
+ { {0.0f, 0.0f}, {0.5f, 0.0f}, {0.5f, 0.5f}, {0.0f, 0.5f} },
+ { {0.5f, 0.0f}, {1.0f, 0.0f}, {1.0f, 0.5f}, {0.5f, 0.5f} },
+ { {0.0f, 0.5f}, {0.5f, 0.5f}, {0.5f, 1.0f}, {0.0f, 1.0f} },
+ { {0.5f, 0.5f}, {1.0f, 0.5f}, {1.0f, 1.0f}, {0.5f, 1.0f} },
};
static void *
}
r->vertex_bufs.individual.rect.stride = sizeof(struct vertex2f);
- r->vertex_bufs.individual.rect.max_index = 24 * r->macroblocks_per_batch - 1;
+ r->vertex_bufs.individual.rect.max_index = 16 * r->macroblocks_per_batch - 1;
r->vertex_bufs.individual.rect.buffer_offset = 0;
r->vertex_bufs.individual.rect.buffer = pipe_buffer_create
(
r->pipe->screen,
PIPE_BIND_VERTEX_BUFFER,
- sizeof(struct vertex2f) * 24 * r->macroblocks_per_batch
+ sizeof(struct vertex2f) * 16 * r->macroblocks_per_batch
);
r->vertex_bufs.individual.ycbcr.stride = sizeof(struct vert_stream_0);
- r->vertex_bufs.individual.ycbcr.max_index = 24 * r->macroblocks_per_batch - 1;
+ r->vertex_bufs.individual.ycbcr.max_index = 16 * r->macroblocks_per_batch - 1;
r->vertex_bufs.individual.ycbcr.buffer_offset = 0;
/* XXX: Create with usage DYNAMIC or STREAM */
r->vertex_bufs.individual.ycbcr.buffer = pipe_buffer_create
(
r->pipe->screen,
PIPE_BIND_VERTEX_BUFFER,
- sizeof(struct vert_stream_0) * 24 * r->macroblocks_per_batch
+ sizeof(struct vert_stream_0) * 16 * r->macroblocks_per_batch
);
for (i = 0; i < 2; ++i) {
r->vertex_bufs.individual.ref[i].stride = sizeof(struct vertex2f) * 2;
- r->vertex_bufs.individual.ref[i].max_index = 24 * r->macroblocks_per_batch - 1;
+ r->vertex_bufs.individual.ref[i].max_index = 16 * r->macroblocks_per_batch - 1;
r->vertex_bufs.individual.ref[i].buffer_offset = 0;
/* XXX: Create with usage DYNAMIC or STREAM */
r->vertex_bufs.individual.ref[i].buffer = pipe_buffer_create
(
r->pipe->screen,
PIPE_BIND_VERTEX_BUFFER,
- sizeof(struct vertex2f) * 2 * 24 * r->macroblocks_per_batch
+ sizeof(struct vertex2f) * 2 * 16 * r->macroblocks_per_batch
);
}
);
for ( i = 0; i < r->macroblocks_per_batch; ++i)
- memcpy(rect + i * 24, &const_rectangle, sizeof(const_rectangle));
+ memcpy(rect + i * 16, &const_quads, sizeof(const_quads));
pipe_buffer_unmap(r->pipe, r->vertex_bufs.individual.rect.buffer, buf_transfer);
v.interlaced = mb->dct_type == PIPE_MPEG12_DCT_TYPE_FIELD ? 1.0f : 0.0f;
- for ( i = 0; i < 6; ++i )
+ for ( i = 0; i < 4; ++i )
memcpy(vb + i, &v, sizeof(v));
}
assert(ref_vb && ref_vb[1]);
- vb = ref_vb[1] + pos * 2 * 24;
+ vb = ref_vb[1] + pos * 2 * 16;
mo_vec[0].x = mb->pmv[0][1][0];
mo_vec[0].y = mb->pmv[0][1][1];
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
- for (i = 0; i < 24 * 2; i += 2) {
+ for (i = 0; i < 16 * 2; i += 2) {
vb[i].x = mo_vec[0].x;
vb[i].y = mo_vec[0].y;
}
if(mb->mvfs[0][1]) mo_vec[0].y += 2;
if(!mb->mvfs[1][1]) mo_vec[1].y -= 2;
- for (i = 0; i < 24 * 2; i += 2) {
+ for (i = 0; i < 16 * 2; i += 2) {
vb[i].x = mo_vec[0].x;
vb[i].y = mo_vec[0].y;
vb[i + 1].x = mo_vec[1].x;
assert(ref_vb && ref_vb[0]);
- vb = ref_vb[0] + pos * 2 * 24;
+ vb = ref_vb[0] + pos * 2 * 16;
if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) {
mo_vec[0].x = mb->pmv[0][1][0];
}
if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
- for (i = 0; i < 24 * 2; i += 2) {
+ for (i = 0; i < 16 * 2; i += 2) {
vb[i].x = mo_vec[0].x;
vb[i].y = mo_vec[0].y;
}
}
else {
- for (i = 0; i < 24 * 2; i += 2) {
+ for (i = 0; i < 16 * 2; i += 2) {
vb[i].x = mo_vec[0].x;
vb[i].y = mo_vec[0].y;
vb[i + 1].x = mo_vec[1].x;
}
case PIPE_MPEG12_MACROBLOCK_TYPE_INTRA:
{
- struct vert_stream_0 *vb = ycbcr_vb + pos * 24;
+ struct vert_stream_0 *vb = ycbcr_vb + pos * 16;
if(mb->dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) {
gen_block_verts(vb , mb, 32, 32, 2, 1);
- gen_block_verts(vb + 6 , mb, 16, 16, 2, 1);
- gen_block_verts(vb + 12, mb, 8, 8, 2, 1);
- gen_block_verts(vb + 18, mb, 4, 4, 2, 1);
+ gen_block_verts(vb + 4 , mb, 16, 16, 2, 1);
+ gen_block_verts(vb + 8 , mb, 8, 8, 2, 1);
+ gen_block_verts(vb + 12, mb, 4, 4, 2, 1);
} else {
gen_block_verts(vb , mb, 32, 8, 2, 1);
- gen_block_verts(vb + 6 , mb, 16, 4, 2, 1);
- gen_block_verts(vb + 12, mb, 32, 8, 2, 1);
- gen_block_verts(vb + 18, mb, 16, 4, 2, 1);
+ gen_block_verts(vb + 4 , mb, 16, 4, 2, 1);
+ gen_block_verts(vb + 8 , mb, 32, 8, 2, 1);
+ gen_block_verts(vb + 12, mb, 16, 4, 2, 1);
}
break;
r->pipe->bind_vs_state(r->pipe, r->i_vs);
r->pipe->bind_fs_state(r->pipe, r->i_fs);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_INTRA] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[0]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[1]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[0]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[1]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->b_vs[0]);
r->pipe->bind_fs_state(r->pipe, r->b_fs[0]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 16;
}
if (num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0) {
r->pipe->bind_vs_state(r->pipe, r->b_vs[1]);
r->pipe->bind_fs_state(r->pipe, r->b_fs[1]);
- util_draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start,
- num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24);
- vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24;
+ util_draw_arrays(r->pipe, PIPE_PRIM_QUADS, vb_start,
+ num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 16);
+ vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 16;
}
r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);