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: 4 additions & 0 deletions code/src/common/fixedp11_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ float q_to_float(q16_t q, int frac) {
return ((float)q) * powf(2.0f, (float)-frac);
}

float qf2float(qf_t qf, int frac) {
return ((float)qf / (pow(2.0f, (float)frac)));
}

float qf_to_float(qf_t qf, int frac) {
return ((float)qf / (pow(2.0f, (float)frac) - 1.0)); // f = q / 255
}
Expand Down
3 changes: 3 additions & 0 deletions code/src/common/fixedp11_5.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ typedef uint8_t qf_t;
float q_to_float(q16_t q, int frac);

/// Converts between double and q8_t
// qf/2^frac
float qf2float(qf_t qf, int frac);
// q/(2^frac - 1)
float qf_to_float(qf_t q, int frac);

float db2lin(float db);
Expand Down
2 changes: 1 addition & 1 deletion code/src/iamf_dec/IAMF_OBU.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ IAMF_Parameter *iamf_parameter_new(IAMF_OBU *obu,
mg->mix_gain_f.control = db2lin(gain1_db);
mg->mix_gain.control_relative_time = bs_getA8b(&b);
mg->mix_gain_f.control_relative_time =
qf_to_float(mg->mix_gain.control_relative_time, 8);
qf2float(mg->mix_gain.control_relative_time, 8);
ia_logd("\t mix gain seg %d: interval %" PRIu64
", bezier, start %f (%fdb "
"<0x%02x>), end %f (%fdb <0x%02x>), control %f (%fdb "
Expand Down