Skip to main content
. 2021 Jul 5;21(13):4602. doi: 10.3390/s21134602
Algorithm 3 Initialize the array of the predicted offsets.
Require:M // the number of bits for ADPCM encoder.
Require: ck // the array of the initial values for C[N/4].
Ensure: C // the array used for the predicted offset amount.
 // When M=N/2
 for j=0 to 2N/2−1 do
   C[N/2][j]←ck
 end for
 // When M<N/2
 for i=N/2−1 downto 1 do
  forj=1 to 2i−1 do
    C[i][j−1]←(C[i+1][j×2−2]+C[i+1][j×2−1])/2
  end for
 end for
 // When M>N/2
 for i=N/2+1 to N do
   C[i][0]←C[i−1][0]
   j←2
  while j<2i−1 do
    C[i][j−1]←C[i−1][j/2−1]
    C[i][j]←(C[i−1][j/2−1]+C[i−1][j/2])/2
    j←j+2
  end while
   C[i][2i−1−1]←C[i−1][j/2−1]
 end for