STR (Streaming Data): Difference between revisions
| Revision as of 02:46, 23 October 2026 RemmyLee (SPU and CD-ROM at register depth; CPU overview rewritten) | Revision as of 02:47, 23 October 2026 RemmyLee (Formats: Sony paragraph voice; HMD, RSD extended files, full BS code book; sprite editor formats) | ||
| Line 10: | Line 10: | ||
| ## Overview | ## Overview | ||
| − | Streaming is the reading and processing of successive data from a CD-ROM. STR is the CD-ROM data format defined for streaming on the PlayStation.[^ff13] | + | Streaming refers to the successive reading and processing of data from a CD-ROM, and STR is the CD-ROM data format defined for streaming on the PlayStation. Streaming is generally used to play back animation or audio data. However, it can serve any time-series data that changes continuously. The streaming library is used separately from the other CD-ROM functions.[^ff13] |
| − | Streaming is used for animation and audio. It also serves other time-series data that changes continuously.[^ff13] | + | The bitstream used for movie playback is obtained through streaming. Because the bitstream does not include the image size or other supplemental information, the STR format defines the information required for playback in its header.[^ff13] |
| − | The streaming library is used separately from the other CD-ROM functions.[^ff13] | ||
| − | |||
| − | The bitstream for movie playback comes through streaming. The bitstream does not hold the image size, so the STR header holds the data needed for playback.[^ff13] | ||
| − | |||
| ## Streaming Data | ## Streaming Data | ||
| − | Streaming data in an STR file is a continuous array of frame data elements.[^ff13] | + | Streaming data in an STR file is a continuous array of frame data elements. The contents of a frame depend on the data being streamed. In an animation each frame can contain one of the still images of the sequence, and in an animation of 3D modeling data each frame can contain one unit of the modeling data.[^ff13] |
| − | The contents of a frame depend on the data. In an animation, one frame can hold one still image of the sequence.[^ff13] | + | The STR format does not specify the type of data in a frame, so it can be defined freely as needed. The length and type are set independently for each frame. Frames of various types and sizes can therefore be mixed in one STR file.[^ff13] |
| − | The STR format does not set the data type of a frame.[^ff13] | ||
| − | |||
| − | Each frame has its own length and type. One STR file can mix frames of several types and sizes.[^ff13] | ||
| − | |||
| ## Frame Data | ## Frame Data | ||
| − | Frame data is divided into 2048-byte sectors. These match the CD-ROM data sectors.[^ff13] | + | Frame data in an STR file is divided into 2048-byte sectors that correspond to CD-ROM data sectors. Each sector starts with a 32-byte header that describes the sector data, and 2016 bytes of data follow it. Each frame must begin on a sector boundary, so the last sector of a frame is padded with dummy data to the 2048-byte boundary.[^ff13][^ff14] |
| − | Each sector starts with a 32-byte header. 2016 bytes of data follow.[^ff13] | ||
| − | |||
| − | Each frame begins on a sector boundary. The last sector of a frame is padded with dummy data to the 2048-byte boundary.[^ff13][^ff14] | ||
| − | |||
| ## Sector Header | ## Sector Header | ||
| − | The sector header is divided into the following fields:[^ff14][^ff15] | + | The sector header at the start of each sector is divided into the following fields. All fields are little endian.[^ff14][^ff15] |
| Table: STR sector header | Table: STR sector header | ||
| Line 52: | Line 40: | ||
| | StUSER | 16 bytes | User-defined area | | | StUSER | 16 bytes | User-defined area | | ||
| − | All fields are little endian.[^ff15] | + | If the MSB of StTYPE is 1, the data type is a system-defined format. If the MSB is 0, it is a user-defined format and the other 15 bits can be set as desired, which allows other frame formats to be carried in the STR format.[^ff14] |
| − | An StTYPE with the MSB set is a system-defined format. With the MSB clear it is a user-defined format, and the other 15 bits are free.[^ff14] | + | StSECTOR_OFFSET, StSECTOR_SIZE and StFRAME_NO ensure that the streaming library reads the frame data consecutively without missing any sectors.[^ff14] |
| − | The streaming library uses StSECTOR_OFFSET, StSECTOR_SIZE and StFRAME_NO to read frame data in order without missing sectors.[^ff14] | ||
| − | |||
| ## User-defined Frame Data | ## User-defined Frame Data | ||
| − | User-defined data streams with the MSB of StTYPE set to 0.[^ff15] | + | User-defined data is streamed by setting the MSB of StTYPE to 0. If the whole run of streaming data uses the same attribute values, one header frame can serve the entire run instead of a header in each frame. This reduces the total amount of data. In the manual's example the LSB of StTYPE distinguishes the header frame from the other frames:[^ff15] |
| − | A run of streaming data with the same attributes throughout can use one header frame for the whole run. This reduces the total amount of data.[^ff15] | ||
| − | |||
| − | The manual gives an example of streaming data with a header frame.[^ff15] | ||
| − | |||
| − | The example is as follows: | ||
| − | |||
| − | |||
| Table: Streaming data with header frame | Table: Streaming data with header frame | ||
| Line 78: | Line 57: | ||
| | Frame3 | 0x0002 | | | Frame3 | 0x0002 | | ||
| − | In this example the LSB of StTYPE marks the header frame.[^ff15] | + | The application can read the StTYPE field of each frame as it is read from the CD-ROM. The interpretation of the frame data can therefore change with the type of frame. A header frame can hold, for example, CLUT data that is not saved in each frame or a table of jumps to certain frames.[^ff15] |
| − | The application can read StTYPE in each frame. The meaning of the frame data can then change with the type of frame.[^ff15] | ||
| − | |||
| − | A header frame can hold CLUT data that is not saved in each frame. It can also hold a table of jumps to frames.[^ff15] | ||
| − | |||
| ## MDEC Animation | ## MDEC Animation | ||
| − | MDEC animation is a system-defined format with StTYPE 0x8001.[^ff16] | + | MDEC animation is a system-defined format with StTYPE 0x8001. Its StTYPE also carries a channel number for multi-channel streaming, which is 0 for ordinary streaming. The frame data is [BS](/formats/bs/) data, and the sector header has the following fields:[^ff16] |
| − | Its sector header has the following fields: | ||
| − | |||
| − | |||
| Table: MDEC animation sector header | Table: MDEC animation sector header | ||
| Line 106: | Line 78: | ||
| | StMOVIE_HEADV | 4 bytes | Reserved for system | | | StMOVIE_HEADV | 4 bytes | Reserved for system | | ||
| − | The channel number is 0 for ordinary streaming.[^ff16] | ||
| − | |||
| − | The frame data of an MDEC animation is [BS](/formats/bs/) data. | ||
| − | |||
| ## Streaming Data with Audio | ## Streaming Data with Audio | ||
| − | The PlayStation plays back ADPCM audio data as specified in the CD-ROM XA standard. Sony calls this XA-ADPCM audio.[^ff16] | + | The PlayStation plays back ADPCM audio data as specified in the CD-ROM XA standard, which Sony calls [XA-ADPCM](/formats/xa/) audio. XA-ADPCM audio is sent directly from the CD-ROM decoder to the SPU without using main memory. Streaming reads CD-ROM data into main memory, and it consequently cannot be used to play back XA-ADPCM audio.[^ff16] |
| − | XA-ADPCM audio goes from the CD-ROM decoder to the SPU without using main memory. Streaming reads data into main memory, so it cannot play XA-ADPCM audio.[^ff16] | + | To play XA-ADPCM audio, the audio sectors must be interleaved with gaps on the CD-ROM. Streaming data with audio places ordinary streaming data in these gap sectors. The manual's example uses streaming data at 30 fps (5 sectors per frame) with 37.8 kHz stereo audio at double speed.[^ff16][^ff17] |
| − | Audio sectors are interleaved with data sectors on the disc. Streaming data with audio places the streaming data in the gaps between the audio sectors.[^ff16][^ff17] | ||
| − | |||
| − | The manual's example uses streaming data at 30 fps (5 sectors per frame). The audio is 37.8 kHz stereo at double speed.[^ff17] | ||
| − | |||
| ### Sector Size | ### Sector Size | ||
| − | A sector of ordinary streaming data is 2048 bytes. A sector of streaming data with audio is 2336 bytes.[^ff18] | + | The sector size is 2048 bytes for ordinary streaming data but 2336 bytes for streaming data with audio. A data sector adds an 8-byte subheader before the sector header and 280 bytes of dummy data after the data. The sector header and data areas are otherwise identical to those of ordinary streaming data.[^ff18] |
| − | A data sector has the following parts: | ||
| − | |||
| − | |||
| Table: Data sector in streaming data with audio | Table: Data sector in streaming data with audio | ||
| Line 136: | Line 97: | ||
| | Dummy data | 280 bytes | | | Dummy data | 280 bytes | | ||
| − | The audio sectors have the following parts:[^ff18] | + | The audio sectors have the same 2336-byte size:[^ff18] |
| Table: XA-ADPCM audio sector for streaming data with audio | Table: XA-ADPCM audio sector for streaming data with audio | ||
| Line 146: | Line 107: | ||
| | Dummy data | 4 bytes | | | Dummy data | 4 bytes | | ||
| − | The CD-ROM XA standard sets the size of the subheader. The subheader holds flags that tell data sectors from audio sectors.[^ff18] | + | The size of the subheader is specified by the CD-ROM XA standard, and the subheader holds the flags that distinguish data sectors from audio sectors. The dummy data at the end of each sector makes the audio sectors the same size as the data sectors.[^ff18] |
| − | The dummy data makes an audio sector the same size as a data sector.[^ff18] | ||
| − | |||
| − | The sector header and data areas are the same as in ordinary streaming data.[^ff18] | ||
| − | |||
| ## References | ## References | ||