Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-126

Quantization SNR

Problem

Return the signal-to-quantization-noise ratio in dB of an ideal n-bit uniform quantizer:

SNR_dB = 6.02 * n + 1.76

This is the familiar 6 dB per bit rule.

Hint

Each additional bit halves the step size and adds roughly 6 dB.

Test cases

case 1
in: [8]
expected: 49.919999999999995
case 2
in: [16]
expected: 98.08
case 3
in: [1]
expected: 7.779999999999999
case 4
in: [12]
expected: 74
Starter codePython
def quantization_snr_db(bits):
    # Your code here
    pass

4 test cases · run your code against them in the editor