[mythtv] [PATCH] xvmcvld picture quality

Terry Barnaby terry1 at beam.ltd.uk
Tue Sep 14 04:18:28 EDT 2004


Hi Ivor,

I will have a go. I was not sure about the Qmatrix stuff in the
ViaXvMC patch.
One other aspect I have noticed is that sometimes there seems
to be an issue with motion. This may be the source material (DVB-T).
I have yet to check the same scene with software decode so this
may be a red herring.

Terry

Ivor Hewitt wrote:
> This patch incorporates the qmatrix construction code from the old viaslice 
> code. For me, without this, the picture is blocky with vertical banding.
> 
> Please test.
> 
> Cheers,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: xvmcvldvideo.c
> ===================================================================
> RCS file: /var/lib/mythcvs/mythtv/libs/libavcodec/xvmcvldvideo.c,v
> retrieving revision 1.2
> diff -u -3 -p -u -r1.2 xvmcvldvideo.c
> --- xvmcvldvideo.c	13 Sep 2004 14:51:28 -0000	1.2
> +++ xvmcvldvideo.c	13 Sep 2004 21:07:09 -0000
> @@ -70,22 +70,55 @@ int XVMC_VLD_field_start(MpegEncContext*
>          render->p_past_surface = findPastSurface(s, render);
>          render->p_future_surface = findFutureSurface(s);
>          if (!render->p_past_surface)
> -            fprintf(stderr, "error: decoding B frame and past frameis null!");
> +            av_log(avctx, AV_LOG_ERROR, "error: decoding B frame and past frameis null!");
>          else if (!render->p_future_surface)
> -            fprintf(stderr, "error: decoding B frame and future frame is null!");
> +            av_log(avctx, AV_LOG_ERROR, "error: decoding B frame and future frame is null!");
>          break;
>      case  P_TYPE:
>          render->p_past_surface = findPastSurface(s, render);
>          if (!render->p_past_surface)
> -            fprintf(stderr, "error: decoding P frame and past frameis null!");
> +            av_log(avctx, AV_LOG_ERROR, "error: decoding P frame and past frameis null!");
>          break;
>      }
>  
> -    for (i = 0; i < 64; i++)
> +    int j;
> +
> +    unsigned long *qm;
> +
> +    for (i=0, j=0; j < 16; i += 4, j += 2)
> +    {
> +        qm = &qmatrix.intra_quantiser_matrix;
> +
> +        qm[j+1] =
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+0] ] >> 8) << 0 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+1] ] >> 8) << 8 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+2] ] >> 8) << 16 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+3] ] >> 8) << 24;
> +
> +        qm[j+0] =
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+0] ] & 0xff) << 0 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+1] ] & 0xff) << 8 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+2] ] & 0xff) << 16 |
> +          (s->intra_matrix[ s->intra_scantable.permutated[i+3] ] & 0xff) << 24;
> +    }
> +
> +    for (i = 0, j = 0; j < 16; i += 4, j += 2)
>      {
> -        qmatrix.intra_quantiser_matrix[i] = s->intra_matrix[i];
> -        qmatrix.non_intra_quantiser_matrix[i] = s->inter_matrix[i];
> +        qm = &qmatrix.non_intra_quantiser_matrix;
> +
> +        qm[j+1] =
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+0] ] >> 8) << 0 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+1] ] >> 8) << 8 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+2] ] >> 8) << 16 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+3] ] >> 8) << 24;
> +
> +        qm[j+0] =
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+0] ] & 0xff) << 0 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+1] ] & 0xff) << 8 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+2] ] & 0xff) << 16 |
> +          (s->inter_matrix[ s->inter_scantable.permutated[i+3] ] & 0xff) << 24;
>      }
> +
>      qmatrix.load_intra_quantiser_matrix = 1;
>      qmatrix.load_non_intra_quantiser_matrix = 1;
>  
> @@ -116,7 +149,7 @@ int XVMC_VLD_field_start(MpegEncContext*
>      case I_TYPE:    binfo.picture_coding_type = XVMC_I_PICTURE;     break;
>      case P_TYPE:    binfo.picture_coding_type = XVMC_P_PICTURE;     break;
>      case B_TYPE:    binfo.picture_coding_type = XVMC_B_PICTURE;     break;
> -    default:    fprintf(stderr, "%s: Unknown picture coding type: %d\n", __FUNCTION__, s->pict_type);
> +    default:    av_log(avctx, AV_LOG_ERROR, "%s: Unknown picture coding type: %d\n", __FUNCTION__, s->pict_type);
>      }
>  
>      binfo.intra_dc_precision = s->intra_dc_precision;;
> @@ -142,13 +175,13 @@ int XVMC_VLD_field_start(MpegEncContext*
>  
>      status = XvMCLoadQMatrix(render->disp, render->ctx, &qmatrix);
>      if (status)
> -        fprintf(stderr, "XvMCLoadQMatrix: Error: %d\n", status);
> +        av_log(avctx,AV_LOG_ERROR, "XvMCLoadQMatrix: Error: %d\n", status);
>  
>      status = XvMCBeginSurface(render->disp, render->ctx, render->p_surface, 
>                                render->p_past_surface, render->p_future_surface,
>                                &binfo);
>      if (status)
> -        fprintf(stderr, "XvMCBeginSurface: Error: %d\n", status);
> +        av_log(avctx,AV_LOG_ERROR, "XvMCBeginSurface: Error: %d\n", status);
>  
>      return 0;
>  }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

-- 
Dr Terry Barnaby                     BEAM Ltd
Phone: +44 1454 324512               Northavon Business Center, Dean Rd
Fax:   +44 1454 313172               Yate, Bristol, BS37 5NH, UK
Email: terry at beam.ltd.uk             Web: www.beam.ltd.uk
BEAM for: Visually Impaired X-Terminals, Parallel Processing, Software
                       "Tandems are twice the fun !"


More information about the mythtv-dev mailing list