• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #include <stdio.h>
21 #include <string.h>
22 #include <math.h>
23 
24 #include "impd_type_def.h"
25 #include "impd_drc_bitbuffer.h"
26 #include "impd_drc_common.h"
27 #include "impd_drc_interface.h"
28 #include "impd_drc_extr_delta_coded_info.h"
29 #include "impd_drc_struct.h"
30 
impd_unidrc_interface_signature_read(ia_bit_buf_struct * it_bit_buff,ia_drc_uni_interface_signat_struct * drc_uni_interface_signature)31 WORD32 impd_unidrc_interface_signature_read(
32     ia_bit_buf_struct* it_bit_buff,
33     ia_drc_uni_interface_signat_struct* drc_uni_interface_signature) {
34   // WORD32 err = 0
35   WORD32 interface_signat_data_len = 0, i, tmp;
36 
37   tmp = impd_read_bits_buf(it_bit_buff, 16);
38   if (it_bit_buff->error) return it_bit_buff->error;
39 
40   drc_uni_interface_signature->interface_signat_type = (tmp >> 8) & 0xff;
41   drc_uni_interface_signature->interface_signat_data_len = tmp & 0xff;
42 
43   interface_signat_data_len =
44       drc_uni_interface_signature->interface_signat_data_len + 1;
45   for (i = 0; i < interface_signat_data_len; i++) {
46     tmp = impd_read_bits_buf(it_bit_buff, 8);
47     if (it_bit_buff->error) return it_bit_buff->error;
48     drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
49   }
50 
51   return (0);
52 }
impd_sys_interface_read(ia_bit_buf_struct * it_bit_buff,ia_system_interface_struct * system_interface)53 WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
54                                ia_system_interface_struct* system_interface) {
55   // WORD32 err = 0;
56   WORD32 i = 0, tmp = 0;
57 
58   system_interface->target_config_request_type =
59       impd_read_bits_buf(it_bit_buff, 2);
60   if (it_bit_buff->error) return it_bit_buff->error;
61 
62   switch (system_interface->target_config_request_type) {
63     case 0:
64       system_interface->num_downmix_id_requests =
65           impd_read_bits_buf(it_bit_buff, 4);
66       if (it_bit_buff->error) return it_bit_buff->error;
67 
68       if (system_interface->num_downmix_id_requests == 0) {
69         system_interface->num_downmix_id_requests = 1;
70         system_interface->requested_dwnmix_id[0] = 0;
71         break;
72       }
73       for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
74         system_interface->requested_dwnmix_id[i] =
75             impd_read_bits_buf(it_bit_buff, 7);
76         if (it_bit_buff->error) return it_bit_buff->error;
77       }
78       break;
79     case 1:
80       system_interface->requested_target_layout =
81           impd_read_bits_buf(it_bit_buff, 8);
82       if (it_bit_buff->error) return it_bit_buff->error;
83       break;
84     case 2:
85       tmp = impd_read_bits_buf(it_bit_buff, 7);
86       if (it_bit_buff->error) return it_bit_buff->error;
87       system_interface->requested_target_ch_count = tmp + 1;
88       break;
89     default:
90       return (1);
91       break;
92   }
93   return (0);
94 }
95 
impd_loudness_norm_control_interface_read(ia_bit_buf_struct * it_bit_buff,ia_loudness_norm_ctrl_interface_struct * loudness_norm_ctrl_interface)96 WORD32 impd_loudness_norm_control_interface_read(
97     ia_bit_buf_struct* it_bit_buff,
98     ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface) {
99   // WORD32 err = 0;
100   WORD32 tmp = 0;
101 
102   loudness_norm_ctrl_interface->loudness_normalization_on =
103       impd_read_bits_buf(it_bit_buff, 1);
104   if (it_bit_buff->error) return it_bit_buff->error;
105 
106   if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
107     tmp = impd_read_bits_buf(it_bit_buff, 12);
108     if (it_bit_buff->error) return it_bit_buff->error;
109     loudness_norm_ctrl_interface->target_loudness = -tmp * 0.03125f;
110   }
111   return (0);
112 }
113 
impd_loudness_norm_param_interface_read(ia_bit_buf_struct * it_bit_buff,ia_loudness_norm_parameter_interface_struct * loudness_norm_param_interface)114 WORD32 impd_loudness_norm_param_interface_read(
115     ia_bit_buf_struct* it_bit_buff, ia_loudness_norm_parameter_interface_struct*
116                                         loudness_norm_param_interface) {
117   // WORD32 err = 0;
118   WORD32 tmp = 0;
119 
120   tmp = impd_read_bits_buf(it_bit_buff, 3);
121   if (it_bit_buff->error) return it_bit_buff->error;
122 
123   loudness_norm_param_interface->album_mode = (tmp >> 2) & 1;
124   loudness_norm_param_interface->peak_limiter = (tmp >> 1) & 1;
125   loudness_norm_param_interface->change_loudness_deviation_max = tmp & 1;
126 
127   if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
128     loudness_norm_param_interface->loudness_deviation_max =
129         impd_read_bits_buf(it_bit_buff, 6);
130     if (it_bit_buff->error) return it_bit_buff->error;
131   }
132 
133   loudness_norm_param_interface->change_loudness_measur_method =
134       impd_read_bits_buf(it_bit_buff, 1);
135   if (it_bit_buff->error) return it_bit_buff->error;
136   if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
137     loudness_norm_param_interface->loudness_measurement_method =
138         impd_read_bits_buf(it_bit_buff, 3);
139     if (it_bit_buff->error) return it_bit_buff->error;
140   }
141 
142   loudness_norm_param_interface->change_loudness_measur_system =
143       impd_read_bits_buf(it_bit_buff, 1);
144   if (it_bit_buff->error) return it_bit_buff->error;
145   if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
146     loudness_norm_param_interface->loudness_measurement_system =
147         impd_read_bits_buf(it_bit_buff, 4);
148     if (it_bit_buff->error) return it_bit_buff->error;
149   }
150 
151   loudness_norm_param_interface->change_loudness_measur_pre_proc =
152       impd_read_bits_buf(it_bit_buff, 1);
153   if (it_bit_buff->error) return it_bit_buff->error;
154   if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
155     loudness_norm_param_interface->loudness_measurement_pre_proc =
156         impd_read_bits_buf(it_bit_buff, 2);
157     if (it_bit_buff->error) return it_bit_buff->error;
158   }
159 
160   loudness_norm_param_interface->change_device_cut_off_freq =
161       impd_read_bits_buf(it_bit_buff, 1);
162   if (it_bit_buff->error) return it_bit_buff->error;
163   if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
164     tmp = impd_read_bits_buf(it_bit_buff, 6);
165     if (it_bit_buff->error) return it_bit_buff->error;
166     loudness_norm_param_interface->device_cut_off_frequency =
167         max(min(tmp * 10, 500), 20);
168   }
169 
170   loudness_norm_param_interface->change_loudness_norm_gain_db_max =
171       impd_read_bits_buf(it_bit_buff, 1);
172   if (it_bit_buff->error) return it_bit_buff->error;
173   if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
174     tmp = impd_read_bits_buf(it_bit_buff, 6);
175     if (it_bit_buff->error) return it_bit_buff->error;
176     if (tmp < 63) {
177       loudness_norm_param_interface->loudness_norm_gain_db_max = tmp * 0.5f;
178     } else {
179       loudness_norm_param_interface->loudness_norm_gain_db_max =
180           LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
181     }
182   }
183 
184   loudness_norm_param_interface->change_loudness_norm_gain_modification_db =
185       impd_read_bits_buf(it_bit_buff, 1);
186   if (it_bit_buff->error) return it_bit_buff->error;
187   if (loudness_norm_param_interface
188           ->change_loudness_norm_gain_modification_db == 1) {
189     tmp = impd_read_bits_buf(it_bit_buff, 10);
190     if (it_bit_buff->error) return it_bit_buff->error;
191     loudness_norm_param_interface->loudness_norm_gain_modification_db =
192         -16 + tmp * 0.03125f;
193   }
194 
195   loudness_norm_param_interface->change_output_peak_level_max =
196       impd_read_bits_buf(it_bit_buff, 1);
197   if (it_bit_buff->error) return it_bit_buff->error;
198   if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
199     tmp = impd_read_bits_buf(it_bit_buff, 6);
200     if (it_bit_buff->error) return it_bit_buff->error;
201     loudness_norm_param_interface->output_peak_level_max = tmp * 0.5f;
202   }
203 
204   return (0);
205 }
206 
impd_drc_interface_read(ia_bit_buf_struct * it_bit_buff,ia_dyn_rng_ctrl_interface_struct * drc_ctrl_interface)207 WORD32 impd_drc_interface_read(
208     ia_bit_buf_struct* it_bit_buff,
209     ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface) {
210   // WORD32 err = 0;
211   WORD32 i = 0, j = 0, tmp = 0;
212 
213   drc_ctrl_interface->dynamic_range_control_on =
214       impd_read_bits_buf(it_bit_buff, 1);
215   if (it_bit_buff->error) return it_bit_buff->error;
216 
217   if (drc_ctrl_interface->dynamic_range_control_on == 1) {
218     drc_ctrl_interface->num_drc_feature_requests =
219         impd_read_bits_buf(it_bit_buff, 3);
220     if (it_bit_buff->error) return it_bit_buff->error;
221 
222     for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
223       drc_ctrl_interface->drc_feature_req_type[i] =
224           impd_read_bits_buf(it_bit_buff, 2);
225       if (it_bit_buff->error) return it_bit_buff->error;
226 
227       switch (drc_ctrl_interface->drc_feature_req_type[i]) {
228         case 0:
229           tmp = impd_read_bits_buf(it_bit_buff, 8);
230           if (it_bit_buff->error) return it_bit_buff->error;
231 
232           drc_ctrl_interface->requested_num_drc_effects[i] = (tmp >> 4) & 0xf;
233           drc_ctrl_interface->desired_num_drc_effects_of_requested[i] =
234               tmp & 0xf;
235 
236           for (j = 0; j < drc_ctrl_interface->requested_num_drc_effects[i];
237                j++) {
238             drc_ctrl_interface->requested_drc_effect_type[i][j] =
239                 impd_read_bits_buf(it_bit_buff, 4);
240             if (it_bit_buff->error) return it_bit_buff->error;
241           }
242           break;
243         case 1:
244           tmp = impd_read_bits_buf(it_bit_buff, 3);
245           if (it_bit_buff->error) return it_bit_buff->error;
246 
247           drc_ctrl_interface->requested_dyn_rng_measurement_type[i] =
248               (tmp >> 1) & 3;
249           drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] =
250               tmp & 1;
251 
252           if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] ==
253               0) {
254             tmp = impd_read_bits_buf(it_bit_buff, 8);
255             if (it_bit_buff->error) return it_bit_buff->error;
256             if (tmp == 0)
257               drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
258             else if (tmp <= 128)
259               drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
260             else if (tmp <= 204)
261               drc_ctrl_interface->requested_dyn_range_value[i] =
262                   0.5f * tmp - 32.0f;
263             else
264               drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
265           } else {
266             tmp = impd_read_bits_buf(it_bit_buff, 8);
267             if (it_bit_buff->error) return it_bit_buff->error;
268             if (tmp == 0)
269               drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
270             else if (tmp <= 128)
271               drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
272             else if (tmp <= 204)
273               drc_ctrl_interface->requested_dyn_range_min_val[i] =
274                   0.5f * tmp - 32.0f;
275             else
276               drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
277             tmp = impd_read_bits_buf(it_bit_buff, 8);
278             if (it_bit_buff->error) return it_bit_buff->error;
279             if (tmp == 0)
280               drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
281             else if (tmp <= 128)
282               drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
283             else if (tmp <= 204)
284               drc_ctrl_interface->requested_dyn_range_max_val[i] =
285                   0.5f * tmp - 32.0f;
286             else
287               drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
288           }
289           break;
290         case 2:
291           drc_ctrl_interface->requested_drc_characteristic[i] =
292               impd_read_bits_buf(it_bit_buff, 7);
293           if (it_bit_buff->error) return it_bit_buff->error;
294           break;
295         default:
296           return (1);
297           break;
298       }
299     }
300   }
301   return (0);
302 }
303 
impd_drc_param_interface_read(ia_bit_buf_struct * it_bit_buff,ia_drc_parameter_interface_struct * drc_parameter_interface)304 WORD32 impd_drc_param_interface_read(
305     ia_bit_buf_struct* it_bit_buff,
306     ia_drc_parameter_interface_struct* drc_parameter_interface) {
307   // WORD32 err = 0;
308   WORD32 tmp = 0;
309 
310   tmp = impd_read_bits_buf(it_bit_buff, 2);
311   if (it_bit_buff->error) return it_bit_buff->error;
312 
313   drc_parameter_interface->change_compress = (tmp >> 1) & 1;
314   drc_parameter_interface->change_boost = tmp & 1;
315 
316   if (drc_parameter_interface->change_compress == 1) {
317     tmp = impd_read_bits_buf(it_bit_buff, 8);
318     if (it_bit_buff->error) return it_bit_buff->error;
319     if (tmp < 255) {
320       drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
321     } else {
322       drc_parameter_interface->compress = 0.f;
323     }
324   }
325 
326   if (drc_parameter_interface->change_boost == 1) {
327     tmp = impd_read_bits_buf(it_bit_buff, 8);
328     if (it_bit_buff->error) return it_bit_buff->error;
329     if (tmp < 255) {
330       drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
331     } else {
332       drc_parameter_interface->boost = 0.f;
333     }
334   }
335 
336   drc_parameter_interface->change_drc_characteristic_target =
337       impd_read_bits_buf(it_bit_buff, 1);
338   if (it_bit_buff->error) return it_bit_buff->error;
339 
340   if (drc_parameter_interface->change_drc_characteristic_target == 1) {
341     drc_parameter_interface->drc_characteristic_target =
342         impd_read_bits_buf(it_bit_buff, 8);
343     if (it_bit_buff->error) return it_bit_buff->error;
344   }
345   return (0);
346 }
347 
impd_parse_loud_eq_param_interface(ia_bit_buf_struct * it_bit_buff,ia_loudness_eq_parameter_interface_struct * loudness_eq_parameter_interface)348 static WORD32 impd_parse_loud_eq_param_interface(
349     ia_bit_buf_struct* it_bit_buff, ia_loudness_eq_parameter_interface_struct*
350                                         loudness_eq_parameter_interface) {
351   // WORD32 err = 0;
352   WORD32 bsSensitivity, bsPlaybackGain;
353 
354   loudness_eq_parameter_interface->loudness_eq_request_flag =
355       impd_read_bits_buf(it_bit_buff, 1);
356   if (it_bit_buff->error) return it_bit_buff->error;
357   if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
358     loudness_eq_parameter_interface->loudness_eq_request =
359         impd_read_bits_buf(it_bit_buff, 2);
360     if (it_bit_buff->error) return it_bit_buff->error;
361   }
362   loudness_eq_parameter_interface->sensitivity_flag =
363       impd_read_bits_buf(it_bit_buff, 1);
364   if (it_bit_buff->error) return it_bit_buff->error;
365   if (loudness_eq_parameter_interface->sensitivity_flag) {
366     bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
367     if (it_bit_buff->error) return it_bit_buff->error;
368     loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
369   }
370   loudness_eq_parameter_interface->playback_gain_flag =
371       impd_read_bits_buf(it_bit_buff, 1);
372   if (it_bit_buff->error) return it_bit_buff->error;
373   if (loudness_eq_parameter_interface->playback_gain_flag) {
374     bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
375     if (it_bit_buff->error) return it_bit_buff->error;
376     loudness_eq_parameter_interface->playback_gain = (FLOAT32)-bsPlaybackGain;
377   }
378   return (0);
379 }
380 
381 WORD32
impd_unidrc_interface_extension_read(ia_bit_buf_struct * it_bit_buff,ia_drc_interface_struct * impd_drc_uni_interface,ia_drc_uni_interface_ext_struct * drc_uni_interface_ext)382 impd_unidrc_interface_extension_read(
383     ia_bit_buf_struct* it_bit_buff,
384     ia_drc_interface_struct* impd_drc_uni_interface,
385     ia_drc_uni_interface_ext_struct* drc_uni_interface_ext) {
386   WORD32 err = 0, i = 0, tmp = 0, dummy;
387   WORD32 uni_drc_interface_ext_type;
388   ia_specific_interface_extension_struct* specific_interface_ext;
389 
390   uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
391   if (it_bit_buff->error) return it_bit_buff->error;
392 
393   while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
394     specific_interface_ext =
395         &(drc_uni_interface_ext->specific_interface_ext[i]);
396     specific_interface_ext->uni_drc_interface_ext_type =
397         uni_drc_interface_ext_type;
398     tmp = impd_read_bits_buf(it_bit_buff, 4);
399     if (it_bit_buff->error) return it_bit_buff->error;
400     specific_interface_ext->ext_size_bits = tmp + 4;
401 
402     tmp =
403         impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_size_bits);
404     if (it_bit_buff->error) return it_bit_buff->error;
405 
406     specific_interface_ext->ext_bit_size = tmp + 1;
407 
408     switch (uni_drc_interface_ext_type) {
409       case UNIDRCINTERFACEEXT_EQ:
410         impd_drc_uni_interface->drc_uni_interface_ext
411             .loudness_eq_parameter_interface_flag =
412             impd_read_bits_buf(it_bit_buff, 1);
413         if (it_bit_buff->error) return it_bit_buff->error;
414         if (impd_drc_uni_interface->drc_uni_interface_ext
415                 .loudness_eq_parameter_interface_flag) {
416           err = impd_parse_loud_eq_param_interface(
417               it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext
418                                  .loudness_eq_parameter_interface));
419           if (err) return (err);
420         }
421         impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag =
422             impd_read_bits_buf(it_bit_buff, 1);
423         if (it_bit_buff->error) return it_bit_buff->error;
424         if (impd_drc_uni_interface->drc_uni_interface_ext
425                 .eq_ctrl_interface_flag) {
426           impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface
427               .eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
428           if (it_bit_buff->error) return it_bit_buff->error;
429         }
430         break;
431       default:
432         dummy = impd_read_bits_buf(it_bit_buff,
433                                    specific_interface_ext->ext_bit_size);
434         if (it_bit_buff->error) return it_bit_buff->error;
435         break;
436     }
437 
438     i++;
439     if (i == EXT_COUNT_MAX) {
440       return (1);
441     }
442     uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
443     if (it_bit_buff->error) return it_bit_buff->error;
444   }
445   drc_uni_interface_ext->interface_ext_count = i;
446   return (0);
447 }
impd_unidrc_interface_read(ia_bit_buf_struct * it_bit_buff,ia_drc_interface_struct * uniDrcInterface)448 WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
449                                   ia_drc_interface_struct* uniDrcInterface) {
450   WORD32 err = 0;
451 
452   uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
453   if (it_bit_buff->error) return it_bit_buff->error;
454   if (uniDrcInterface->interface_signat_flag == 1) {
455     err = impd_unidrc_interface_signature_read(
456         it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
457     if (err) return (err);
458   }
459 
460   uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
461   if (it_bit_buff->error) return it_bit_buff->error;
462   if (uniDrcInterface->system_interface_flag == 1) {
463     err = impd_sys_interface_read(it_bit_buff,
464                                   &(uniDrcInterface->system_interface));
465     if (err) return (err);
466   }
467 
468   uniDrcInterface->loudness_norm_ctrl_interface_flag =
469       impd_read_bits_buf(it_bit_buff, 1);
470   if (it_bit_buff->error) return it_bit_buff->error;
471   if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
472     err = impd_loudness_norm_control_interface_read(
473         it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
474     if (err) return (err);
475   }
476 
477   uniDrcInterface->loudness_norm_parameter_interface_flag =
478       impd_read_bits_buf(it_bit_buff, 1);
479   if (it_bit_buff->error) return it_bit_buff->error;
480   if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
481     err = impd_loudness_norm_param_interface_read(
482         it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
483     if (err) return (err);
484   }
485 
486   uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
487   if (it_bit_buff->error) return it_bit_buff->error;
488   if (uniDrcInterface->drc_interface_flag == 1) {
489     err = impd_drc_interface_read(it_bit_buff,
490                                   &(uniDrcInterface->drc_ctrl_interface));
491     if (err) return (err);
492   }
493 
494   uniDrcInterface->drc_parameter_interface_flag =
495       impd_read_bits_buf(it_bit_buff, 1);
496   if (it_bit_buff->error) return it_bit_buff->error;
497   if (uniDrcInterface->drc_parameter_interface_flag == 1) {
498     err = impd_drc_param_interface_read(
499         it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
500     if (err) return (err);
501   }
502 
503   uniDrcInterface->drc_uni_interface_ext_flag =
504       impd_read_bits_buf(it_bit_buff, 1);
505   if (it_bit_buff->error) return it_bit_buff->error;
506   if (uniDrcInterface->drc_uni_interface_ext_flag == 1) {
507     err = impd_unidrc_interface_extension_read(
508         it_bit_buff, uniDrcInterface,
509         &(uniDrcInterface->drc_uni_interface_ext));
510     if (err) return (err);
511   }
512 
513   return (0);
514 }