* rocDecoder/Bitstream reader: Added stream type detection optimization. (#522)

- During stream type evaluation, when we have a high confidence score, we stop and finalize, to avoid unnecessary exhaustive type search.

[ROCm/rocdecode commit: 5f779a6eb7]
Este commit está contenido en:
jeffqjiangNew
2025-03-03 09:31:49 -05:00
cometido por GitHub
padre eb2aae5c39
commit ef7c4c900c
Se han modificado 3 ficheros con 8 adiciones y 2 borrados
+2
Ver fichero
@@ -10,6 +10,8 @@ Full documentation for rocDecode is available at [https://rocm.docs.amd.com/proj
### Changed
* Bitstream type detection optimization in bitstream reader.
### Removed
## rocDecode 0.10.0 for ROCm 6.4
@@ -585,6 +585,9 @@ int RocVideoESParser::ProbeStreamType() {
break;
}
}
if (stream_type_score >= STREAM_TYPE_HIGH_CONFIDENCE_SCORE_THRESHOLD) {
break;
}
}
if (stream_buf) {
@@ -688,7 +691,7 @@ int RocVideoESParser::CheckAvcEStream(uint8_t *p_stream, int stream_size) {
if (num_start_codes == 0) {
score = 0;
} else {
score = sps_present * 25 + pps_present * 25 + idr_slice_present * 15 + slice_present * 15 + first_slice_present * 15;
score = sps_present * 25 + pps_present * 25 + idr_slice_present * 20 + slice_present * 15 + first_slice_present * 15;
}
return score;
}
@@ -832,7 +835,7 @@ int RocVideoESParser::CheckHevcEStream(uint8_t *p_stream, int stream_size) {
if (num_start_codes == 0) {
score = 0;
} else {
score = vps_present * 20 + sps_present * 20 + pps_present * 20 + rap_slice_present * 15 + slice_present * 15 + first_slice_present * 15;
score = vps_present * 15 + sps_present * 20 + pps_present * 20 + rap_slice_present * 15 + slice_present * 15 + first_slice_present * 15;
}
return score;
}
@@ -42,6 +42,7 @@ enum {
#define STREAM_PROBE_SIZE 2 * 1024
#define STREAM_TYPE_SCORE_THRESHOLD 50
#define STREAM_TYPE_HIGH_CONFIDENCE_SCORE_THRESHOLD 90
class RocVideoESParser {
public: