OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
516 stars 172 forks source link

y4m file rewind logic #503

Closed intelmark closed 4 years ago

intelmark commented 4 years ago

Core problem is that the existing assert and return of EB_ErrorNone when the y4m frame delimiter is read are happening when the file stream reader is at the end of the file. This can happen when the -n value is larger than the actual number of frames in the file.

To fix this problem with y4m files, an additional check is added to when the y4m frame delimiter is being read. Rather than asserting after the feof check, the y4m file is rewound, the header is skipped over, and the frame delimiter is attempted to be read again.

Note: One alternative solution could be to first figure out how many bytes are in the file (using fseek and ftell), and then use ftell to see if the file reader is at the end of the file.

This logic would replace the feof call at the end of ReadInputFrames, since that call is not correctly being used. feof uses an indicator that is set by a previous operation on the stream that attempted to read at or past the end-of-file. By itself calling feof does not return any useful information.

Signed-off-by: Mark Feldman mark.feldman@intel.com

tianjunwork commented 4 years ago

@intelmark , adding closes #501 add the end of your commit message(below Signed-off-by line) will close the associated issue automatically after merging this PR.