Files
rocm-systems/api/roc_bitstream_reader.h
T
jeffqjiangNew e62aa3e09b Added the bit stream reader feature. (#433)
* * rocDecode/ES parser: Added elementary stream file parser for HEVC and AVC.

* * rocDecode/ES parser: Added elementary stream file parser for AV1. Also cleaned up the bitstream ring buffer code.

* * rocDecode/ES parser: Added the IVF container file parser for AV1. Also fixed a bug in fill ring buffer function.

* * rocDecode/ES file parder: Added supported stream type detection.
 - The stream type detection checks the unique syntax patterns of the stream type and calculate the likeliheed score. Based on the score, the most likely type is determined.
 - The current supported stream types are: AVC/HEVC/AV1 elementary streams, IVF AV1 streams.

* * rocDecode/ES file parser: Fixed an AVC decode regression due to a copy and paste error.

* * rocDecode/ES file parser: Added bit depth parsing for codec support check; Added stronger AV1 detection for IVF AV1 stream type.

* * rocDecode/ES file parser: Removed debugging logs.

* * rocDecode/ES file parser: Added exmaple code to use the built-in file parser.

* * rocDecode/Bitstream reader: Renamed the elementary parser feature to bitstream reader and re-organized the code.
 - Moved the bitstream reader code to rocDecode core lib from utility.
 - Added bitstream reader interface in parallel with rocDecode parser and decoder interfaces.

* * rocDecode/Bitstream reader: Added sample to use bitstream reader, instead of FFMPEG demuxer, to get picture data. Also reverted the original sample app back to using FFMPEG demuxer only.

* * rocDecode/Bitstream reader: Renamed the new sample app.

* * rocDecode/Bitstream reader: FFMPEG dependency reduction.
 - Moved MD5 functions out of RocVideoDecoder utility class. This removed RocVideoDecoder's dependency on FFMPEG.
 - Added the new MD5 utility, which depends on FFMPEG lib. MD5 message digest generation is now performed in the MD5 utility.
 - Modified decode sampples that uses MD5 generation function.
 - Removed FFMPEG dependency from video decoder basic sample.

* * rocDecode/Bitstream reader: Added option to use bitstream reader to video decode sample and conformance test script. Added the missing destroy bitstream reader call in video decode basic sample.

* * rocDecode/Bitstream reader: Minor format change. No functional changes.

* * rocDecode/Bitstream reader: Added handling of unsupported stream file type by the bitstream reader to decode sample apps.

* * rocDecode/Bitstream reader: Fixed build errors of several samples.

* * rocDecode/Bitstream reader: Added changes based on review comments.

* * rocDecode/Bitstream reader: File name changes based on review comments.

* * rocDecode/Bitstream reader: Moved MD5 code into single header file. Added changes based on review comments.

* * rocDecode/Bitstream reader: Removed redundant path.

* * rocDecode/Bitstream reader: Changed rocDecode version to 0.10.0. Added minor changes based on review comments.

---------

Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com>
2024-12-05 09:46:24 -05:00

86 righe
4.7 KiB
C

/*
Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "rocdecode.h"
/*!
* \file
* \brief The AMD rocBitstreamReader Library.
*
* \defgroup group_roc_bitstream_reader rocDecode Parser: AMD ROCm Video Bitstream Reader API
* \brief AMD The rocBitstreamReader is a toolkit to read picture data from bitstream files for decoding on AMD’s GPUs.
*/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/*********************************************************************************/
//! HANDLE of rocBitstreamReader
//! Used in subsequent API calls after rocDecCreateBitstreamReader
/*********************************************************************************/
typedef void *RocdecBitstreamReader;
/************************************************************************************************/
//! \ingroup group_roc_bitstream_reader
//! \fn rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path)
//! Create video bitstream reader object and initialize
/************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path);
/************************************************************************************************/
//! \ingroup group_roc_bitstream_reader
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type)
//! Get the codec type of the bitstream
/************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type);
/************************************************************************************************/
//! \ingroup group_roc_bitstream_reader
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth)
//! Get the bit depth of the bitstream
/************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth);
/************************************************************************************************/
//! \ingroup group_roc_bitstream_reader
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts)
//! Read one unit of picture data from the bitstream. The unit can be a frame or field for AVC/HEVC,
//! a temporal unit for AV1, or a frame (including superframe) for VP9. The picture data unit is pointed
//! by pic_data. The size of the unit is specified by pic_size. The presentation time stamp, if available,
//! is given by pts.
/************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts);
/************************************************************************************************/
//! \ingroup group_roc_bitstream_reader
//! \fn rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle)
//! Destroy the video parser object
/************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle);
#if defined(__cplusplus)
}
#endif /* __cplusplus */