ffmpeg | branch: master | Paul B Mahol <one...@gmail.com> | Fri Mar 30 21:08:47 2018 +0200| [5710fdaeae09529282862c984317bd9347d0865d] | committer: Paul B Mahol
avcodec/aic: fix decoding of videos which height is not multiple of 16 Fate output changes and under close inspection looks more correct. Fixes #6187. Signed-off-by: Paul B Mahol <one...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5710fdaeae09529282862c984317bd9347d0865d --- libavcodec/aic.c | 14 +++++- tests/ref/fate/aic | 30 ++++++------ tests/ref/fate/aic-oddsize | 114 ++++++++++++++++++++++----------------------- 3 files changed, 84 insertions(+), 74 deletions(-) diff --git a/libavcodec/aic.c b/libavcodec/aic.c index 67d78c5ddd..9c6f806655 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -308,6 +308,8 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, GetBitContext gb; int ret, i, mb, blk; int slice_width = FFMIN(ctx->slice_width, ctx->mb_width - mb_x); + int last_row = mb_y && mb_y == ctx->mb_height - 1; + int y_pos, c_pos; uint8_t *Y, *C[2]; uint8_t *dst; int16_t *base_y = ctx->data_ptr[COEFF_LUMA]; @@ -316,10 +318,18 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, int16_t *ext_c = ctx->data_ptr[COEFF_CHROMA_EXT]; const int ystride = ctx->frame->linesize[0]; - Y = ctx->frame->data[0] + mb_x * 16 + mb_y * 16 * ystride; + if (last_row) { + y_pos = (ctx->avctx->height - 16); + c_pos = ((ctx->avctx->height+1)/2 - 8); + } else { + y_pos = mb_y * 16; + c_pos = mb_y * 8; + } + + Y = ctx->frame->data[0] + mb_x * 16 + y_pos * ystride; for (i = 0; i < 2; i++) C[i] = ctx->frame->data[i + 1] + mb_x * 8 - + mb_y * 8 * ctx->frame->linesize[i + 1]; + + c_pos * ctx->frame->linesize[i + 1]; init_get_bits(&gb, src, src_size * 8); memset(ctx->slice_data, 0, diff --git a/tests/ref/fate/aic b/tests/ref/fate/aic index 1f50350b96..244ea25967 100644 --- a/tests/ref/fate/aic +++ b/tests/ref/fate/aic @@ -3,18 +3,18 @@ #codec_id 0: rawvideo #dimensions 0: 1440x1080 #sar 0: 4/3 -0, 0, 0, 1, 2332800, 0xd941b42f -0, 1, 1, 1, 2332800, 0xd941b42f -0, 2, 2, 1, 2332800, 0xae0f5983 -0, 3, 3, 1, 2332800, 0x51cfc127 -0, 4, 4, 1, 2332800, 0x24d40447 -0, 5, 5, 1, 2332800, 0x858a9f51 -0, 6, 6, 1, 2332800, 0x533b48e8 -0, 7, 7, 1, 2332800, 0x2fd73267 -0, 8, 8, 1, 2332800, 0x153566c7 -0, 9, 9, 1, 2332800, 0xa1c49c45 -0, 10, 10, 1, 2332800, 0xb966e25a -0, 11, 11, 1, 2332800, 0xd0ce5985 -0, 12, 12, 1, 2332800, 0x0029a52e -0, 13, 13, 1, 2332800, 0x893116c5 -0, 14, 14, 1, 2332800, 0x073d2491 +0, 0, 0, 1, 2332800, 0xc22b8485 +0, 1, 1, 1, 2332800, 0xc22b8485 +0, 2, 2, 1, 2332800, 0xe0c21bd8 +0, 3, 3, 1, 2332800, 0x3e1a8fa0 +0, 4, 4, 1, 2332800, 0xbcb3f235 +0, 5, 5, 1, 2332800, 0x1a7cabd6 +0, 6, 6, 1, 2332800, 0xc0136ba8 +0, 7, 7, 1, 2332800, 0x295e59a6 +0, 8, 8, 1, 2332800, 0xf9c09288 +0, 9, 9, 1, 2332800, 0x0518cc8f +0, 10, 10, 1, 2332800, 0x9ad3068e +0, 11, 11, 1, 2332800, 0x5a8b7af1 +0, 12, 12, 1, 2332800, 0x7b35a8fa +0, 13, 13, 1, 2332800, 0xbe5801eb +0, 14, 14, 1, 2332800, 0x31ca019f diff --git a/tests/ref/fate/aic-oddsize b/tests/ref/fate/aic-oddsize index 3763e32b2c..be4346a204 100644 --- a/tests/ref/fate/aic-oddsize +++ b/tests/ref/fate/aic-oddsize @@ -3,60 +3,60 @@ #codec_id 0: rawvideo #dimensions 0: 481x241 #sar 0: 0/1 -0, 0, 0, 1, 174243, 0xa40491e1 -0, 1, 1, 1, 174243, 0xa12cbb56 -0, 2, 2, 1, 174243, 0xa12cbb56 -0, 3, 3, 1, 174243, 0xa12cbb56 -0, 4, 4, 1, 174243, 0xa12cbb56 -0, 5, 5, 1, 174243, 0xa12cbb56 -0, 6, 6, 1, 174243, 0xa12cbb56 -0, 7, 7, 1, 174243, 0xa12cbb56 -0, 8, 8, 1, 174243, 0xa12cbb56 -0, 9, 9, 1, 174243, 0x4e7b7299 -0, 10, 10, 1, 174243, 0x31573b99 -0, 11, 11, 1, 174243, 0x013397b6 -0, 12, 12, 1, 174243, 0xdd988ab8 -0, 13, 13, 1, 174243, 0xd6d96b1e -0, 14, 14, 1, 174243, 0xd6d96b1e -0, 15, 15, 1, 174243, 0xd6d96b1e -0, 16, 16, 1, 174243, 0x111627d3 -0, 17, 17, 1, 174243, 0x284d9ab7 -0, 18, 18, 1, 174243, 0xa348c492 -0, 19, 19, 1, 174243, 0xa348c492 -0, 20, 20, 1, 174243, 0xa348c492 -0, 21, 21, 1, 174243, 0xa348c492 -0, 22, 22, 1, 174243, 0x2d22c3b8 -0, 23, 23, 1, 174243, 0x2d22c3b8 -0, 24, 24, 1, 174243, 0x2d22c3b8 -0, 25, 25, 1, 174243, 0x2d22c3b8 -0, 26, 26, 1, 174243, 0xa6d7c890 -0, 27, 27, 1, 174243, 0x8068bfbb -0, 28, 28, 1, 174243, 0x420ae647 -0, 29, 29, 1, 174243, 0xc5467756 -0, 30, 30, 1, 174243, 0x238a13dd -0, 31, 31, 1, 174243, 0x5bab75dc -0, 32, 32, 1, 174243, 0x14d7f61f -0, 33, 33, 1, 174243, 0x2e1d334f -0, 34, 34, 1, 174243, 0xeade7dc0 -0, 35, 35, 1, 174243, 0xeade7dc0 -0, 36, 36, 1, 174243, 0xeade7dc0 -0, 37, 37, 1, 174243, 0xeade7dc0 -0, 38, 38, 1, 174243, 0x088c7ef9 -0, 39, 39, 1, 174243, 0x70a3554e -0, 40, 40, 1, 174243, 0x0753d1d4 -0, 41, 41, 1, 174243, 0x8266bd6d -0, 42, 42, 1, 174243, 0x4ce3cda9 -0, 43, 43, 1, 174243, 0x4ce3cda9 -0, 44, 44, 1, 174243, 0x4ce3cda9 -0, 45, 45, 1, 174243, 0x4ce3cda9 -0, 46, 46, 1, 174243, 0xe5f7cd98 -0, 47, 47, 1, 174243, 0xe5f7cd98 -0, 48, 48, 1, 174243, 0xe5f7cd98 -0, 49, 49, 1, 174243, 0xe5f7cd98 -0, 50, 50, 1, 174243, 0x78c5cdb7 -0, 51, 51, 1, 174243, 0x78c5cdb7 -0, 52, 52, 1, 174243, 0x78c5cdb7 -0, 53, 53, 1, 174243, 0xce7ccd92 -0, 54, 54, 1, 174243, 0xce7ccd92 -0, 55, 55, 1, 174243, 0xce7ccd92 -0, 56, 56, 1, 174243, 0xce7ccd92 +0, 0, 0, 1, 174243, 0x15ab835b +0, 1, 1, 1, 174243, 0x12d3acd0 +0, 2, 2, 1, 174243, 0x12d3acd0 +0, 3, 3, 1, 174243, 0x12d3acd0 +0, 4, 4, 1, 174243, 0x12d3acd0 +0, 5, 5, 1, 174243, 0x12d3acd0 +0, 6, 6, 1, 174243, 0x12d3acd0 +0, 7, 7, 1, 174243, 0x12d3acd0 +0, 8, 8, 1, 174243, 0x12d3acd0 +0, 9, 9, 1, 174243, 0xb21561b4 +0, 10, 10, 1, 174243, 0x49343b5b +0, 11, 11, 1, 174243, 0x9bd65f49 +0, 12, 12, 1, 174243, 0xed3b9960 +0, 13, 13, 1, 174243, 0x14f70294 +0, 14, 14, 1, 174243, 0x14f70294 +0, 15, 15, 1, 174243, 0x14f70294 +0, 16, 16, 1, 174243, 0x92ac2316 +0, 17, 17, 1, 174243, 0x12729ac0 +0, 18, 18, 1, 174243, 0x6db0bfbd +0, 19, 19, 1, 174243, 0x6db0bfbd +0, 20, 20, 1, 174243, 0x6db0bfbd +0, 21, 21, 1, 174243, 0x6db0bfbd +0, 22, 22, 1, 174243, 0xd66cbef7 +0, 23, 23, 1, 174243, 0xd66cbef7 +0, 24, 24, 1, 174243, 0xd66cbef7 +0, 25, 25, 1, 174243, 0xd66cbef7 +0, 26, 26, 1, 174243, 0x3314c3d3 +0, 27, 27, 1, 174243, 0x34efb358 +0, 28, 28, 1, 174243, 0x7307d8c8 +0, 29, 29, 1, 174243, 0x80b57ea1 +0, 30, 30, 1, 174243, 0xb0b51bf9 +0, 31, 31, 1, 174243, 0x60c07516 +0, 32, 32, 1, 174243, 0xcc35033f +0, 33, 33, 1, 174243, 0x2bf12dc4 +0, 34, 34, 1, 174243, 0xf3025eb7 +0, 35, 35, 1, 174243, 0xf3025eb7 +0, 36, 36, 1, 174243, 0xf3025eb7 +0, 37, 37, 1, 174243, 0xf3025eb7 +0, 38, 38, 1, 174243, 0x06e761b3 +0, 39, 39, 1, 174243, 0xa21152fb +0, 40, 40, 1, 174243, 0xd6dcc575 +0, 41, 41, 1, 174243, 0xd6ceb82a +0, 42, 42, 1, 174243, 0x20efc206 +0, 43, 43, 1, 174243, 0x20efc206 +0, 44, 44, 1, 174243, 0x20efc206 +0, 45, 45, 1, 174243, 0x20efc206 +0, 46, 46, 1, 174243, 0xba03c1f5 +0, 47, 47, 1, 174243, 0xba03c1f5 +0, 48, 48, 1, 174243, 0xba03c1f5 +0, 49, 49, 1, 174243, 0xba03c1f5 +0, 50, 50, 1, 174243, 0x4cd1c214 +0, 51, 51, 1, 174243, 0x4cd1c214 +0, 52, 52, 1, 174243, 0x4cd1c214 +0, 53, 53, 1, 174243, 0xa288c1ef +0, 54, 54, 1, 174243, 0xa288c1ef +0, 55, 55, 1, 174243, 0xa288c1ef +0, 56, 56, 1, 174243, 0xa288c1ef _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog