Commit c5562890 authored by Hendrik Leppkes's avatar Hendrik Leppkes Committed by Michael Niedermayer

dxva2_vc1: fix signaling of intensity compensation values

lumscale/lumshift don't get reset back to their default values if
intensity compensation is not active, and a wrong signaling here can
cause playback issues.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 719f1ce5
......@@ -38,6 +38,15 @@ static void fill_picture_parameters(AVCodecContext *avctx,
{
const MpegEncContext *s = &v->s;
const Picture *current_picture = s->current_picture_ptr;
int intcomp = 0;
// determine if intensity compensation is needed
if (s->pict_type == AV_PICTURE_TYPE_P) {
if ((v->fcm == ILACE_FRAME && v->intcomp) || (v->fcm != ILACE_FRAME && v->mv_mode == MV_PMODE_INTENSITY_COMP)) {
if (v->lumscale != 32 || v->lumshift != 0 || (s->picture_structure != PICT_FRAME && (v->lumscale2 != 32 && v->lumshift2 != 0)))
intcomp = 1;
}
}
memset(pp, 0, sizeof(*pp));
pp->wDecodedPictureIndex =
......@@ -74,7 +83,7 @@ static void fill_picture_parameters(AVCodecContext *avctx,
pp->bBidirectionalAveragingMode = (1 << 7) |
((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) |
((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
((v->lumscale != 32 || v->lumshift != 0) << 4) |
(intcomp << 4) |
((v->profile == PROFILE_ADVANCED) << 3);
pp->bMVprecisionAndChromaRelation = ((v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) |
(1 << 2) |
......@@ -125,12 +134,22 @@ static void fill_picture_parameters(AVCodecContext *avctx,
pp->bMV_RPS = (v->fcm == ILACE_FIELD && pp->bPicBackwardPrediction) ? v->refdist + 9 : 0;
pp->bReservedBits = v->pq;
if (s->picture_structure == PICT_FRAME) {
pp->wBitstreamFcodes = v->lumscale;
pp->wBitstreamPCEelements = v->lumshift;
if (intcomp) {
pp->wBitstreamFcodes = v->lumscale;
pp->wBitstreamPCEelements = v->lumshift;
} else {
pp->wBitstreamFcodes = 32;
pp->wBitstreamPCEelements = 0;
}
} else {
/* Syntax: (top_field_param << 8) | bottom_field_param */
pp->wBitstreamFcodes = (v->lumscale << 8) | v->lumscale;
pp->wBitstreamPCEelements = (v->lumshift << 8) | v->lumshift;
if (intcomp) {
pp->wBitstreamFcodes = (v->lumscale << 8) | v->lumscale2;
pp->wBitstreamPCEelements = (v->lumshift << 8) | v->lumshift2;
} else {
pp->wBitstreamFcodes = (32 << 8) | 32;
pp->wBitstreamPCEelements = 0;
}
}
pp->bBitstreamConcealmentNeed = 0;
pp->bBitstreamConcealmentMethod = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment