-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HDR capture support #86
Conversation
@madebymozart this is ready for review now! |
videoCapabilities.supportedDynamicRanges | ||
|
||
supportedHdrEncoding = supportedDynamicRanges.firstOrNull { | ||
it != DynamicRange.SDR // Ensure an HDR encoding is found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you directly check HDR, not SDR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to this, can we just check if it is HDR instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure, i copied the code snippet from https://android-developers.googleblog.com/2023/06/camerax-13-is-now-in-beta.html which has the snippet:
supportedHdrEncoding = supportedDynamicRanges.firstOrNull {
it != DynamicRange.SDR // Ensure an HDR encoding is found
}
@donovanfm any idea why we are checking for NOT SDR instead of checking for HDR directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, I think making the adjustments to specific HLG 10 bit is what we should do
videoCapabilities.supportedDynamicRanges | ||
|
||
supportedHdrEncoding = supportedDynamicRanges.firstOrNull { | ||
it != DynamicRange.SDR // Ensure an HDR encoding is found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we actually make this more specific as well?
There seem to be multiple different dynamic range profiles and to make it consistent, we should choose one we know they all support, which would be HLG 10-bit
https://developer.android.com/reference/androidx/camera/core/DynamicRange
Any device that supports HDR should support HLG 10-bit at a minimum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
private var currentRecording: Recording? = null | ||
private lateinit var recordingState: VideoRecordEvent | ||
|
||
init { | ||
val videoCaptureBuilder = VideoCapture.Builder(recorder) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: any reason for the space here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think just habit for personal preference for code readability, but removed
updated based on feedback. @madebymozart can you take another look? thanks! |
Non-HDR video captured without changes in this PR
https://github.com/user-attachments/assets/5977f46c-a375-4b89-b15e-a3cd27f1c508
HDR video captured with changes in this PR
https://github.com/user-attachments/assets/97c513cc-25af-4c87-afd1-2654518a8f52