XApuDecodeConvertCommand
Defines decode or decode-convert processing parametersSyntax
Members
idType: XApuCommandId Specifies the base command parameters to be sent to the hardware for processing. The same XApuCommandId will be set to XApuResult::id pitchRampRate
Type: float This is a value that will be added to or subtracted from the current pitch for each output. This value is unsigned and the Sample Rate Converter engine will automatically decide whether to add or subtract it from the current pitch depending on the target pitch value. By default, this value should be set to XAPU_DEFAULT_PITCH_RAMP_RATE. targetPitch
Type: float The target pitch for the current conversion operation. For XApuProcessType::DecodeOpus, this value is ignored. firstFrameIndex
Type: uint32_t Specifies the index of the first frame that will be copied to the output buffer. firstFrameIndex coupled with the frameCount specify what gets copied to the output buffer. Our implementation does not include the residual data when using the firstFrameIndex. If there are 100 residual frames and firstFrameIndex is set to 50 and the frameCount is set to 200, 200 frames will be added to the entire residual starting from the 50th frame in the decoded data. This means the buffer into the HSRC will have the original 100 frames from residual followed by 200 frames starting from the 50th frame in the current decoded packet. An audio frame in a PCM stream is a set of samples (the set contains one sample for each channel in the stream) that will play or was captured at the same time (clock tick). Thus, the size of an audio frame is the sample size multiplied by the number of channels in the stream. For example, the frame size for a stereo (2-channel) stream with 32-bit float samples is eight bytes. This value should be between 0 and 960 for Opus streams with 20 millisecond packet duration. It should be between 0 to 480 for or Opus streams with 10 millisecond packet duration. By default, this value is set to zero. For preroll inputs, this value should be larger than zero. Preroll inputs will be processed but will not produce output data. frameCount
Type: uint32_t This parameter is required when the input data is uncompressed in XApuProcessType::ConvertPCM processing with the following constraints:
- For mono and stereo input deinterleaved PCM data, the minimum value is 4, maximum value is 960, and the value must be multiple of 4.
- For stereo input interleaved PCM data, the minimum value is 8, maximum value is 960, and the value must be multiple of 8.
- For XApuProcessType::DecodeOpus, this value can be used to truncate the output frame count.
- For XApuProcessType::DecodeConvertOpus, this value can used to truncate the number of decoded frames that will be passed to the converter.
Type: uint32_t Input data length in bytes. Must be a multiple of 16 in length. For XApuProcessType::ConvertPCM case, this value must equal to XApuDecodeConvertCommand::frameCount x XApuDecodeConvertActivateCommand::channelCount x sizeof(float) inputData
Type: void* Pointer to input data for processing. This value should be equal to or greater than XApuConnectOutputParameters::data and less than XApuConnectOutputParameters::data + XApuConnectInputParameters::dataLength that was returned by XApuConnect. This buffer must be 16-byte aligned. For XApuProcessType::DecodeOpus and XApuProcessType::DecodeConvertOpus, the input data must be a single Opus packet (SILK, CELT or Hybrid) For XApuProcessType::ConvertPCM, the input data must be PCM float (32 bit). If the XApuConnectOptions::DeinterleavedInput flag is set, the input PCM data must be deinterleaved. For XApuProcessType::ConvertPCM deinterleaved input, the first channel data starts at XApuDecodeConvertCommand::inputData and the second channel data starts at XApuDecodeConvertCommand::inputData + (XApuDecodeConvertCommand::inputDataLength / 2) maxOutputDataLength
Type: uint32_t Length of the maximum output data in bytes. Must be a multiple of 16 in length. Should not exceed XApuConnectInputParameters::baseDataLength. outputData
Type: void* Pointer to hold the output PCM float (32 bit) data. This value should be equal to or greater than XApuConnectOutputParameters::data and less than XApuConnectOutputParameters::data + XApuConnectInputParameters::baseDataLength that was returned by XApuConnect. This buffer must be 16-byte aligned. When the XapuConnectOptions::DeinterleavedOutput flag is set, the data will be provided deinterleaved. In each packet, the deinterleave midpoint will be specified as follows: XApuProcessType::DecodeOpus:
- Left channel frames will be placed from 0 to (XapuResult::outputFrameCount-1), Right channel frames will be placed from (XapuResult::outputFrameCount) to the end of the buffer
- Left channel frames will be placed from 0 to (XApuConnectInputParameters::maxFrameCountPerOutput - 1)
- Right channel frames will be placed from XApuConnectInputParameters::maxFrameCountPerOutput to the end of the buffer
- This is true even if OutputFrameCount is less than maxFrameCountPerOutput. In this case, use the XApuConnectInputParameters::maxFrameCountPerOutput to determine the midpoint of the buffer, and XapuResult::outputFrameCount to calculate the number of frames per-channel to copy.
Remarks
Used byXApuDecodeConvertCommand to decode and convert processing parameters. For information about the XApuCommandId members, see XApuCommandId. For more information about the XApuPorcessType, see XApuProcessType.
The range of the pitch ramp rate is from 2^-18 (0.000003814697265625) to 8.0. Anything less than the minimum value will result in ramping not doing anything - the pitch will sit at the current value. Any time the ramp rate is greater than the absolute value of the difference between current and target, the ramp happens within one sample period.
Requirements
Header: xapu.h Supported platforms: XBOX Series X|SConceptual documentation
See also
XApuEnqueueCommandXApuResult
XAPU
