Commit Graph

75 Commits

Author SHA1 Message Date
jeffqjiangNew aacd035b6d HEVC: Added bit depth change support in decoder reconfiguration. (#527)
* * rocDecode/HEVC: Added bit depth change support in decoder reconfiguration.

* * rocDecode/HEVC: Removed a comment line.

* * rocDecode/HEVC: Updated change log.

* * rocDecode/HEVC: Used the reserved space in RocdecReconfigureDecoderInfo structure for bit_depth_minus_8 field to be backward compatible. Added bit depth to the new sequence file name when we dump output in decoder reconfiguration case.

* * rocDecode/HEVC: Added bit depth change support in decoder reconfiguration.

* * rocDecode/HEVC: Removed a comment line.

* * rocDecode/HEVC: Updated change log.

* * rocDecode/HEVC: Used the reserved space in RocdecReconfigureDecoderInfo structure for bit_depth_minus_8 field to be backward compatible. Added bit depth to the new sequence file name when we dump output in decoder reconfiguration case.

* * rocDecode/HEVC: Changes based on review comments.

* * rocDecode: Fixed a bug related to 422 surface format assignment.

* * rocDecode: Fixed build warnings with some sample apps.

[ROCm/rocdecode commit: ab7546930f]
2025-03-13 09:29:25 -04:00
jeffqjiangNew cd98621eb9 * rocDecode/HEVC error resilience: Fixed a vulnerability with active PPS id. We should not assign the current active PPS id to an invalid value. (#529)
[ROCm/rocdecode commit: ac74540c19]
2025-03-12 17:49:52 -04:00
jeffqjiangNew 23309b2e4c Added syntax error handling in VPS parsing. (#526)
* * rocDecode/HEVC: Added error handling in VPS parsing.

* * rocDecode/HEVC: Updated change log.

* * rocDecode/Error resilience: Improved syntax error check logging: add the parameter name.

[ROCm/rocdecode commit: 263b57fde9]
2025-03-10 09:15:12 -04:00
jeffqjiangNew aa1bb2e94f Error resilience: Added HEVC slice syntax error handle for some corrupted streams. (#525)
* * rocDecode/Error resilience: Added HEVC slice syntax error handle for some corrupted streams.
 - Detect out of range total reference numbers.

* * rocDecode/Error resilience: Added additional checks for HEVC reference parameters.

* * rocDecode/Error resilence: Corrected checked range.

[ROCm/rocdecode commit: 27adeb8c47]
2025-03-05 08:44:59 -05:00
jeffqjiangNew 4e8f655fde * rocDecode: Fix a typo in new sequence callback function name. (#520)
[ROCm/rocdecode commit: a78f6730c8]
2025-02-25 20:43:46 -05:00
jeffqjiangNew c8a7b82794 VP9: Added support for video size change (scaling down) on inter frames. (#508)
* * rocDecode/VP9: Added support for video size change (scaling down) on inter frames.
 - A new reconfigure mode is added, where we keep the existing VAAPI surfaces and context, and work on the smaller images and store the images in the surfaces.

* * rocDecode/VP9 resize: Added changes based on review comments.

[ROCm/rocdecode commit: 2af7bbf4e7]
2025-02-12 17:18:09 -05:00
jeffqjiangNew 4ac1c26cfc * rocDecode/HEVC: Added short term RPS parsing error handling. (#495)
[ROCm/rocdecode commit: dec6dacbc9]
2025-01-22 12:47:01 -05:00
Aryan Salmanpour c597fb2a4c Update Copyright year to 2025 (#486)
* Update Copyright year to 2025

* update year to 2025

[ROCm/rocdecode commit: 3624040ce7]
2025-01-05 16:25:39 -05:00
jeffqjiangNew 6bcc0a4067 * rocDecode/HEVC: Added in stream DPB buffer size change detection and handling. (#482)
[ROCm/rocdecode commit: 5336913a09]
2024-12-19 17:29:52 -05:00
jeffqjiangNew f7cffa4db2 HEVC: Cut HEVC parser creation time from about 40 milliseconds to about 50 microseconds. (#458)
* * rocDecode/HEVC: Cut HEVC parser creation time from about 40 milliseconds to about 50 microseconds.

* * rocDecode/HEVC: Added necessary parameter init in parser constructor.

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>

[ROCm/rocdecode commit: 27e9ed23ed]
2024-11-19 15:10:35 -05:00
jeffqjiangNew dfcad4048d * rocDecode/HEVC: Fixed an issue in RPS decode function. (#455)
- In searching for a short term reference picture in DPB, we need to make sure it is used.

[ROCm/rocdecode commit: 85faa096e5]
2024-11-15 15:41:50 -05:00
jeffqjiangNew d30754651f * rocDecode/HEVC: Added empty NAL detection. (#452)
[ROCm/rocdecode commit: b3f8fec41b]
2024-11-13 13:28:29 -05:00
Rajy Rawther 3344bee39d Added bitstream validation code for HEVC parser (#450)
* fix for while loop hang

* fix for while loop hang

* add more data validation code in parser

* minor change

* addressed review comments

* fix conformance failures with new code

* added more checks

[ROCm/rocdecode commit: 69ec7af8bd]
2024-11-11 17:33:17 -05:00
Rajy Rawther c238421b51 fix for while loop hang (#447)
[ROCm/rocdecode commit: 5820f38592]
2024-11-06 14:41:57 -05:00
jeffqjiangNew 273d03c3d0 Added the missing presentation time stamp (pts) to decode return info for displayed pictures. (#398)
* * rocDecode: Added the missing pts to decode return info for decoded pictures.

* * rocDecode: Added the missing pts to decode return info for decoded pictures.

[ROCm/rocdecode commit: 4f8191edc0]
2024-07-25 16:53:20 -04:00
jeffqjiangNew 5bdf7f6b8d AV1: Intra decode started to be up and running. (#372)
* * rocDecode/AV1: Added new sequence callback and submit decode calls.

* * rocDecode/AV1: Intra decode started to work.

* * rocDecode/AV1: Do not build PrintVaapiParams() in normal (non-debug) mode.

[ROCm/rocdecode commit: 2be11821fc]
2024-06-26 12:46:11 -04:00
jeffqjiangNew 3230cca447 rocDecode: Added decode buffer pool implementation for AVC and HEVC. (#355)
* * rocDecode: Initial check in for decode buffer pool.

* * rocDecode: All 135 streams pass.

* * rocDecode: Fixed a build error in debug mode.

* * rocDecode/HEVC: Removed two workaround in HEVC DPB management, after decode buffer pool implementa
tion.
 - WR 1: Conditional bumping (when max_num_reorder_pics > 0) to avoid synchronous job submission in
C.5.2.3.
 - WR 2: Add two more buffers in DPB to avoid buffer over-writing.

* * rocDecode/HEVC: Added display delay feature.

* * rocDecode/HEVC: Fixed the -z option issue within the context of the new decode buffer pool implementation.

* * rocDecode/HEVC: Removed redundent code.

* * rocDecode/AVC: Added decode buffer pool implementation for AVC.

* * rocDecode: Added a few changes.
 - Added display delay feature to AVC.
 - Removed a workaround for AVC: AVC_MAX_DPB_FRAMES was increased to 18. Now it is back to 16.
 - Removed a workaround for AVC: increased DPB buffer size by 2. Now it is back to normal.
 - Code format changes for HEVC.

* * rocDecode/AVC: Fixed the -z option issue within the context of the new decode buffer pool implementation.

* * rocDecode: Merged OutputDecodedPictures() method to upper class RocVideoParser.

* * rocDecode: Code cleanup. No functional changes.

* * rocDecode: Made decode buffer pool size adaptive.
 - Removed the hard coded decode buffer pool size set in the decoder.
 - Exposed the display delay parameter from RocVideoDecoder class to the user.
 - Now the decoder buffer pool size is determined from the DPB buffer size and display delay parameter.

* * rocDecode: Several changes based on code review.
 - Merged decode and display use status into one parameter.
 - Removed the surface index from DecodeFrameBuffer, which is now implicitly referred by the array index.
 - Changed a function name for better clarity.

* * rocDecode: Added a comment.

[ROCm/rocdecode commit: 61c8661b9c]
2024-05-31 13:14:02 -04:00
jeffqjiangNew 263f924405 * rocDecode/HEVC: Added error handling for the cases where there is no slice data in the decode payload. (#354)
[ROCm/rocdecode commit: 1ac4cf7f52]
2024-05-14 14:07:23 -04:00
jeffqjiangNew 4c64022b72 rocDecode: Added error handling of missing headers in cases where they are not parsed but referred in the frame decode process. One example is when frame seek is performed and the target picture is not a random access point. (#335)
* * rocDecode: Added error handling of missing headers in cases where they are not parsed but referred in the frame decode process. One example is when frame seek is performed and the target picture is not a random access point.

* * rocDecode/HEVC: Added some missing error handlings.

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>

[ROCm/rocdecode commit: ba36534f1f]
2024-05-03 15:18:08 -04:00
jeffqjiangNew 4c68b8c1fd * rocDecode/AVC: Added SEI message extraction support. Also merged common AVC and HEVC SEI support code to super class. (#250)
[ROCm/rocdecode commit: 9b006616ed]
2024-02-15 08:42:51 -05:00
jeffqjiangNew 11450f86ef AVC: Added DPB management, decoded picture output and display callback. (#244)
* * rocDecode/AVC: Added display callback implementation.

* *rocDecode/AVC: Fixed a few issues with decoded buffer output and bumping from DPB.

* * rocDecode: Name changes based on code review.

---------

Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com>

[ROCm/rocdecode commit: ca3333f7b9]
2024-02-14 18:06:43 -05:00
jeffqjiangNew cd37b816b6 Implemented proper slice parameter buffer submission for multiple slice streams. (#226)
* * rocDecode: Implemented proper slice parameter buffer submission for multiple slice streams.
 - We were submitting single slice parameter buffer for multiple slice streams. This works for other APIs but not for VAAPI, which requires to send slice parameter buffer once per slice.
 - At step 1, all the multi-slice structures are fixed sized (256). Will make them dynamic in the next step.
 - With this change, all 135 HEVC conformance streams now pass.

* * rocDecode: Multiple slice change step 2: make the fixed size slice info structure lists dynamic.

* * rocDecode: Minor changes in comments. No functional changes.

* *rocDecode: Changed INIT_SLICE_PARAM_LIST_NUM from 256 back to 16. 256 was set during debug process.

* * rocDecode: Add suggest changes from code review.

* * rocDecode: Moved slice_params_buf_id_ initialization to class VaapiVideoDecoder declaration, as suggested by code review.

[ROCm/rocdecode commit: 00127f16f1]
2024-02-09 15:09:49 -05:00
jeffqjiangNew e140ba1249 AVC: Added several steps in slice decoding process (8.2) (#208)
* * rocDecode/AVC: Added decode picture callback from parser to decoder and VAAPI decode submission.

* * rocDecode/AVC: Minor changes based on code review comments.

* * rocDecode/AVC: Removed a redundant line.

* * rocDecode/AVC: Added picture order count calculation.

* * rocDecode/AVC: Added initial implementation of reference list setup.

* * rocDecode/AVC: Added decoded reference picture marking.

* * rocDecode/AVC: Minor changes based on code review.

[ROCm/rocdecode commit: 6bd8509bec]
2024-01-29 12:09:36 -05:00
jeffqjiangNew a0e7d3c29f Changed rocDecode API header variable naming to Google C++ style. (#196)
* * rocDecode: Changed rocDecode API header variable naming to Google C++ style.

* * rocDecode: Unified AVC/H264 naming to AVC. Minor naming changes on HEVC related names.

* * rocDecode: Minor comment fix based on code review.

[ROCm/rocdecode commit: cd6401750e]
2024-01-24 18:03:46 -05:00
jeffqjiangNew fd2b762fab AVC: Added decode picture callback from parser to decoder and VAAPI decode submission. (#190)
* * rocDecode/AVC: Added decode picture callback from parser to decoder and VAAPI decode submission.

* * rocDecode/AVC: Minor changes based on code review comments.

* * rocDecode/AVC: Removed a redundant line.

* * rocDecode/AVC: Condensed several lines based on code review feedback.

[ROCm/rocdecode commit: 426067898c]
2024-01-23 17:30:29 -08:00
jeffqjiangNew 5527ee0b79 Fixed display aspect ratio calculation for both AVC and HEVC. (#187)
* * rocDecode: Fixed display aspect ratio calculation.
 - We were assigning sample aspect ration (SAR) from VUI directly to display aspect ratio (DAR). Now we follow the correct procedure.

* * rocDecode: Fixed an error in display aspect ratio calculation. Should include sample aspect ratio in the final step.

[ROCm/rocdecode commit: cf82317396]
2024-01-18 11:31:54 -08:00
jeffqjiangNew 40408ce2b3 Added initial AVC parser. (#176)
* * rocDecode/AVC: Added initial AVC parser.
 - Added AVC SPS, PPS and slice header parsing functions.
 - Merged common parsing code from AVC and HEVC parsers to their super class.

* * rocDecode/AVC: Formating changes. No functional changes.

[ROCm/rocdecode commit: 395a1249c1]
2024-01-16 20:57:40 -05:00
jeffqjiangNew f90684cc40 * rocDecode/HEVC: Code clean up. (#163)
- Moved HEVC standard specific defines out of HevcVideoParser class to a new file.
 - Changed some namings to be more specification compliant.
 - No functional changes.

[ROCm/rocdecode commit: 2a4026470f]
2024-01-10 11:44:07 -05:00
jeffqjiangNew 4c9a35a6a8 * rocDecode: Updated Copyright message for 2024. (#160)
[ROCm/rocdecode commit: 04fe74f390]
2024-01-09 20:47:16 -05:00
jeffqjiangNew bacf9f6700 Fixed a couple of errors in long term reference picture set parsing and long term reference picture list construction. (#151)
* * rocDecode/HEVC: Fixed a couple of errors in long term reference picture set parsing and long term reference picture list construction.

* * rocDecode/HEVC: Coding format change: removed newline in front of else statements. No functional changes.

[ROCm/rocdecode commit: c5483c751e]
2024-01-05 09:15:33 -05:00
jeffqjiangNew 2b9ea06e5c * rocDecode/HEVC: Fixed an issue in reference list reconstruction. (#149)
- Removed a size check which was put in in early bring up stage and causes some conformance stream failures.
  - Also capped the DPB buffer size to 16 when we increase it from the spec value.

[ROCm/rocdecode commit: 6db0b79144]
2024-01-02 15:55:52 -05:00
jeffqjiangNew 3567946884 Fixed a POC calculation error in some corner cases. (#145)
* * rocDecode/HEVC: Fixed a POC calculation error in some corner cases.

* * rocDecode/HEVC: Added a newline between two functions. No functional changes.

[ROCm/rocdecode commit: 1cdbac7d70]
2023-12-18 08:20:55 -05:00
jeffqjiangNew 8d44a48ee0 Fixed a bug in reference picture list modification parsing. (#143)
* * rocDecode/HEVC: Fixed the random crash associated with undecodable RASL pictures.
  - When a CRA picutre occurs, all the pictures in the DPB are emptied. However, the following RASL (Random Access Skipped Leading) picture can still reference these emptied pictures, making them undecodeble.
  - We initialized the reference picture lists with (0xFF), representing invalid picture index. Normally these invalid indices are replaced by valid values during RPS decoding. However, on undecodable RASL pictures, we can not find an existing reference picture in DPB, leaving the invalid index untouched and resulting invalid indexing later on.
  - Now we initialize the reference picture lists with a valid value 0. Also we add index range check on reference buffer at VA-API layer to avoid invalid memory access.

* * rocDecode/HEVC: Fixed a typo in sampel app message.

* *rocDecode/HEVC: Fixed a bug in reference picture list modification parsing.
  - This fixed the test failure of two conformance streams.

[ROCm/rocdecode commit: c9cfcde12d]
2023-12-15 16:08:19 -05:00
jeffqjiangNew 7b2035c071 Fixed the random crash associated with undecodable RASL pictures. (#141)
* * rocDecode/HEVC: Fixed the random crash associated with undecodable RASL pictures.
  - When a CRA picutre occurs, all the pictures in the DPB are emptied. However, the following RASL (Random Access Skipped Leading) picture can still reference these emptied pictures, making them undecodeble.
  - We initialized the reference picture lists with (0xFF), representing invalid picture index. Normally these invalid indices are replaced by valid values during RPS decoding. However, on undecodable RASL pictures, we can not find an existing reference picture in DPB, leaving the invalid index untouched and resulting invalid indexing later on.
  - Now we initialize the reference picture lists with a valid value 0. Also we add index range check on reference buffer at VA-API layer to avoid invalid memory access.

* * rocDecode/HEVC: Fixed a typo in sampel app message.

[ROCm/rocdecode commit: 0fbd030b5d]
2023-12-15 15:54:43 -05:00
jeffqjiangNew 82d328b627 * rocDecode/HEVC: Fixed the decode failure of the conformance stream BUMPING_A_ericsson_1.bit. (#133)
- This stream tests output order conformance, in particular the bumping process. Four temporal layers are used and IRAP pictures with no_output_of_prior_pics_flag equal to 1 are present in the bitstream.

[ROCm/rocdecode commit: 42f109369e]
2023-12-13 09:48:15 -05:00
jeffqjiangNew 7cd5d6c0ee * rocDecode/HEVC: Added frame rate info report when it is available, from the parser. (#130)
[ROCm/rocdecode commit: 7240ee8973]
2023-12-12 13:47:19 -05:00
jeffqjiangNew a265b9a3da * rocDecode: Fix for the performance regression introduced by PR#114. (#128)
- Skip the additional buffer bumping specified in process C.5.2.2., to avoid synchronous job submission in some cases.
  - Increase DPB buffer size now by 2 to avoid overwriting pictures to be output.

[ROCm/rocdecode commit: a2dfa8bc26]
2023-12-08 17:53:01 -05:00
jeffqjiangNew 64d7f1c37f * rocDecode/HEVC: In flush DPB function, added a check for any buffers that need for output before any actions. This prevents any potential issues. (#121)
[ROCm/rocdecode commit: fcd63b9358]
2023-12-06 09:39:49 -05:00
jeffqjiangNew dd3b609a09 * rocDecode/HEVC: Fix for decode errors on a few conformance streams. (#114)
- Re-wrote short term RPS parsing function. The previous code generates incorrect results on some conformance streams.
  - No longer skip the additional buffer bumping specified in process C.5.2.2. This avoids the situation where the current frame overwrites the previously decoded buffer that is being output/displayed.

[ROCm/rocdecode commit: 5e65788bdd]
2023-12-04 11:53:26 -05:00
Aryan Salmanpour bf9ca09a9a Chamne the return type of FillSeqCallbackFn to int and check to see if it returns any error (#112)
[ROCm/rocdecode commit: ae63fbacab]
2023-12-01 14:50:33 -05:00
jeffqjiangNew 10545bcd94 * rocDecode/HEVC: When video size changes, set new SPS activation flag. This takes care of the case where a new SPS replaces the old SPS with the same id but with different dimensions. (#110)
[ROCm/rocdecode commit: a878a106fb]
2023-11-30 18:32:25 -05:00
Aryan Salmanpour 7358b1b595 use std::max to avoid compilation issue (#107)
[ROCm/rocdecode commit: c1a8ac48b4]
2023-11-30 11:29:39 -05:00
jeffqjiangNew f89b8e0d80 * rocDecode/HEVC: Fixed corruptions in RASL (Random Access Skipped Leading) pictures of an associated CRA picture. (#96)
- It appears that the root cause of the corruption is the loss of some reference info of the RASL pictures at VA-API driver level.
  - For reasons that are not documented in VA-API, or simply implementation limitations, the DPB buffer status when a CRA picture is decoded, needs to be sent to VA-API driver to the correct decoding of the associated RASL pictures. The info is stored in PocStFoll and PocLtFoll and is not needed for CRA picture decode, which is an intra picture. Without this info, the following RASL picture decode will run into problem even when its reference picture info is correctly specified.
  - Note this appears to be a VA-API specific issue because it did not occur on other platforms.

[ROCm/rocdecode commit: 2d14eb61b2]
2023-11-29 08:33:00 -05:00
jeffqjiangNew b4216ccb63 * rocDecode/HEVC: Fixed a method name typo. (#92)
[ROCm/rocdecode commit: 27d28dd5f4]
2023-11-28 14:03:13 -05:00
jeffqjiangNew ab36eb705a * rocDecode/HEVC: Fixed the missing output picture issue on certain streams. (#89)
- When we hit IRAP (Intra Random Access Point) picture and need to bump all remaining decoded pictures from DPB, call display callback immediately, instead of delaying the callback to the IRAP decode process.

[ROCm/rocdecode commit: 09da68790c]
2023-11-27 19:54:49 -05:00
jeffqjiangNew 7035965722 End of stream flush (#86)
* * rocDecode/HEVC: Added picture output operation in DPB and display callback function.
  - To avoid serialization of decode submissions and/or display callback in certain cases, increased DPB buffer size by 1 and tweaked picture bumping procedure.

* * rocDecode/HEVC: Added flushing of the remaining pictures from DPB at the end of decode session.

* * rocDecode/HEVC: Changed output_pic_num to num_output_pics to void some confusion. Set top_field_first to 1.

* * rocDecode/HEVC: Added a few return error checks.

[ROCm/rocdecode commit: 624c3c0f09]
2023-11-27 13:03:26 -05:00
jeffqjiangNew 8b432bce65 Added picture output operation in DPB and display callback function. (#83)
* * rocDecode/HEVC: Added picture output operation in DPB and display callback function.
  - To avoid serialization of decode submissions and/or display callback in certain cases, increased DPB buffer size by 1 and tweaked picture bumping procedure.

* * rocDecode/HEVC: Added a few error checks and minor format changes.

[ROCm/rocdecode commit: 57c040eff8]
2023-11-27 11:04:01 -05:00
jeffqjiangNew 67c9ea1983 Re-enabled SEI message processing. (#79)
* * rocDecode/HEVC: Re-enabled SEI message processing.
  - Added "-sei" command option to extract SEI messages from stream.
  - Added support for SEI info parsing for multiple SEI NAL units with multiple payloads.
  - Fixed a SEI syntax parsing issue and several procssing issues.
  - Fixed a double free memory issue in SEI data buffer handling in HandlePictureDisplay().

* * rocDecode/HEVC: Coding format changes.

* * rocDecode/HEVC: Minor format changes.

[ROCm/rocdecode commit: ad186a90da]
2023-11-21 14:33:15 -05:00
Rajy Rawther 6918fb07c4 Rr/check sei function pointer (#78)
* commending out ParseSeiMessage because it is causing segfault

* CMake changes for valgrind

* added function pointer validity for sei callback

* fix review comments

[ROCm/rocdecode commit: 012f96c8c5]
2023-11-21 11:23:47 -05:00
Rajy Rawther e925faf9fe commending out ParseSeiMessage because it is causing segfault (#76)
[ROCm/rocdecode commit: 210976616f]
2023-11-17 20:56:05 -05:00