struct ureg_src sampler[4];
struct ureg_dst texel, ref, tmp;
struct ureg_dst fragment;
- unsigned i, label;
+ unsigned i;
shader = ureg_create(TGSI_PROCESSOR_FRAGMENT);
if (!shader)
ureg_MOV(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), ureg_scalar(ureg_src(ref), TGSI_SWIZZLE_X));
}
- /*
- ureg_MOD(shader, tmp, ureg_scalar(tc[4], TGSI_SWIZZLE_Y), ureg_scalar(ureg_imm1f(shader, 2), TGSI_SWIZZLE_Y));
- ureg_IF(shader, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y), &label);
- ureg_TEX(shader, ref, TGSI_TEXTURE_2D, tc[3], sampler[3]);
- ureg_ELSE(shader, &label);
- ureg_MOV(shader, ref, ureg_scalar(ureg_imm1f(shader, 0xFF), TGSI_SWIZZLE_X));
- ureg_TEX(shader, ref, TGSI_TEXTURE_2D, tc[4], sampler[3]);
- ureg_ENDIF(shader);
- */
-
ureg_TEX(shader, ref, TGSI_TEXTURE_2D, tc[4], sampler[3]);
ureg_MAD(shader, fragment, ureg_src(texel), ureg_scalar(ureg_imm1f(shader, SCALE_FACTOR_16_TO_9), TGSI_SWIZZLE_X), ureg_src(ref));
}
static void
-gen_block_verts(struct vert_stream_0 *vb, unsigned cbp, unsigned mbx, unsigned mby,
+gen_block_verts(struct vert_stream_0 *vb, struct pipe_mpeg12_macroblock *mb,
const struct vertex2f *unit, const struct vertex2f *half, const struct vertex2f *offset,
unsigned luma_mask, unsigned cb_mask, unsigned cr_mask,
bool use_zeroblocks, struct vertex2f *zero_blocks)
{
+ unsigned cbp = mb->cbp;
+ unsigned mbx = mb->mbx;
+ unsigned mby = mb->mby;
+
struct vertex2f v;
assert(vb);
or if zero blocks are being used, to the zero block if the appropriate CBP bits aren't set (i.e. no data
for this channel is defined for this block) */
- if (!use_zeroblocks || cbp & luma_mask) {
+ if (!use_zeroblocks || cbp & luma_mask || mb->dct_type == PIPE_MPEG12_DCT_TYPE_FIELD) {
v.x = mbx * unit->x + offset->x;
v.y = mby * unit->y + offset->y;
}
struct vert_stream_0 *vb = ycbcr_vb + pos * 24;
- gen_block_verts(vb, mb->cbp, mb->mbx, mb->mby,
+ gen_block_verts(vb, mb,
&unit, &half, &offsets[0][0],
32, 2, 1, use_zb, r->zero_block);
- gen_block_verts(vb + 6, mb->cbp, mb->mbx, mb->mby,
+ gen_block_verts(vb + 6, mb,
&unit, &half, &offsets[1][0],
16, 2, 1, use_zb, r->zero_block);
- gen_block_verts(vb + 12, mb->cbp, mb->mbx, mb->mby,
+ gen_block_verts(vb + 12, mb,
&unit, &half, &offsets[0][1],
8, 2, 1, use_zb, r->zero_block);
- gen_block_verts(vb + 18, mb->cbp, mb->mbx, mb->mby,
+ gen_block_verts(vb + 18, mb,
&unit, &half, &offsets[1][1],
4, 2, 1, use_zb, r->zero_block);
}
static void
-fill_zero_block(short *dst, unsigned dst_pitch)
+fill_frame_zero_block(short *dst, unsigned dst_pitch)
{
unsigned y;
memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2);
}
+static void
+fill_field_zero_block(short *dst, unsigned dst_pitch)
+{
+ unsigned y;
+
+ assert(dst);
+
+ for (y = 0; y < BLOCK_HEIGHT; ++y)
+ memset(dst + y * dst_pitch * 2, 0, BLOCK_WIDTH * 2);
+}
+
static void
grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
enum pipe_mpeg12_dct_type dct_type, unsigned cbp, short *blocks)
if ((cbp >> (5 - tb)) & 1) {
if (dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) {
grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT,
- texels + y * tex_pitch * BLOCK_WIDTH +
+ texels + y * tex_pitch * BLOCK_HEIGHT +
x * BLOCK_WIDTH, tex_pitch);
}
else {
++sb;
}
else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) {
- if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL ||
- ZERO_BLOCK_IS_NIL(r->zero_block[0])) {
- fill_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch);
- if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
- r->zero_block[0].x = (mbpx + x * 8) * r->surface_tex_inv_size.x;
- r->zero_block[0].y = (mbpy + y * 8) * r->surface_tex_inv_size.y;
+ if(dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) {
+
+ if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL ||
+ ZERO_BLOCK_IS_NIL(r->zero_block[0])) {
+
+ fill_frame_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch);
+ if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
+ r->zero_block[0].x = (mbpx + x * 8) * r->surface_tex_inv_size.x;
+ r->zero_block[0].y = (mbpy + y * 8) * r->surface_tex_inv_size.y;
+ }
}
}
+ else {
+
+ fill_field_zero_block(texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch);
+ }
}
}
}
else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) {
if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL ||
ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) {
- fill_zero_block(texels, tex_pitch);
+ fill_frame_zero_block(texels, tex_pitch);
if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
r->zero_block[tb + 1].x = (mbpx << 1) * r->surface_tex_inv_size.x;
r->zero_block[tb + 1].y = (mbpy << 1) * r->surface_tex_inv_size.y;