sailfishos / droidmedia

15 stars 57 forks source link

Camera2: Inverted Colors in preview #116

Open simonschmeisser opened 10 months ago

simonschmeisser commented 10 months ago

Currently the colors in camera preview are inverted.

For Xperia 10 III camera2 reports the following supported formats:

10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 32 20  AIMAGE_FORMAT_RAW16
10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 34 22  AIMAGE_FORMAT_PRIVATE
10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 35 23  AIMAGE_FORMAT_YUV_420_888
10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 36 24  AIMAGE_FORMAT_RAW_PRIVATE
10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 37 25  AIMAGE_FORMAT_RAW10
10-13 20:23:08.170  4552   942 I DroidMediaCamera: format 256 100 AIMAGE_FORMAT_JPEG

@mal dropped AIMAGE_FORMAT_YUV_420_888 in some places but commented it out, commenting it back in does not make it work unfortunately

simonschmeisser commented 10 months ago

gst-inspect-1.0 droidcamsrc gives the following formats for the viewfinder:

  SRC template: 'vfsrc'
    Availability: Always
    Capabilities:
      video/x-raw(memory:DroidMediaQueueBuffer)
                 format: { (string)NV12_64Z32, (string)YV12, (string)NV16, (string)NV12, (string)NV21, (string)YUY2, (string)RGBA, (string)RGBx, (string)RGB, (string)RGB16, (string)BGRA, (string)ENCODED }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)NV21 }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
simonschmeisser commented 10 months ago

Fun fact: I reverted to camera1 and while sf-camera and fennec browser (via android app support) show the correct colors, sf-browser does not. It has the inverted colors on master/camera1.

mlehtima commented 10 months ago

I managed to find a bit hacky way to get the colors correct on Xperia 10 III but needs to be tested it doesn't break any other devices.

simonschmeisser commented 9 months ago

I tested your latest branch and it looks good here!