summaryrefslogtreecommitdiff
path: root/cesar/mac/common/src/tonemap.c
diff options
context:
space:
mode:
authorJerome Jutteau2010-09-21 16:47:19 +0200
committerJerome Jutteau2010-09-29 14:22:20 +0200
commitc2d4434fa55569771de17f6e249bc5cab7c6b9d1 (patch)
tree86f089ad273f85ee3725fa1035c170e94dd6f345 /cesar/mac/common/src/tonemap.c
parent0f6e1ab724c3aeda2ec040d04454d1d4f81df51c (diff)
cesar/mac/common: increase and decrease tones from a tonemap, refs #1881
Diffstat (limited to 'cesar/mac/common/src/tonemap.c')
-rw-r--r--cesar/mac/common/src/tonemap.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/cesar/mac/common/src/tonemap.c b/cesar/mac/common/src/tonemap.c
index ebc6c0fca8..11c71c782f 100644
--- a/cesar/mac/common/src/tonemap.c
+++ b/cesar/mac/common/src/tonemap.c
@@ -248,6 +248,38 @@ tonemap_write_tone (tonemap_t *tm, uint index, uint tone)
*word_ptr = word;
}
+bool
+tonemap_decrease_tone (tonemap_t *tonemap, uint index)
+{
+ u32 *word_ptr = NULL;
+ u8 mod = tonemap_get_tone (tonemap, index, &word_ptr);
+
+ dbg_assert (word_ptr);
+
+ /* Already on the min modulation. */
+ if (mod == 0)
+ return false;
+ else
+ tonemap_write_tone_to_word (word_ptr, index, mod - 1);
+ return true;
+}
+
+bool
+tonemap_increase_tone (tonemap_t *tonemap, uint index)
+{
+ u32 *word_ptr = NULL;
+ u8 mod = tonemap_get_tone (tonemap, index, &word_ptr);
+
+ dbg_assert (word_ptr);
+
+ /* Already on the max modulation. */
+ if (mod == CE_MOD_COUNT - 1)
+ return false;
+ else
+ tonemap_write_tone_to_word (word_ptr, index, mod + 1);
+ return true;
+}
+
uint
tonemap_bits_per_pb (phy_mod_t mod, phy_fecrate_t fecrate,
phy_pb_size_t pb_size, uint bits_per_symbol)