Loading tests/SilkFX/res/layout/gainmap_image.xml +27 −6 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="SDR original" /> android:text="SDR" /> <RadioButton android:id="@+id/output_gainmap" android:layout_width="wrap_content" Loading @@ -46,14 +46,35 @@ android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="HDR (sdr+gainmap)" /> android:text="HDR" /> <RadioButton android:id="@+id/output_hdr_test" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="HDR (test)" /> </RadioGroup> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Spinner android:id="@+id/image_selection" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:id="@+id/gainmap_metadata" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gainmap Metadata..." /> </LinearLayout> <TextView android:id="@+id/error_msg" android:layout_width="match_parent" Loading tests/SilkFX/res/layout/gainmap_metadata.xml 0 → 100644 +264 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="350dp" android:layout_height="300dp" android:layout_centerHorizontal="true" android:padding="8dp" android:orientation="vertical" android:background="#444444"> <TextView android:id="@+id/gainmap_metadata_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="Metadata for "HDR (test)" (values in linear space):" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gainmapmin_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gain Map Min:" /> <TextView android:id="@+id/gainmap_metadata_gainmapmin_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gainmapmin" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gainmapmax_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gain Map Max:" /> <TextView android:id="@+id/gainmap_metadata_gainmapmax_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gainmapmax" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_capacitymin_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Capacity Min:" /> <TextView android:id="@+id/gainmap_metadata_capacitymin_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_capacitymin" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_capacitymax_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Capacity Max:" /> <TextView android:id="@+id/gainmap_metadata_capacitymax_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_capacitymax" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gamma_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gamma:" /> <TextView android:id="@+id/gainmap_metadata_gamma_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gamma" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_offsetsdr_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Offset SDR:" /> <TextView android:id="@+id/gainmap_metadata_offsetsdr_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_offsetsdr" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_offsethdr_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Offset HDR:" /> <TextView android:id="@+id/gainmap_metadata_offsethdr_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_offsethdr" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/gainmap_metadata_reset" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Reset" /> <Button android:id="@+id/gainmap_metadata_done" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Done" /> </LinearLayout> </LinearLayout> </RelativeLayout> tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapImage.kt +18 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.util.AttributeSet import android.view.View import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.Button import android.widget.FrameLayout import android.widget.RadioGroup import android.widget.Spinner Loading @@ -44,6 +45,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context private var gainmap: Gainmap? = null private var gainmapVisualizer: Bitmap? = null private lateinit var imageView: SubsamplingScaleImageView private lateinit var gainmapMetadataEditor: GainmapMetadataEditor init { gainmapImages = context.assets.list("gainmaps")!! Loading @@ -58,6 +60,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context super.onFinishInflate() imageView = findViewById(R.id.image)!! gainmapMetadataEditor = GainmapMetadataEditor(this, imageView) findViewById<RadioGroup>(R.id.output_mode)!!.also { it.check(outputMode) Loading Loading @@ -92,6 +95,10 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context } } findViewById<Button>(R.id.gainmap_metadata)!!.setOnClickListener { gainmapMetadataEditor.openEditor() } setImage(0) imageView.apply { Loading Loading @@ -132,6 +139,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context findViewById<RadioGroup>(R.id.output_mode)!!.visibility = View.VISIBLE gainmap = bitmap!!.gainmap gainmapMetadataEditor.setGainmap(gainmap) val map = gainmap!!.gainmapContents if (map.config != Bitmap.Config.ALPHA_8) { gainmapVisualizer = map Loading Loading @@ -175,7 +183,15 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context imageView.setImage(ImageSource.cachedBitmap(when (outputMode) { R.id.output_hdr -> { bitmap!!.gainmap = gainmap; bitmap!! gainmapMetadataEditor.useOriginalMetadata() bitmap!!.gainmap = gainmap bitmap!! } R.id.output_hdr_test -> { gainmapMetadataEditor.useEditMetadata() bitmap!!.gainmap = gainmap bitmap!! } R.id.output_sdr -> { Loading tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt 0 → 100644 +284 −0 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
tests/SilkFX/res/layout/gainmap_image.xml +27 −6 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="SDR original" /> android:text="SDR" /> <RadioButton android:id="@+id/output_gainmap" android:layout_width="wrap_content" Loading @@ -46,14 +46,35 @@ android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="HDR (sdr+gainmap)" /> android:text="HDR" /> <RadioButton android:id="@+id/output_hdr_test" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="HDR (test)" /> </RadioGroup> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Spinner android:id="@+id/image_selection" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:id="@+id/gainmap_metadata" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gainmap Metadata..." /> </LinearLayout> <TextView android:id="@+id/error_msg" android:layout_width="match_parent" Loading
tests/SilkFX/res/layout/gainmap_metadata.xml 0 → 100644 +264 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="350dp" android:layout_height="300dp" android:layout_centerHorizontal="true" android:padding="8dp" android:orientation="vertical" android:background="#444444"> <TextView android:id="@+id/gainmap_metadata_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="Metadata for "HDR (test)" (values in linear space):" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gainmapmin_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gain Map Min:" /> <TextView android:id="@+id/gainmap_metadata_gainmapmin_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gainmapmin" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gainmapmax_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gain Map Max:" /> <TextView android:id="@+id/gainmap_metadata_gainmapmax_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gainmapmax" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_capacitymin_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Capacity Min:" /> <TextView android:id="@+id/gainmap_metadata_capacitymin_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_capacitymin" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_capacitymax_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Capacity Max:" /> <TextView android:id="@+id/gainmap_metadata_capacitymax_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_capacitymax" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_gamma_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Gamma:" /> <TextView android:id="@+id/gainmap_metadata_gamma_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_gamma" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_offsetsdr_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Offset SDR:" /> <TextView android:id="@+id/gainmap_metadata_offsetsdr_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_offsetsdr" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="horizontal"> <TextView android:id="@+id/gainmap_metadata_offsethdr_text" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Offset HDR:" /> <TextView android:id="@+id/gainmap_metadata_offsethdr_val" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:text="TODO" /> <SeekBar android:id="@+id/gainmap_metadata_offsethdr" android:min="0" android:max="100" android:layout_width="150dp" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/gainmap_metadata_reset" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Reset" /> <Button android:id="@+id/gainmap_metadata_done" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:text="Done" /> </LinearLayout> </LinearLayout> </RelativeLayout>
tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapImage.kt +18 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.util.AttributeSet import android.view.View import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.Button import android.widget.FrameLayout import android.widget.RadioGroup import android.widget.Spinner Loading @@ -44,6 +45,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context private var gainmap: Gainmap? = null private var gainmapVisualizer: Bitmap? = null private lateinit var imageView: SubsamplingScaleImageView private lateinit var gainmapMetadataEditor: GainmapMetadataEditor init { gainmapImages = context.assets.list("gainmaps")!! Loading @@ -58,6 +60,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context super.onFinishInflate() imageView = findViewById(R.id.image)!! gainmapMetadataEditor = GainmapMetadataEditor(this, imageView) findViewById<RadioGroup>(R.id.output_mode)!!.also { it.check(outputMode) Loading Loading @@ -92,6 +95,10 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context } } findViewById<Button>(R.id.gainmap_metadata)!!.setOnClickListener { gainmapMetadataEditor.openEditor() } setImage(0) imageView.apply { Loading Loading @@ -132,6 +139,7 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context findViewById<RadioGroup>(R.id.output_mode)!!.visibility = View.VISIBLE gainmap = bitmap!!.gainmap gainmapMetadataEditor.setGainmap(gainmap) val map = gainmap!!.gainmapContents if (map.config != Bitmap.Config.ALPHA_8) { gainmapVisualizer = map Loading Loading @@ -175,7 +183,15 @@ class GainmapImage(context: Context, attrs: AttributeSet?) : FrameLayout(context imageView.setImage(ImageSource.cachedBitmap(when (outputMode) { R.id.output_hdr -> { bitmap!!.gainmap = gainmap; bitmap!! gainmapMetadataEditor.useOriginalMetadata() bitmap!!.gainmap = gainmap bitmap!! } R.id.output_hdr_test -> { gainmapMetadataEditor.useEditMetadata() bitmap!!.gainmap = gainmap bitmap!! } R.id.output_sdr -> { Loading
tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt 0 → 100644 +284 −0 File added.Preview size limit exceeded, changes collapsed. Show changes