-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add Duck IVF parsing support to the elementary stream. #18
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Vassili Nikolaev (NVIDIA) <vnikolaev@nvidia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thank you!
#define DKIF_FRAME_CONTAINER_HEADER_SIZE 12 | ||
#define DKIF_HEADER_MAGIC *((const uint32_t*)"DKIF") | ||
#define DKIF_FILE_HEADER_SIZE 32 | ||
#define USE_SIMPLE_MALLOC 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about this USE_SIMPLE_MALLOC. Can you add a comment to explain the use of that ?
@@ -18,6 +18,10 @@ | |||
#include <fstream> | |||
#include "mio/mio.hpp" | |||
#include "VkDecoderUtils/VideoStreamDemuxer.h" | |||
#define DKIF_FRAME_CONTAINER_HEADER_SIZE 12 | |||
#define DKIF_HEADER_MAGIC *((const uint32_t*)"DKIF") | |||
#define DKIF_FILE_HEADER_SIZE 32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to use structure and get some information from the header such as the codec.
You can get inspiration from https://github.com/Igalia/ESExtractor/blob/main/lib/eseivfstream.cpp
FILE* handle = fopen(pFilePath, "rb"); | ||
if (handle == nullptr) { | ||
printf("Failed to open video file %s\n", pFilePath); | ||
m_bitstreamDataSize = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for that as its already set to null and zero above
|
||
fseek(handle, 0, SEEK_END); | ||
size_t size = ftell(handle); | ||
uint8_t* data = (uint8_t*)malloc(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid this approach for very large file. I would read the size of the frame by the frame header and move the offset to this size.
|
||
if (data == nullptr) { | ||
printf("Failed to allocate memory for video file: %i\n", (uint32_t)size); | ||
m_bitstreamDataSize = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this code as it hasnt been modified so far
@@ -83,7 +130,11 @@ class ElementaryStream : public VideoStreamDemuxer { | |||
} | |||
|
|||
virtual ~ElementaryStream() { | |||
#ifdef USE_SIMPLE_MALLOC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use #ifndef
We should remove the USE_SIMPLE_MALLOC from this change. @vasn1k, per our offline discussion, please do that before we merge this change. |
Add support for .ivf files when loading AV1 compressed video files and using elementary streams.