sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget2/translations/zh_CN/sound/designs/compress-offloadmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/zh_TW/sound/designs/compress-offloadmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/it_IT/sound/designs/compress-offloadmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/ja_JP/sound/designs/compress-offloadmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/ko_KR/sound/designs/compress-offloadmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/sp_SP/sound/designs/compress-offloadmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hALSA Compress-Offload APIh]hALSA Compress-Offload API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhL/var/lib/git/docbuild/linux/Documentation/sound/designs/compress-offload.rsthKubh paragraph)}(h;Pierre-Louis.Bossart h](hPierre-Louis.Bossart <}(hhhhhNhNubh reference)}(h$pierre-louis.bossart@linux.intel.comh]h$pierre-louis.bossart@linux.intel.com}(hhhhhNhNubah}(h]h ]h"]h$]h&]refuri+mailto:pierre-louis.bossart@linux.intel.comuh1hhhubh>}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h'Vinod Koul h](h Vinod Koul <}(hhhhhNhNubh)}(hvinod.koul@linux.intel.comh]hvinod.koul@linux.intel.com}(hhhhhNhNubah}(h]h ]h"]h$]h&]refuri!mailto:vinod.koul@linux.intel.comuh1hhhubh>}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hOverviewh]hOverview}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hSince its early days, the ALSA API was defined with PCM support or constant bitrates payloads such as IEC61937 in mind. Arguments and returned values in frames are the norm, making it a challenge to extend the existing API to compressed data streams.h]hSince its early days, the ALSA API was defined with PCM support or constant bitrates payloads such as IEC61937 in mind. Arguments and returned values in frames are the norm, making it a challenge to extend the existing API to compressed data streams.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXIn recent years, audio digital signal processors (DSP) were integrated in system-on-chip designs, and DSPs are also integrated in audio codecs. Processing compressed data on such DSPs results in a dramatic reduction of power consumption compared to host-based processing. Support for such hardware has not been very good in Linux, mostly because of a lack of a generic API available in the mainline kernel.h]hXIn recent years, audio digital signal processors (DSP) were integrated in system-on-chip designs, and DSPs are also integrated in audio codecs. Processing compressed data on such DSPs results in a dramatic reduction of power consumption compared to host-based processing. Support for such hardware has not been very good in Linux, mostly because of a lack of a generic API available in the mainline kernel.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hRather than requiring a compatibility break with an API change of the ALSA PCM interface, a new 'Compressed Data' API is introduced to provide a control and data-streaming interface for audio DSPs.h]hRather than requiring a compatibility break with an API change of the ALSA PCM interface, a new ‘Compressed Data’ API is introduced to provide a control and data-streaming interface for audio DSPs.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe design of this API was inspired by the 2-year experience with the Intel Moorestown SOC, with many corrections required to upstream the API in the mainline kernel instead of the staging tree and make it usable by others.h]hThe design of this API was inspired by the 2-year experience with the Intel Moorestown SOC, with many corrections required to upstream the API in the mainline kernel instead of the staging tree and make it usable by others.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(h Requirementsh]h Requirements}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhjPhhhhhK$ubh)}(hThe main requirements are:h]hThe main requirements are:}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjPhhubh bullet_list)}(hhh](h list_item)}(hXseparation between byte counts and time. Compressed formats may have a header per file, per frame, or no header at all. The payload size may vary from frame-to-frame. As a result, it is not possible to estimate reliably the duration of audio buffers when handling compressed data. Dedicated mechanisms are required to allow for reliable audio-video synchronization, which requires precise reporting of the number of samples rendered at any given time. h]h)}(hXseparation between byte counts and time. Compressed formats may have a header per file, per frame, or no header at all. The payload size may vary from frame-to-frame. As a result, it is not possible to estimate reliably the duration of audio buffers when handling compressed data. Dedicated mechanisms are required to allow for reliable audio-video synchronization, which requires precise reporting of the number of samples rendered at any given time.h]hXseparation between byte counts and time. Compressed formats may have a header per file, per frame, or no header at all. The payload size may vary from frame-to-frame. As a result, it is not possible to estimate reliably the duration of audio buffers when handling compressed data. Dedicated mechanisms are required to allow for reliable audio-video synchronization, which requires precise reporting of the number of samples rendered at any given time.}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjvubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubju)}(hXpHandling of multiple formats. PCM data only requires a specification of the sampling rate, number of channels and bits per sample. In contrast, compressed data comes in a variety of formats. Audio DSPs may also provide support for a limited number of audio encoders and decoders embedded in firmware, or may support more choices through dynamic download of libraries. h]h)}(hXoHandling of multiple formats. PCM data only requires a specification of the sampling rate, number of channels and bits per sample. In contrast, compressed data comes in a variety of formats. Audio DSPs may also provide support for a limited number of audio encoders and decoders embedded in firmware, or may support more choices through dynamic download of libraries.h]hXoHandling of multiple formats. PCM data only requires a specification of the sampling rate, number of channels and bits per sample. In contrast, compressed data comes in a variety of formats. Audio DSPs may also provide support for a limited number of audio encoders and decoders embedded in firmware, or may support more choices through dynamic download of libraries.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubju)}(hFocus on main formats. This API provides support for the most popular formats used for audio and video capture and playback. It is likely that as audio compression technology advances, new formats will be added. h]h)}(hFocus on main formats. This API provides support for the most popular formats used for audio and video capture and playback. It is likely that as audio compression technology advances, new formats will be added.h]hFocus on main formats. This API provides support for the most popular formats used for audio and video capture and playback. It is likely that as audio compression technology advances, new formats will be added.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubju)}(hXHandling of multiple configurations. Even for a given format like AAC, some implementations may support AAC multichannel but HE-AAC stereo. Likewise WMA10 level M3 may require too much memory and cpu cycles. The new API needs to provide a generic way of listing these formats. h]h)}(hXHandling of multiple configurations. Even for a given format like AAC, some implementations may support AAC multichannel but HE-AAC stereo. Likewise WMA10 level M3 may require too much memory and cpu cycles. The new API needs to provide a generic way of listing these formats.h]hXHandling of multiple configurations. Even for a given format like AAC, some implementations may support AAC multichannel but HE-AAC stereo. Likewise WMA10 level M3 may require too much memory and cpu cycles. The new API needs to provide a generic way of listing these formats.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hjubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubju)}(hXFRendering/Grabbing only. This API does not provide any means of hardware acceleration, where PCM samples are provided back to user-space for additional processing. This API focuses instead on streaming compressed data to a DSP, with the assumption that the decoded samples are routed to a physical output or logical back-end. h]h)}(hXERendering/Grabbing only. This API does not provide any means of hardware acceleration, where PCM samples are provided back to user-space for additional processing. This API focuses instead on streaming compressed data to a DSP, with the assumption that the decoded samples are routed to a physical output or logical back-end.h]hXERendering/Grabbing only. This API does not provide any means of hardware acceleration, where PCM samples are provided back to user-space for additional processing. This API focuses instead on streaming compressed data to a DSP, with the assumption that the decoded samples are routed to a physical output or logical back-end.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubju)}(hXComplexity hiding. Existing user-space multimedia frameworks all have existing enums/structures for each compressed format. This new API assumes the existence of a platform-specific compatibility layer to expose, translate and make use of the capabilities of the audio DSP, eg. Android HAL or PulseAudio sinks. By construction, regular applications are not supposed to make use of this API. h]h)}(hXComplexity hiding. Existing user-space multimedia frameworks all have existing enums/structures for each compressed format. This new API assumes the existence of a platform-specific compatibility layer to expose, translate and make use of the capabilities of the audio DSP, eg. Android HAL or PulseAudio sinks. By construction, regular applications are not supposed to make use of this API.h]hXComplexity hiding. Existing user-space multimedia frameworks all have existing enums/structures for each compressed format. This new API assumes the existence of a platform-specific compatibility layer to expose, translate and make use of the capabilities of the audio DSP, eg. Android HAL or PulseAudio sinks. By construction, regular applications are not supposed to make use of this API.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjubah}(h]h ]h"]h$]h&]uh1jthjqhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1johhhK'hjPhhubeh}(h] requirementsah ]h"] requirementsah$]h&]uh1hhhhhhhhK$ubh)}(hhh](h)}(hDesignh]hDesign}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKPubh)}(hThe new API shares a number of concepts with the PCM API for flow control. Start, pause, resume, drain and stop commands have the same semantics no matter what the content is.h]hThe new API shares a number of concepts with the PCM API for flow control. Start, pause, resume, drain and stop commands have the same semantics no matter what the content is.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjhhubh)}(hThe concept of memory ring buffer divided in a set of fragments is borrowed from the ALSA PCM API. However, only sizes in bytes can be specified.h]hThe concept of memory ring buffer divided in a set of fragments is borrowed from the ALSA PCM API. However, only sizes in bytes can be specified.}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKUhjhhubh)}(h8Seeks/trick modes are assumed to be handled by the host.h]h8Seeks/trick modes are assumed to be handled by the host.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjhhubh)}(hThe notion of rewinds/forwards is not supported. Data committed to the ring buffer cannot be invalidated, except when dropping all buffers.h]hThe notion of rewinds/forwards is not supported. Data committed to the ring buffer cannot be invalidated, except when dropping all buffers.}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjhhubh)}(hXThe Compressed Data API does not make any assumptions on how the data is transmitted to the audio DSP. DMA transfers from main memory to an embedded audio cluster or to a SPI interface for external DSPs are possible. As in the ALSA PCM case, a core set of routines is exposed; each driver implementer will have to write support for a set of mandatory routines and possibly make use of optional ones.h]hXThe Compressed Data API does not make any assumptions on how the data is transmitted to the audio DSP. DMA transfers from main memory to an embedded audio cluster or to a SPI interface for external DSPs are possible. As in the ALSA PCM case, a core set of routines is exposed; each driver implementer will have to write support for a set of mandatory routines and possibly make use of optional ones.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hjhhubh)}(hThe main additions areh]hThe main additions are}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjhhubhdefinition_list)}(hhh](hdefinition_list_item)}(hget_caps This routine returns the list of audio formats supported. Querying the codecs on a capture stream will return encoders, decoders will be listed for playback streams. h](hterm)}(hget_capsh]hget_caps}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKjhjubh definition)}(hhh]h)}(hThis routine returns the list of audio formats supported. Querying the codecs on a capture stream will return encoders, decoders will be listed for playback streams.h]hThis routine returns the list of audio formats supported. Querying the codecs on a capture stream will return encoders, decoders will be listed for playback streams.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKjhj}ubj)}(hXget_codec_caps For each codec, this routine returns a list of capabilities. The intent is to make sure all the capabilities correspond to valid settings, and to minimize the risks of configuration failures. For example, for a complex codec such as AAC, the number of channels supported may depend on a specific profile. If the capabilities were exposed with a single descriptor, it may happen that a specific combination of profiles/channels/formats may not be supported. Likewise, embedded DSPs have limited memory and cpu cycles, it is likely that some implementations make the list of capabilities dynamic and dependent on existing workloads. In addition to codec settings, this routine returns the minimum buffer size handled by the implementation. This information can be a function of the DMA buffer sizes, the number of bytes required to synchronize, etc, and can be used by userspace to define how much needs to be written in the ring buffer before playback can start. h](j)}(hget_codec_capsh]hget_codec_caps}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK{hjubj)}(hhh]h)}(hXFor each codec, this routine returns a list of capabilities. The intent is to make sure all the capabilities correspond to valid settings, and to minimize the risks of configuration failures. For example, for a complex codec such as AAC, the number of channels supported may depend on a specific profile. If the capabilities were exposed with a single descriptor, it may happen that a specific combination of profiles/channels/formats may not be supported. Likewise, embedded DSPs have limited memory and cpu cycles, it is likely that some implementations make the list of capabilities dynamic and dependent on existing workloads. In addition to codec settings, this routine returns the minimum buffer size handled by the implementation. This information can be a function of the DMA buffer sizes, the number of bytes required to synchronize, etc, and can be used by userspace to define how much needs to be written in the ring buffer before playback can start.h]hXFor each codec, this routine returns a list of capabilities. The intent is to make sure all the capabilities correspond to valid settings, and to minimize the risks of configuration failures. For example, for a complex codec such as AAC, the number of channels supported may depend on a specific profile. If the capabilities were exposed with a single descriptor, it may happen that a specific combination of profiles/channels/formats may not be supported. Likewise, embedded DSPs have limited memory and cpu cycles, it is likely that some implementations make the list of capabilities dynamic and dependent on existing workloads. In addition to codec settings, this routine returns the minimum buffer size handled by the implementation. This information can be a function of the DMA buffer sizes, the number of bytes required to synchronize, etc, and can be used by userspace to define how much needs to be written in the ring buffer before playback can start.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKmhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhK{hj}hhubj)}(hset_params This routine sets the configuration chosen for a specific codec. The most important field in the parameters is the codec type; in most cases decoders will ignore other fields, while encoders will strictly comply to the settings h](j)}(h set_paramsh]h set_params}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(hThis routine sets the configuration chosen for a specific codec. The most important field in the parameters is the codec type; in most cases decoders will ignore other fields, while encoders will strictly comply to the settingsh]hThis routine sets the configuration chosen for a specific codec. The most important field in the parameters is the codec type; in most cases decoders will ignore other fields, while encoders will strictly comply to the settings}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhj}hhubj)}(h{get_params This routines returns the actual settings used by the DSP. Changes to the settings should remain the exception. h](j)}(h get_paramsh]h get_params}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(hoThis routines returns the actual settings used by the DSP. Changes to the settings should remain the exception.h]hoThis routines returns the actual settings used by the DSP. Changes to the settings should remain the exception.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj%ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhj}hhubj)}(hX]get_timestamp The timestamp becomes a multiple field structure. It lists the number of bytes transferred, the number of samples processed and the number of samples rendered/grabbed. All these values can be used to determine the average bitrate, figure out if the ring buffer needs to be refilled or the delay due to decoding/encoding/io on the DSP. h](j)}(h get_timestamph]h get_timestamp}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjBubj)}(hhh]h)}(hXNThe timestamp becomes a multiple field structure. It lists the number of bytes transferred, the number of samples processed and the number of samples rendered/grabbed. All these values can be used to determine the average bitrate, figure out if the ring buffer needs to be refilled or the delay due to decoding/encoding/io on the DSP.h]hXNThe timestamp becomes a multiple field structure. It lists the number of bytes transferred, the number of samples processed and the number of samples rendered/grabbed. All these values can be used to determine the average bitrate, figure out if the ring buffer needs to be refilled or the delay due to decoding/encoding/io on the DSP.}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjTubah}(h]h ]h"]h$]h&]uh1jhjBubeh}(h]h ]h"]h$]h&]uh1jhhhKhj}hhubeh}(h]h ]h"]h$]h&]uh1j{hjhhhhhNubh)}(hXKNote that the list of codecs/profiles/modes was derived from the OpenMAX AL specification instead of reinventing the wheel. Modifications include: - Addition of FLAC and IEC formats - Merge of encoder/decoder capabilities - Profiles/modes listed as bitmasks to make descriptors more compact - Addition of set_params for decoders (missing in OpenMAX AL) - Addition of AMR/AMR-WB encoding modes (missing in OpenMAX AL) - Addition of format information for WMA - Addition of encoding options when required (derived from OpenMAX IL) - Addition of rateControlSupported (missing in OpenMAX AL)h]hXKNote that the list of codecs/profiles/modes was derived from the OpenMAX AL specification instead of reinventing the wheel. Modifications include: - Addition of FLAC and IEC formats - Merge of encoder/decoder capabilities - Profiles/modes listed as bitmasks to make descriptors more compact - Addition of set_params for decoders (missing in OpenMAX AL) - Addition of AMR/AMR-WB encoding modes (missing in OpenMAX AL) - Addition of format information for WMA - Addition of encoding options when required (derived from OpenMAX IL) - Addition of rateControlSupported (missing in OpenMAX AL)}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]designah ]h"]designah$]h&]uh1hhhhhhhhKPubh)}(hhh](h)}(h State Machineh]h State Machine}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h?The compressed audio stream state machine is described below ::h]h| RUNNING |--------------------------+ | | | | | | | +----------+ +----------+ | | | | ^ | | |compr_free() | | | | | compr_pause() | | compr_resume() | | | | | | | v v | | | +----------+ +----------+ | | | | | | compr_stop() | +--->| FREE | | PAUSE |---------------------------+ | | | | +----------+ +----------+h]hX +----------+ | | | OPEN | | | +----------+ | | | compr_set_params() | v compr_free() +----------+ +------------------------------------| | | | SETUP | | +-------------------------| |<-------------------------+ | | compr_write() +----------+ | | | ^ | | | | compr_drain_notify() | | | | or | | | | compr_stop() | | | | | | | +----------+ | | | | | | | | | DRAIN | | | | | | | | | +----------+ | | | ^ | | | | | | | | compr_drain() | | | | | | v | | | +----------+ +----------+ | | | | compr_start() | | compr_stop() | | | PREPARE |------------------->| RUNNING |--------------------------+ | | | | | | | +----------+ +----------+ | | | | ^ | | |compr_free() | | | | | compr_pause() | | compr_resume() | | | | | | | v v | | | +----------+ +----------+ | | | | | | compr_stop() | +--->| FREE | | PAUSE |---------------------------+ | | | | +----------+ +----------+}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhKhjhhubeh}(h] state-machineah ]h"] state machineah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hGapless Playbackh]hGapless Playback}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX When playing thru an album, the decoders have the ability to skip the encoder delay and padding and directly move from one track content to another. The end user can perceive this as gapless playback as we don't have silence while switching from one track to anotherh]hX When playing thru an album, the decoders have the ability to skip the encoder delay and padding and directly move from one track content to another. The end user can perceive this as gapless playback as we don’t have silence while switching from one track to another}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXAlso, there might be low-intensity noises due to encoding. Perfect gapless is difficult to reach with all types of compressed data, but works fine with most music content. The decoder needs to know the encoder delay and encoder padding. So we need to pass this to DSP. This metadata is extracted from ID3/MP4 headers and are not present by default in the bitstream, hence the need for a new interface to pass this information to the DSP. Also DSP and userspace needs to switch from one track to another and start using data for second track.h]hXAlso, there might be low-intensity noises due to encoding. Perfect gapless is difficult to reach with all types of compressed data, but works fine with most music content. The decoder needs to know the encoder delay and encoder padding. So we need to pass this to DSP. This metadata is extracted from ID3/MP4 headers and are not present by default in the bitstream, hence the need for a new interface to pass this information to the DSP. Also DSP and userspace needs to switch from one track to another and start using data for second track.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hThe main additions are:h]hThe main additions are:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj|)}(hhh](j)}(hset_metadata This routine sets the encoder delay and encoder padding. This can be used by decoder to strip the silence. This needs to be set before the data in the track is written. h](j)}(h set_metadatah]h set_metadata}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(hThis routine sets the encoder delay and encoder padding. This can be used by decoder to strip the silence. This needs to be set before the data in the track is written.h]hThis routine sets the encoder delay and encoder padding. This can be used by decoder to strip the silence. This needs to be set before the data in the track is written.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(h}set_next_track This routine tells DSP that metadata and write operation sent after this would correspond to subsequent track h](j)}(hset_next_trackh]hset_next_track}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj3ubj)}(hhh]h)}(hmThis routine tells DSP that metadata and write operation sent after this would correspond to subsequent trackh]hmThis routine tells DSP that metadata and write operation sent after this would correspond to subsequent track}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjEubah}(h]h ]h"]h$]h&]uh1jhj3ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hpartial drain This is called when end of file is reached. The userspace can inform DSP that EOF is reached and now DSP can start skipping padding delay. Also next write data would belong to next track h](j)}(h partial drainh]h partial drain}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjbubj)}(hhh]h)}(hThis is called when end of file is reached. The userspace can inform DSP that EOF is reached and now DSP can start skipping padding delay. Also next write data would belong to next trackh]hThis is called when end of file is reached. The userspace can inform DSP that EOF is reached and now DSP can start skipping padding delay. Also next write data would belong to next track}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjtubah}(h]h ]h"]h$]h&]uh1jhjbubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1j{hjhhhhhNubh)}(hXSequence flow for gapless would be: - Open - Get caps / codec caps - Set params - Set metadata of the first track - Fill data of the first track - Trigger start - User-space finished sending all, - Indicate next track data by sending set_next_track - Set metadata of the next track - then call partial_drain to flush most of buffer in DSP - Fill data of the next track - DSP switches to second trackh]hXSequence flow for gapless would be: - Open - Get caps / codec caps - Set params - Set metadata of the first track - Fill data of the first track - Trigger start - User-space finished sending all, - Indicate next track data by sending set_next_track - Set metadata of the next track - then call partial_drain to flush most of buffer in DSP - Fill data of the next track - DSP switches to second track}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hP(note: order for partial_drain and write for next track can be reversed as well)h]hP(note: order for partial_drain and write for next track can be reversed as well)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]gapless-playbackah ]h"]gapless playbackah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hGapless Playback SMh]hGapless Playback SM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hFor Gapless, we move from running state to partial drain and back, along with setting of meta_data and signalling for next track ::h]hFor Gapless, we move from running state to partial drain and back, along with setting of meta_data and signalling for next track}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hX +----------+ compr_drain_notify() | | +------------------------>| RUNNING | | | | | +----------+ | | | | | | compr_next_track() | | | V | +----------+ | compr_set_params() | | | +-----------|NEXT_TRACK| | | | | | | +--+-------+ | | | | | +--------------+ | | | | | compr_partial_drain() | | | V | +----------+ | | | +------------------------ | PARTIAL_ | | DRAIN | +----------+h]hX +----------+ compr_drain_notify() | | +------------------------>| RUNNING | | | | | +----------+ | | | | | | compr_next_track() | | | V | +----------+ | compr_set_params() | | | +-----------|NEXT_TRACK| | | | | | | +--+-------+ | | | | | +--------------+ | | | | | compr_partial_drain() | | | V | +----------+ | | | +------------------------ | PARTIAL_ | | DRAIN | +----------+}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubeh}(h]gapless-playback-smah ]h"]gapless playback smah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Not supportedh]h Not supported}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM ubjp)}(hhh](ju)}(hSupport for VoIP/circuit-switched calls is not the target of this API. Support for dynamic bit-rate changes would require a tight coupling between the DSP and the host stack, limiting power savings. h]h)}(hSupport for VoIP/circuit-switched calls is not the target of this API. Support for dynamic bit-rate changes would require a tight coupling between the DSP and the host stack, limiting power savings.h]hSupport for VoIP/circuit-switched calls is not the target of this API. Support for dynamic bit-rate changes would require a tight coupling between the DSP and the host stack, limiting power savings.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hPacket-loss concealment is not supported. This would require an additional interface to let the decoder synthesize data when frames are lost during transmission. This may be added in the future. h]h)}(hPacket-loss concealment is not supported. This would require an additional interface to let the decoder synthesize data when frames are lost during transmission. This may be added in the future.h]hPacket-loss concealment is not supported. This would require an additional interface to let the decoder synthesize data when frames are lost during transmission. This may be added in the future.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hVolume control/routing is not handled by this API. Devices exposing a compressed data interface will be considered as regular ALSA devices; volume changes and routing information will be provided with regular ALSA kcontrols. h]h)}(hVolume control/routing is not handled by this API. Devices exposing a compressed data interface will be considered as regular ALSA devices; volume changes and routing information will be provided with regular ALSA kcontrols.h]hVolume control/routing is not handled by this API. Devices exposing a compressed data interface will be considered as regular ALSA devices; volume changes and routing information will be provided with regular ALSA kcontrols.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hj4ubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hyEmbedded audio effects. Such effects should be enabled in the same manner, no matter if the input was PCM or compressed. h]h)}(hxEmbedded audio effects. Such effects should be enabled in the same manner, no matter if the input was PCM or compressed.h]hxEmbedded audio effects. Such effects should be enabled in the same manner, no matter if the input was PCM or compressed.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjLubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(h8multichannel IEC encoding. Unclear if this is required. h]h)}(h7multichannel IEC encoding. Unclear if this is required.h]h7multichannel IEC encoding. Unclear if this is required.}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM1hjdubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hEncoding/decoding acceleration is not supported as mentioned above. It is possible to route the output of a decoder to a capture stream, or even implement transcoding capabilities. This routing would be enabled with ALSA kcontrols. h]h)}(hEncoding/decoding acceleration is not supported as mentioned above. It is possible to route the output of a decoder to a capture stream, or even implement transcoding capabilities. This routing would be enabled with ALSA kcontrols.h]hEncoding/decoding acceleration is not supported as mentioned above. It is possible to route the output of a decoder to a capture stream, or even implement transcoding capabilities. This routing would be enabled with ALSA kcontrols.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hj|ubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hAudio policy/resource management. This API does not provide any hooks to query the utilization of the audio DSP, nor any preemption mechanisms. h]h)}(hAudio policy/resource management. This API does not provide any hooks to query the utilization of the audio DSP, nor any preemption mechanisms.h]hAudio policy/resource management. This API does not provide any hooks to query the utilization of the audio DSP, nor any preemption mechanisms.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hNo notion of underrun/overrun. Since the bytes written are compressed in nature and data written/read doesn't translate directly to rendered output in time, this does not deal with underrun/overrun and maybe dealt in user-library h]h)}(hNo notion of underrun/overrun. Since the bytes written are compressed in nature and data written/read doesn't translate directly to rendered output in time, this does not deal with underrun/overrun and maybe dealt in user-libraryh]hNo notion of underrun/overrun. Since the bytes written are compressed in nature and data written/read doesn’t translate directly to rendered output in time, this does not deal with underrun/overrun and maybe dealt in user-library}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubeh}(h]h ]h"]h$]h&]j j uh1johhhM!hjhhubeh}(h] not-supportedah ]h"] not supportedah$]h&]uh1hhhhhhhhM ubh)}(hhh](h)}(hCreditsh]hCredits}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMCubjp)}(hhh](ju)}(hEMark Brown and Liam Girdwood for discussions on the need for this APIh]h)}(hjh]hEMark Brown and Liam Girdwood for discussions on the need for this API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(h5Harsha Priya for her work on intel_sst compressed APIh]h)}(hjh]h5Harsha Priya for her work on intel_sst compressed API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMEhjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(h$Rakesh Ughreja for valuable feedbackh]h)}(hjh]h$Rakesh Ughreja for valuable feedback}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMFhjubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubju)}(hSing Nallasellan, Sikkandar Madar and Prasanna Samaga for demonstrating and quantifying the benefits of audio offload on a real platform.h]h)}(hSing Nallasellan, Sikkandar Madar and Prasanna Samaga for demonstrating and quantifying the benefits of audio offload on a real platform.h]hSing Nallasellan, Sikkandar Madar and Prasanna Samaga for demonstrating and quantifying the benefits of audio offload on a real platform.}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhj+ubah}(h]h ]h"]h$]h&]uh1jthjhhhhhNubeh}(h]h ]h"]h$]h&]j j uh1johhhMDhjhhubeh}(h]creditsah ]h"]creditsah$]h&]uh1hhhhhhhhMCubeh}(h]alsa-compress-offload-apiah ]h"]alsa compress-offload apiah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj|error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jVjSjMjJjjjjjjjjjjjjjNjKu nametypes}(jVjMjjjjjjjNuh}(jShjJhjjPjjjjjjjjjjjKju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.