Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the elementary stream and IVF file parser to rocDecode utilities #433

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

jeffqjiangNew
Copy link
Contributor

  • This PR adds the new built-in stream file parser, in order to reduce ROCm package dependencies on FFMPEG. The goal is to enable rocDecode testing on elementary stream files and IVF container files.
  • This PR adds the functions of the parser to rocDecode utilities and example code to decode sample, as the first part. Next part is the enablement of this feature, which will be another PR.
  • Currently the parser can parse AVC, HEVC and AV1 elementary stream files and AV1 IVF container files.

…lso cleaned up the bitstream ring buffer code.
…lso fixed a bug in fill ring buffer function.
 - 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.
… check; Added stronger AV1 detection for IVF AV1 stream type.

#include <string.h>
#include "video_es_parser.h"
#include "../../src/parser/hevc_defines.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed, we need to expose another api for this and I don't think it will fit within the existing parser api

Copy link
Contributor Author

@jeffqjiangNew jeffqjiangNew Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove the reference to the internal headers.

Note this is a different parser. Think of it as a simple demuxer, which parses the files of AVC/HEVC/AV1 elementary stream files and get the picture data, and it can also read IVF container files. It is in parallel with roc_video_dec, ffmpeg demuxer in utility. The interface is exposed the same way as roc_video_dec, and ffmpeg demuxer. It is another utility.

@@ -57,7 +58,8 @@ void ShowHelpAndExit(const char *option = NULL) {
<< "-seek_criteria - Demux seek criteria & value - optional; default - 0,0; "
<< "[0: no seek; 1: SEEK_CRITERIA_FRAME_NUM, frame number; 2: SEEK_CRITERIA_TIME_STAMP, frame number (time calculated internally)]" << std::endl
<< "-seek_mode - Seek to previous key frame or exact - optional; default - 0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, it is better to add another sample called "video_es_decode" for this instead of clubbing it with videodecode sample

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The current code in videodecode.cpp is just a demo sample. When we remove ffmpeg links, we will need a new sample.

Copy link
Collaborator

@rrawther rrawther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some comments. We can discuss in our meeting

Copy link
Member

@AryanSalmanpour AryanSalmanpour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffqjiangNew Here is an idea about how to expose the new ES parser as an independent API and a new sample to show its functionality:

  1. Move your implementation of the ES parser somewhere inside of the src/parser inside the rocdedecode library, this way you would have access to the internal codec structures headers.

  2. Expose an independent API in the api/rocparser.h for example extern rocDecStatus ROCDECAPI rocDecParserGetPicData(uint8_t **p_pic_data, int *pic_size); notice that this is going to be an independent API without needing to use RocdecVideoParser parser_handle

  3. Add a new function into utils/rocvideodecode/roc_video_dec.cpp/roc_video_dec.h int GetPicData(uint8_t **p_pic_data, int *pic_size); and inside that function call the new independent ES parser API (rocDecParserGetPicData)

  4. Create a new sample (e.g., videoDecodeElementryStream) and inside that sample use the utils/rocvideodecode functionality and the new GetPicData function to illustrate the new ES parser without using any FFMPEG functionality

@rrawther
Copy link
Collaborator

@jeffqjiangNew Here is an idea about how to expose the new ES parser as an independent API and a new sample to show its functionality:

  1. Move your implementation of the ES parser somewhere inside of the src/parser inside the rocdedecode library, this way you would have access to the internal codec structures headers.
  2. Expose an independent API in the api/rocparser.h for example extern rocDecStatus ROCDECAPI rocDecParserGetPicData(uint8_t **p_pic_data, int *pic_size); notice that this is going to be an independent API without needing to use RocdecVideoParser parser_handle
  3. Add a new function into utils/rocvideodecode/roc_video_dec.cpp/roc_video_dec.h int GetPicData(uint8_t **p_pic_data, int *pic_size); and inside that function call the new independent ES parser API (rocDecParserGetPicData)
  4. Create a new sample (e.g., videoDecodeElementryStream) and inside that sample use the utils/rocvideodecode functionality and the new GetPicData function to illustrate the new ES parser without using any FFMPEG functionality

I agree we need to expose a new API. But it can be a new class and API instead of clubbing it with existing parser api. Current parser is specifically designed for parsing picture data and sending appropriate information to rocDecode decoding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants