* 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]
Этот коммит содержится в:
jeffqjiangNew
2025-03-03 09:31:49 -05:00
коммит произвёл GitHub
родитель eb2aae5c39
Коммит ef7c4c900c
3 изменённых файлов: 8 добавлений и 2 удалений
+2
Просмотреть файл
@@ -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
+5 -2
Просмотреть файл
@@ -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;
}
+1
Просмотреть файл
@@ -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: