LCOV - code coverage report
Current view: top level - zephyr/libsbc - sbc.h Coverage Total Hit
Test: new.info Lines: 0.0 % 3 0
Test Date: 2025-09-05 22:20:39

            Line data    Source code
       1            0 : /*
       2              :  * Copyright 2024 NXP
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #include <stdint.h>
       8              : #include <stdbool.h>
       9              : #include <string.h>
      10              : #if defined(CONFIG_LIBSBC_ENCODER)
      11              : #include "sbc_encoder.h"
      12              : #endif
      13              : #if defined(CONFIG_LIBSBC_DECODER)
      14              : #include "oi_codec_sbc.h"
      15              : #include "oi_status.h"
      16              : #endif
      17              : 
      18            0 : enum __packed sbc_ch_mode {
      19              :         SBC_CH_MODE_MONO,
      20              :         SBC_CH_MODE_DUAL_CHANNEL,
      21              :         SBC_CH_MODE_STEREO,
      22              :         SBC_CH_MODE_JOINT_STEREO,
      23              : };
      24              : 
      25            0 : enum __packed sbc_alloc_mthd {
      26              :         SBC_ALLOC_MTHD_LOUDNESS,
      27              :         SBC_ALLOC_MTHD_SNR,
      28              : };
      29              : 
      30              : #if defined(CONFIG_LIBSBC_ENCODER)
      31              : 
      32              : struct sbc_encoder {
      33              :         SBC_ENC_PARAMS sbc_encoder_params;
      34              : };
      35              : 
      36              : struct sbc_encoder_init_param {
      37              :         uint32_t bit_rate;
      38              :         uint32_t samp_freq;
      39              :         uint8_t blk_len;
      40              :         uint8_t subband;
      41              :         enum sbc_alloc_mthd alloc_mthd;
      42              :         enum sbc_ch_mode ch_mode;
      43              :         uint8_t ch_num;
      44              :         uint8_t min_bitpool;
      45              :         uint8_t max_bitpool;
      46              : };
      47              : 
      48              : /**
      49              :  * Setup encoder
      50              :  * param     The init parameters.
      51              :  * return    Zero on success or (negative) error code otherwise.
      52              :  */
      53              : int sbc_setup_encoder(struct sbc_encoder *encoder, struct sbc_encoder_init_param *param);
      54              : 
      55              : /**
      56              :  * Encode a frame
      57              :  * encoder     Handle of the encoder
      58              :  * in_data     Input PCM samples
      59              :  * nbytes      Target size, in bytes, of the frame
      60              :  * out_data    Output buffer of `nbytes` size
      61              :  * return      Return number of bytes output
      62              :  */
      63              : uint32_t sbc_encode(struct sbc_encoder *encoder, const void *in_data, void *out_data);
      64              : 
      65              : /**
      66              :  * Return the number of PCM samples in a frame
      67              :  * encoder     Handle of the encoder.
      68              :  * return      Number of PCM samples or (negative) error code otherwise
      69              :  */
      70              : int sbc_frame_samples(struct sbc_encoder *encoder);
      71              : 
      72              : /**
      73              :  * Return the number of PCM bytes in a frame
      74              :  * encoder     Handle of the encoder.
      75              :  * return      Number of PCM bytes or (negative) error code otherwise
      76              :  */
      77              : int sbc_frame_bytes(struct sbc_encoder *encoder);
      78              : 
      79              : /**
      80              :  * Return the encoded size of one frame
      81              :  * encoder     Handle of the encoder.
      82              :  * return      The encoded size of one frame in bytes or (negative) error code otherwise
      83              :  */
      84              : int sbc_frame_encoded_bytes(struct sbc_encoder *encoder);
      85              : #endif
      86              : 
      87              : #if defined(CONFIG_LIBSBC_DECODER)
      88              : 
      89              : struct sbc_decoder {
      90              :         OI_CODEC_SBC_DECODER_CONTEXT context;
      91              :         uint32_t context_data[CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS)];
      92              : };
      93              : 
      94              : /**
      95              :  * Setup the SBC decoder.
      96              :  * decoder   Handle of the decoder
      97              :  *
      98              :  * return    Zero on success or (negative) error code otherwise.
      99              :  */
     100              : int sbc_setup_decoder(struct sbc_decoder *decoder);
     101              : 
     102              : /**
     103              :  * Decode a frame
     104              :  * decoder    Handle of the decoder
     105              :  * in_data    Input bitstream, it is increased after decode one frame
     106              :  * in_size    Input data size in bytes, it is decreased after decode one frame
     107              :  * out_data   Output PCM samples
     108              :  * out_size   Output data size in bytes
     109              :  * return     Zero on success or (negative) error code otherwise.
     110              :  */
     111              : int sbc_decode(struct sbc_decoder *decoder, const void **in_data, uint32_t *in_size,
     112              :                 void *out_data, uint32_t *out_size);
     113              : #endif
        

Generated by: LCOV version 2.0-1