diff --git a/src/oapv.c b/src/oapv.c index 696be50..6d29453 100644 --- a/src/oapv.c +++ b/src/oapv.c @@ -797,7 +797,7 @@ static int enc_tile_comp(oapv_bs_t *bs, oapve_tile_t *tile, oapve_ctx_t *ctx, oa ctx->fn_enc_blk(ctx, core, OAPV_LOG2_BLK_W, OAPV_LOG2_BLK_H, c); oapve_vlc_dc_coef(bs, core->dc_diff, &core->kparam_dc[c]); oapve_vlc_ac_coef(bs, core->coef, &core->kparam_ac[c]); - DUMP_COEF(core->coef, OAPV_BLK_D, blk_x, blk_y, c); + DUMP_COEF(core->dc_diff, core->coef + 1, OAPV_BLK_D - 1, blk_x, blk_y, c); if(rec != NULL) { r16 = (s16 *)((u8 *)rec + blk_y * s_rec) + blk_x; @@ -1639,7 +1639,7 @@ static int dec_tile_comp(oapvd_tile_t *tile, oapvd_ctx_t *ctx, oapvd_core_t *cor // parse AC coefficient ret = oapvd_vlc_ac_coef(bs, core->coef, &core->kparam_ac[c]); oapv_assert_rv(OAPV_SUCCEEDED(ret), ret); - DUMP_COEF(core->coef, OAPV_BLK_D, blk_x, blk_y, c); + DUMP_COEF(core->dc_diff, core->coef + 1, OAPV_BLK_D - 1, blk_x, blk_y, c); // decode a block ret = dec_block(ctx, core, OAPV_LOG2_BLK_W, OAPV_LOG2_BLK_H, c); diff --git a/src/oapv_util.c b/src/oapv_util.c index f6a0cec..eed3b6c 100644 --- a/src/oapv_util.c +++ b/src/oapv_util.c @@ -401,13 +401,14 @@ void oapv_dump_string0(int cond, const char *fmt, ...) va_end(args); } -void oapv_dump_coef0(short *coef, int size, int x, int y, int c) +void oapv_dump_coef0(int dc, short *coef, int size, int x, int y, int c) { if(!DUMP_ENABLE_COEF || !oapv_is_dump) return; fprintf(oapv_fp_dump, "x pos : % d y pos : % d comp : % d\n", x, y, c); fprintf(oapv_fp_dump, "coef:"); + fprintf(oapv_fp_dump, " %d", dc); for(int i = 0; i < size; i++) { fprintf(oapv_fp_dump, " %d", coef[i]); } diff --git a/src/oapv_util.h b/src/oapv_util.h index 458ca45..834d0d4 100644 --- a/src/oapv_util.h +++ b/src/oapv_util.h @@ -171,7 +171,7 @@ extern FILE *oapv_fp_dump; extern int oapv_is_dump; void oapv_dump_string0(int cond, const char *fmt, ...); -void oapv_dump_coef0(short *coef, int size, int x, int y, int c); +void oapv_dump_coef0(int dc, short *coef, int size, int x, int y, int c); void oapv_dump_create0(int is_enc); void oapv_dump_delete0(); @@ -181,8 +181,8 @@ void oapv_dump_delete0(); #define DUMP_SET(val) oapv_is_dump = val #define DUMP_HLS(name, val) \ oapv_dump_string0(OAPV_DUMP_HLS, "%-34s: %12d\n", #name, val) -#define DUMP_COEF(coef, size, x, y, c) \ - oapv_dump_coef0(coef, size, x, y, c) +#define DUMP_COEF(dc, coef, size, x, y, c) \ + oapv_dump_coef0(dc, coef, size, x, y, c) #define DUMP_SAVE(id) long dump32u8i90432890_##id = ftell(oapv_fp_dump) #define DUMP_LOAD(id) fseek(oapv_fp_dump, dump32u8i90432890_##id, SEEK_SET) #else @@ -190,7 +190,7 @@ void oapv_dump_delete0(); #define DUMP_DELETE() #define DUMP_SET(val) #define DUMP_HLS(name, val) -#define DUMP_COEF(coef, size, args, ...) +#define DUMP_COEF(dc, coef, size, args, ...) #define DUMP_SAVE(id) #define DUMP_LOAD(id) #endif diff --git a/src/oapv_vlc.c b/src/oapv_vlc.c index 54cc783..d0ed8ae 100644 --- a/src/oapv_vlc.c +++ b/src/oapv_vlc.c @@ -450,6 +450,7 @@ int oapve_vlc_pbu_size(oapv_bs_t *bs, int pbu_size) int oapve_vlc_pbu_header(oapv_bs_t *bs, int pbu_type, int group_id) { + DUMP_HLS(pbu_size, 0); oapv_bsw_write(bs, pbu_type, 8); DUMP_HLS(pbu_type, pbu_type); oapv_bsw_write(bs, group_id, 16); @@ -466,6 +467,8 @@ int oapve_vlc_metadata(oapv_md_t *md, oapv_bs_t *bs) bs_pos_md = oapv_bsw_sink(bs); oapv_bsw_write(bs, 0, 32); // raw bitstream byte size (skip) + DUMP_SAVE(0); + DUMP_HLS(metadata_size, 0); oapv_mdp_t *mdp = md->md_payload; @@ -498,7 +501,10 @@ int oapve_vlc_metadata(oapv_md_t *md, oapv_bs_t *bs) } u32 md_size = (u32)((u8 *)oapv_bsw_sink(bs) - bs_pos_md) - 4; oapv_bsw_write_direct(bs_pos_md, md_size, 32); + DUMP_SAVE(1); + DUMP_LOAD(0); DUMP_HLS(metadata_size, md_size); + DUMP_LOAD(1); return OAPV_OK; }