summaryrefslogtreecommitdiff
path: root/libavcodec/dxa.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2013-08-17 12:36:36 +0200
committerJanne Grunau <janne-libav@jannau.net>2013-08-17 12:55:26 +0200
commitc34a96a5ddfa390ce2a352eca79190766c9056d4 (patch)
tree9c75b5f31cd74aeb54fa9fd3e2676503ff89ca3b /libavcodec/dxa.c
parent5ef7c84a9374681c64722a96d91741f3b990af2b (diff)
dxa: fix decoding of first I-frame by separating I/P-frame decoding
5ef7c84 broke decoding for the first keyframe due to an unnecessary check for a reference frame. CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/dxa.c')
-rw-r--r--libavcodec/dxa.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index ddc31f3413..30fd1cebc6 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -252,22 +252,27 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
}
break;
case 2:
- case 3:
case 4:
+ frame->key_frame = 1;
+ frame->pict_type = AV_PICTURE_TYPE_I;
+ for (j = 0; j < avctx->height; j++) {
+ memcpy(outptr, srcptr, avctx->width);
+ outptr += stride;
+ srcptr += avctx->width;
+ }
+ break;
+ case 3:
case 5:
if (!tmpptr) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
return AVERROR_INVALIDDATA;
}
- frame->key_frame = !(compr & 1);
- frame->pict_type = (compr & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
- for(j = 0; j < avctx->height; j++){
- if(compr & 1){
- for(i = 0; i < avctx->width; i++)
- outptr[i] = srcptr[i] ^ tmpptr[i];
- tmpptr += stride;
- }else
- memcpy(outptr, srcptr, avctx->width);
+ frame->key_frame = 0;
+ frame->pict_type = AV_PICTURE_TYPE_P;
+ for (j = 0; j < avctx->height; j++) {
+ for (i = 0; i < avctx->width; i++)
+ outptr[i] = srcptr[i] ^ tmpptr[i];
+ tmpptr += stride;
outptr += stride;
srcptr += avctx->width;
}