diff --git a/docs/docs/guides/FORMATS.mdx b/docs/docs/guides/FORMATS.mdx index 852848f..e2efed1 100644 --- a/docs/docs/guides/FORMATS.mdx +++ b/docs/docs/guides/FORMATS.mdx @@ -42,8 +42,8 @@ To get all available formats, simply use the `CameraDevice`'s [`formats` propert - [`minFps`](/docs/api/interfaces/CameraDeviceFormat#minfps)/[`maxFps`](/docs/api/interfaces/CameraDeviceFormat#maxfps): A range of possible values for the `fps` property. For example, if your format has `minFps: 1` and `maxFps: 60`, you can either use `fps={30}`, `fps={60}` or any other value in between for recording videos. - [`videoStabilizationModes`](/docs/api/interfaces/CameraDeviceFormat#videostabilizationmodes): All supported Video Stabilization Modes, digital and optical. If this specific format contains your desired [`VideoStabilizationMode`](/docs/api/#videostabilizationmode), you can pass it to your `` via the [`videoStabilizationMode` property](/docs/api/interfaces/CameraProps#videoStabilizationMode). - [`pixelFormats`](/docs/api/interfaces/CameraDeviceFormat#pixelformats): All supported Pixel Formats. If this specific format contains your desired [`PixelFormat`](/docs/api/#PixelFormat), you can pass it to your `` via the [`pixelFormat` property](/docs/api/interfaces/CameraProps#pixelFormat). -- [`supportsVideoHDR`](/docs/api/interfaces/CameraDeviceFormat#supportsvideohdr): Whether this specific format supports true 10-bit HDR for video capture. If this is `true`, you can enable `hdr` on your ``. -- [`supportsPhotoHDR`](/docs/api/interfaces/CameraDeviceFormat#supportsphotohdr): Whether this specific format supports HDR for photo capture. It will use multiple captures to fuse over-exposed and under-exposed Images together to form one HDR photo. If this is `true`, you can enable `hdr` on your ``. +- [`supportsVideoHdr`](/docs/api/interfaces/CameraDeviceFormat#supportsvideohdr): Whether this specific format supports true 10-bit HDR for video capture. If this is `true`, you can enable `videoHdr` on your ``. +- [`supportsPhotoHdr`](/docs/api/interfaces/CameraDeviceFormat#supportsphotohdr): Whether this specific format supports HDR for photo capture. It will use multiple captures to fuse over-exposed and under-exposed Images together to form one HDR photo. If this is `true`, you can enable `photoHdr` on your ``. - [`supportsDepthCapture`](/docs/api/interfaces/CameraDeviceFormat#supportsdepthcapture): Whether this specific format supports depth data capture. For devices like the TrueDepth/LiDAR cameras, this will always be true. - ...and more. See the [`CameraDeviceFormat` type](/docs/api/interfaces/CameraDeviceFormat) for all supported properties. @@ -201,7 +201,8 @@ function App() { Other props that depend on the `format`: * `fps`: Specifies the frame rate to use -* `hdr`: Enables HDR photo or video capture and preview +* `videoHdr`: Enables HDR video capture and preview +* `photoHdr`: Enables HDR photo capture * `lowLightBoost`: Enables a night-mode/low-light-boost for photo or video capture and preview * `videoStabilizationMode`: Specifies the video stabilization mode to use for the video pipeline * `pixelFormat`: Specifies the pixel format to use for the video pipeline diff --git a/docs/docs/guides/FRAME_PROCESSORS.mdx b/docs/docs/guides/FRAME_PROCESSORS.mdx index 8945ec5..a9c0961 100644 --- a/docs/docs/guides/FRAME_PROCESSORS.mdx +++ b/docs/docs/guides/FRAME_PROCESSORS.mdx @@ -239,7 +239,7 @@ When running frame processors, it is often important to choose an appropriate [f * If you are running heavy AI/ML calculations in your frame processor, make sure to [select a format](/docs/guides/formats) that has a lower resolution to optimize it's performance. You can also resize the Frame on-demand. * Sometimes a frame processor plugin only works with specific [pixel formats](/docs/api/interfaces/CameraDeviceFormat#pixelformats). Some plugins (like Tensorflow Lite Models) don't work with `yuv`, so use a [`pixelFormat`](/docs/api/interfaces/CameraProps#pixelformat) of `rgb` instead. -* Some Frame Processor plugins don't work with HDR formats. In this case you need to disable [`hdr`](/docs/api/interfaces/CameraProps#hdr). +* Some Frame Processor plugins don't work with HDR formats. In this case you need to disable [`videoHdr`](/docs/api/interfaces/CameraProps#videohdr). ## Benchmarks diff --git a/docs/docs/guides/HDR.mdx b/docs/docs/guides/HDR.mdx index 2e93222..5d469db 100644 --- a/docs/docs/guides/HDR.mdx +++ b/docs/docs/guides/HDR.mdx @@ -49,8 +49,8 @@ To enable HDR capture, you need to select a format (see ["Camera Formats"](forma ```ts const format = useCameraFormat(device, [ - { photoHDR: true }, - { videoHDR: true }, + { photoHdr: true }, + { videoHdr: true }, ]) ``` @@ -59,21 +59,27 @@ const format = useCameraFormat(device, [ ```ts const format = getCameraFormat(device, [ - { photoHDR: true }, - { videoHDR: true }, + { photoHdr: true }, + { videoHdr: true }, ]) ``` -Then, pass the `format` to the Camera and enable the `hdr` prop if it is supported: +Then, pass the `format` to the Camera and enable the `videoHdr`/`photoHdr` props if it is supported: ```tsx const format = ... -const supportsHdr = format.supportsPhotoHDR && format.supportsVideoHDR -return +return ( + +) ``` Now, all captures (`takePhoto(..)` and `startRecording(..)`) will be configured to use HDR. diff --git a/docs/docs/guides/PERFORMANCE.mdx b/docs/docs/guides/PERFORMANCE.mdx index ade6a9e..d945b8b 100644 --- a/docs/docs/guides/PERFORMANCE.mdx +++ b/docs/docs/guides/PERFORMANCE.mdx @@ -60,9 +60,9 @@ See ["Camera Devices"](devices) for more information. Note: By default (when not passing the options object), a simpler device is already chosen. -### No HDR +### No Video HDR -HDR uses 10-bit formats and/or additional processing steps that come with additional computation overhead. Disable HDR (don't pass `hdr` to the ``) for higher efficiency. +Video HDR uses 10-bit formats and/or additional processing steps that come with additional computation overhead. Disable Video HDR (don't pass `videoHdr` to the ``) for higher efficiency. ### Buffer Compression diff --git a/docs/docs/guides/RECORDING_VIDEOS.mdx b/docs/docs/guides/RECORDING_VIDEOS.mdx index b5c0b3d..9ec59e9 100644 --- a/docs/docs/guides/RECORDING_VIDEOS.mdx +++ b/docs/docs/guides/RECORDING_VIDEOS.mdx @@ -145,7 +145,7 @@ To calculate your target bit-rate, you can use this formula: ```ts let bitRate = baseBitRate bitRate = bitRate / 30 * fps // FPS -if (hdr === true) bitRate *= 1.2 // HDR +if (videoHdr === true) bitRate *= 1.2 // 10-Bit Video HDR if (codec === 'h265') bitRate *= 0.8 // H.265 bitRate *= yourCustomFactor // e.g. 0.5x for half the bit-rate ``` diff --git a/docs/docs/guides/TROUBLESHOOTING.mdx b/docs/docs/guides/TROUBLESHOOTING.mdx index 123d049..2ab7157 100644 --- a/docs/docs/guides/TROUBLESHOOTING.mdx +++ b/docs/docs/guides/TROUBLESHOOTING.mdx @@ -57,7 +57,7 @@ If you're experiencing build issues or runtime issues in VisionCamera, make sure * For errors without messages, there's often an error code attached. Look up the error code on [osstatus.com](https://www.osstatus.com) to get more information about a specific error. 2. If your Frame Processor is not running, make sure you check the native Xcode logs. There is useful information about the Frame Processor Runtime that will tell you if something goes wrong. 3. If your Frame Processor is not running, make sure you are not using a remote JS debugger such as Google Chrome, since those don't work with JSI. -4. If you are experiencing black-screens, try removing all properties such as `fps`, `hdr` or `format` on the `` component except for the required ones: +4. If you are experiencing black-screens, try removing all properties such as `fps`, `videoHdr` or `format` on the `` component except for the required ones: ```tsx ``` @@ -112,7 +112,7 @@ If you're experiencing build issues or runtime issues in VisionCamera, make sure 2. If a camera device is not being returned by [`Camera.getAvailableCameraDevices()`](/docs/api/classes/Camera#getavailablecameradevices), make sure it is a Camera2 compatible device. See [this section in the Android docs](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#reprocessing) for more information. 3. If your Frame Processor is not running, make sure you check the native Android Studio/Logcat logs. There is useful information about the Frame Processor Runtime that will tell you if something goes wrong. 4. If your Frame Processor is not running, make sure you are not using a remote JS debugger such as Google Chrome, since those don't work with JSI. -5. If you are experiencing black-screens, try removing all properties such as `fps`, `hdr` or `format` on the `` component except for the required ones: +5. If you are experiencing black-screens, try removing all properties such as `fps`, `videoHdr` or `format` on the `` component except for the required ones: ```tsx ``` diff --git a/package/android/src/main/java/com/mrousavy/camera/CameraView.kt b/package/android/src/main/java/com/mrousavy/camera/CameraView.kt index de404e8..95ceb90 100644 --- a/package/android/src/main/java/com/mrousavy/camera/CameraView.kt +++ b/package/android/src/main/java/com/mrousavy/camera/CameraView.kt @@ -70,7 +70,8 @@ class CameraView(context: Context) : var format: ReadableMap? = null var fps: Int? = null var videoStabilizationMode: VideoStabilizationMode? = null - var hdr: Boolean? = null // nullable bool + var videoHdr = false + var photoHdr = false var lowLightBoost: Boolean? = null // nullable bool // other props @@ -177,6 +178,10 @@ class CameraView(context: Context) : // Orientation config.orientation = orientation + // HDR + config.videoHdr = videoHdr + config.photoHdr = photoHdr + // Format val format = format if (format != null) { @@ -188,7 +193,6 @@ class CameraView(context: Context) : // Side-Props config.fps = fps config.enableLowLightBoost = lowLightBoost ?: false - config.enableHdr = hdr ?: false config.torch = torch // Zoom diff --git a/package/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt b/package/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt index 0d25383..6e06b4c 100644 --- a/package/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt +++ b/package/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt @@ -107,9 +107,14 @@ class CameraViewManager : ViewGroupManager() { view.fps = if (fps > 0) fps else null } - @ReactProp(name = "hdr") - fun setHdr(view: CameraView, hdr: Boolean?) { - view.hdr = hdr + @ReactProp(name = "photoHdr", defaultBoolean = false) + fun setPhotoHdr(view: CameraView, photoHdr: Boolean) { + view.photoHdr = photoHdr + } + + @ReactProp(name = "videoHdr", defaultBoolean = false) + fun setVideoHdr(view: CameraView, videoHdr: Boolean) { + view.videoHdr = videoHdr } @ReactProp(name = "lowLightBoost") @@ -117,7 +122,7 @@ class CameraViewManager : ViewGroupManager() { view.lowLightBoost = lowLightBoost } - @ReactProp(name = "isActive") + @ReactProp(name = "isActive", defaultBoolean = false) fun setIsActive(view: CameraView, isActive: Boolean) { view.isActive = isActive } diff --git a/package/android/src/main/java/com/mrousavy/camera/core/CameraConfiguration.kt b/package/android/src/main/java/com/mrousavy/camera/core/CameraConfiguration.kt index b13115a..e2adbf9 100644 --- a/package/android/src/main/java/com/mrousavy/camera/core/CameraConfiguration.kt +++ b/package/android/src/main/java/com/mrousavy/camera/core/CameraConfiguration.kt @@ -17,7 +17,10 @@ data class CameraConfiguration( var photo: Output = Output.Disabled.create(), var video: Output