Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/oapv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/oapv_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/oapv_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -181,16 +181,16 @@ 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
#define DUMP_CREATE(is_enc)
#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
Expand Down
6 changes: 6 additions & 0 deletions src/oapv_vlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down