diff --git a/inc/oapv.h b/inc/oapv.h index 84dc1c2..d0638a1 100644 --- a/inc/oapv.h +++ b/inc/oapv.h @@ -532,7 +532,6 @@ struct oapve_param { int full_range_flag; }; -#define OAPV_CDESC_THREADS_AUTO 0 /***************************************************************************** * automatic assignment of number of threads in creation of encoder & decoder *****************************************************************************/ @@ -549,6 +548,8 @@ struct oapve_cdesc { int max_num_frms; // max number of threads (or OAPV_CDESC_THREADS_AUTO for auto-assignment) int threads; + // flag to disable 'raw bitstream format' + int disable_raw_bitstream_format; // encoding parameters oapve_param_t param[OAPV_MAX_NUM_FRAMES]; }; diff --git a/src/oapv.c b/src/oapv.c index ae70de4..70dee6b 100644 --- a/src/oapv.c +++ b/src/oapv.c @@ -1292,8 +1292,9 @@ int oapve_encode(oapve_t eid, oapv_frms_t *ifrms, oapvm_t mid, oapv_bitb_t *bitb { oapve_ctx_t *ctx; oapv_frm_t *frm; - oapv_bs_t *bs; + oapv_bs_t *bs, bs_pbu_beg; int i, ret; + u8 *bs_pos_pbu_beg, *bs_pos_au_beg; ctx = enc_id_to_ctx(eid); oapv_assert_rv(ctx != NULL && bitb->addr && bitb->bsize > 0, OAPV_ERR_INVALID_ARGUMENT); @@ -1303,11 +1304,10 @@ int oapve_encode(oapve_t eid, oapv_frms_t *ifrms, oapvm_t mid, oapv_bitb_t *bitb oapv_bsw_init(bs, bitb->addr, bitb->bsize, NULL); oapv_mset(stat, 0, sizeof(oapve_stat_t)); - u8 *bs_pos_au_beg = oapv_bsw_sink(bs); // address syntax of au size - u8 *bs_pos_pbu_beg; - oapv_bs_t bs_pbu_beg; - oapv_bsw_write(bs, 0, 32); // raw bitstream byte size (skip) - + if(!ctx->cdesc.disable_raw_bitstream_format) { + bs_pos_au_beg = oapv_bsw_sink(bs); // address syntax of au size + oapv_bsw_write(bs, 0, 32); // raw bitstream byte size (skip) + } oapv_bsw_write(bs, 0x61507631, 32); // signature ('aPv1') for(i = 0; i < ifrms->num_frms; i++) { @@ -1382,8 +1382,10 @@ int oapve_encode(oapve_t eid, oapv_frms_t *ifrms, oapvm_t mid, oapv_bitb_t *bitb } } - u32 au_size = (u32)((u8 *)oapv_bsw_sink(bs) - bs_pos_au_beg) - 4 /* au_size */; - oapv_bsw_write_direct(bs_pos_au_beg, au_size, 32); /* u(32) */ + if(!ctx->cdesc.disable_raw_bitstream_format) { + u32 au_size = (u32)((u8 *)oapv_bsw_sink(bs) - bs_pos_au_beg) - 4; + oapv_bsw_write_direct(bs_pos_au_beg, au_size, 32); + } oapv_bsw_deinit(&ctx->bs); /* de-init BSW */ stat->write = bsw_get_write_byte(&ctx->bs); diff --git a/src/oapv_param.c b/src/oapv_param.c index cc62d1a..d9553b2 100644 --- a/src/oapv_param.c +++ b/src/oapv_param.c @@ -62,7 +62,6 @@ int oapve_param_default(oapve_param_t *param) param->transfer_characteristics = 2; // unspecified transfer characteristics param->matrix_coefficients = 2; // unspecified matrix coefficients param->full_range_flag = 0; // limited range - return OAPV_OK; }