Fixed several issues with cropping. (#275)

* * rocDecode: Fixed several issues with cropping.
  - Fixed the pixel start offset error on streams with non-zero top/left cropping in MD5 calculation.
  - Fixed the pixel start offset error on streams with non-zero top/left cropping, and/or with user specified cropping in YUV frame output.
  - Sorted out code which deals with cropping area specifiied by the bitstream, and cropping area specified by the user.

* * rocDecode: Additional changes after discussion.
 - Set display rect for decoder create/reconfig to displayable area or user specified ROI area.
 - Do not set target rect for decoder create/reconfig. Leave it for future use.
 - Unified naming of display rect in decoder create/reconfig structs.

* * rocDecode: Put back the extra rounding to target width/height specifiied by the coded stream, for peace of mind, based on code review.

* * rocDecode: Added the missing stream specified cropping offset to the starting pixel pointer for none-internal memory modes.

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>
このコミットが含まれているのは:
jeffqjiangNew
2024-03-11 22:35:11 -04:00
committed by GitHub
コミット e4614de461
7個のファイルの変更129行の追加115行の削除
+7 -12
ファイルの表示
@@ -116,7 +116,7 @@ typedef enum rocDecVideoSurfaceFormat_enum {
//! These enums are used in ROCDCODECREATEINFO and RocdecDecodeCaps structures
/**************************************************************************************************************/
typedef enum rocDecVideoChromaFormat_enum {
rocDecVideoChromaFormat_Monochrome=0, /**< MonoChrome */
rocDecVideoChromaFormat_Monochrome = 0, /**< MonoChrome */
rocDecVideoChromaFormat_420, /**< YUV 4:2:0 */
rocDecVideoChromaFormat_422, /**< YUV 4:2:2 */
rocDecVideoChromaFormat_444 /**< YUV 4:4:4 */
@@ -186,7 +186,7 @@ typedef struct _RocDecoderCreateInfo {
int16_t top;
int16_t right;
int16_t bottom;
} display_area; /**< IN: area of the frame that should be displayed */
} display_rect; /**< IN: area of the frame that should be displayed */
rocDecVideoSurfaceFormat output_format; /**< IN: rocDecVideoSurfaceFormat_XXX */
uint32_t target_width; /**< IN: Post-processed output width (Should be aligned to 2) */
uint32_t target_height; /**< IN: Post-processed output height (Should be aligned to 2) */
@@ -196,8 +196,8 @@ typedef struct _RocDecoderCreateInfo {
int16_t top;
int16_t right;
int16_t bottom;
} target_rect; /**< IN: target rectangle in the output frame (for aspect ratio conversion)
if a null rectangle is specified, {0,0,target_width,target_height} will be used*/
} target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion)
if a null rectangle is specified, {0,0,target_width,target_height} will be used*/
uint32_t reserved_2[4]; /**< Reserved for future use - set to zero */
} RocDecoderCreateInfo;
@@ -226,24 +226,19 @@ typedef struct _RocdecReconfigureDecoderInfo {
uint32_t target_height; /**< IN: Post Processed output height */
uint32_t num_decode_surfaces; /**< IN: Maximum number of internal decode surfaces */
uint32_t reserved_1[12]; /**< Reserved for future use. Set to Zero */
/**
* IN: Area of frame to be displayed. Use-case : Source Cropping
*/
struct {
int16_t left;
int16_t top;
int16_t right;
int16_t bottom;
} roi_area;
/**
* IN: Target Rectangle in the OutputFrame. Use-case : Aspect ratio Conversion
*/
} display_rect; /**< IN: area of the frame that should be displayed */
struct {
int16_t left;
int16_t top;
int16_t right;
int16_t bottom;
} target_rect;
} target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion)
if a null rectangle is specified, {0,0,target_width,target_height} will be used */
uint32_t reserved_2[11]; /**< Reserved for future use. Set to Zero */
} RocdecReconfigureDecoderInfo;