diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-10-08 16:23:00 +0400 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-10-08 16:23:00 +0400 |
commit | cd52a9ca9f26d6d4fac1b3815ac6d8109afa3738 (patch) | |
tree | 5e2944104acc46813f37933ae6486dcbfae0db15 /libavcodec/dnxhddec.c | |
parent | 5e301bbb70a50f16151cb2b6db4b1ede2e5453ac (diff) |
preliminary 10 bit depth decoding support, still miss generic api to export picture, working on it
Originally committed as revision 10686 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r-- | libavcodec/dnxhddec.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index ccd79c8995..baba5ef001 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -46,7 +46,7 @@ typedef struct { } DNXHDContext; #define DNXHD_VLC_BITS 9 -#define DNXHD_DC_VLC_BITS 6 +#define DNXHD_DC_VLC_BITS 7 static int dnxhd_decode_init(AVCodecContext *avctx) { @@ -72,7 +72,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, ctx->cid_table->ac_bits, 1, 1, ctx->cid_table->ac_codes, 2, 2, 0); - init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, 12, + init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->cid_table->bit_depth+4, ctx->cid_table->dc_bits, 1, 1, ctx->cid_table->dc_codes, 1, 1, 0); init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, @@ -198,9 +198,15 @@ static void dnxhd_decode_dct_block(DNXHDContext *ctx, DCTELEM *block, int n, int //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j); //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weigth %d\n", level, weigth_matrix[i]); level = (2*level+1) * qscale * weigth_matrix[i]; - if (weigth_matrix[i] != 32) // FIXME 10bit - level += 32; - level >>= 6; + if (ctx->cid_table->bit_depth == 10) { + if (weigth_matrix[i] != 8) + level += 8; + level >>= 4; + } else { + if (weigth_matrix[i] != 32) + level += 32; + level >>= 6; + } //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level); block[j] = (level^sign) - sign; } @@ -263,7 +269,7 @@ static int dnxhd_decode_macroblocks(DNXHDContext *ctx, uint8_t *buf, int buf_siz for (y = 0; y < ctx->mb_height; y++) { ctx->last_dc[0] = ctx->last_dc[1] = - ctx->last_dc[2] = 1024; // 1024 for levels +128 + ctx->last_dc[2] = 1<<(ctx->cid_table->bit_depth+2); // for levels +2^(bitdepth-1) init_get_bits(&ctx->gb, buf + ctx->mb_scan_index[y], (buf_size - ctx->mb_scan_index[y]) << 3); for (x = 0; x < ctx->mb_width; x++) { //START_TIMER; |