diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-09-21 14:58:10 -0700 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-09-21 15:01:27 -0700 |
commit | ddd59b14583126d6282d2fab3142171934981e85 (patch) | |
tree | cb51af33fc226d18f49b8a9b2cf5db518dc63aca /android/camera | |
parent | a8559e023df6c94eee98d90a6689f421873d91f7 (diff) | |
download | external_qemu-ddd59b14583126d6282d2fab3142171934981e85.zip external_qemu-ddd59b14583126d6282d2fab3142171934981e85.tar.gz external_qemu-ddd59b14583126d6282d2fab3142171934981e85.tar.bz2 |
Fix NV12, and NV21 format descriptors
Also adds support for YU12 pixel format that is used in video frames
Change-Id: I613beef8b3e2296fd1fab7e2b9d2956fba1ac788
Diffstat (limited to 'android/camera')
-rw-r--r-- | android/camera/camera-capture-linux.c | 1 | ||||
-rwxr-xr-x | android/camera/camera-format-converters.c | 22 | ||||
-rw-r--r-- | android/camera/camera-service.c | 1 |
3 files changed, 20 insertions, 4 deletions
diff --git a/android/camera/camera-capture-linux.c b/android/camera/camera-capture-linux.c index 50324f0..895690d 100644 --- a/android/camera/camera-capture-linux.c +++ b/android/camera/camera-capture-linux.c @@ -123,6 +123,7 @@ struct LinuxCameraDevice { static const uint32_t _preferred_formats[] = { /* Native format for the emulated camera: no conversion at all. */ + V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_YVU420, /* Continue with YCbCr: less math than with RGB */ V4L2_PIX_FMT_NV12, diff --git a/android/camera/camera-format-converters.c b/android/camera/camera-format-converters.c index 4dcb424..c675f15 100755 --- a/android/camera/camera-format-converters.c +++ b/android/camera/camera-format-converters.c @@ -1238,6 +1238,19 @@ static const YUVDesc _YV12 = .v_offset = &_VOffSepYUV }; +/* YU12: 4:2:0, YUV are fully separated, V pane follows U pane */ +static const YUVDesc _YU12 = +{ + .Y_offset = 0, + .Y_inc = 1, + .Y_next_pair = 2, + .UV_inc = 1, + .U_offset = 1, + .V_offset = 0, + .u_offset = &_UOffSepYUV, + .v_offset = &_VOffSepYUV +}; + /* NV12: 4:2:0, UV are interleaved, V follows U in UV pane */ static const YUVDesc _NV12 = { @@ -1245,8 +1258,8 @@ static const YUVDesc _NV12 = .Y_inc = 1, .Y_next_pair = 2, .UV_inc = 2, - .U_offset = 1, - .V_offset = 0, + .U_offset = 0, + .V_offset = 1, .u_offset = &_UOffIntrlUV, .v_offset = &_VOffIntrlUV }; @@ -1258,8 +1271,8 @@ static const YUVDesc _NV21 = .Y_inc = 1, .Y_next_pair = 2, .UV_inc = 2, - .U_offset = 0, - .V_offset = 1, + .U_offset = 1, + .V_offset = 0, .u_offset = &_UOffIntrlUV, .v_offset = &_VOffIntrlUV }; @@ -1394,6 +1407,7 @@ static const PIXFormat _PIXFormats[] = { /* YUV 4:2:0 formats. */ { V4L2_PIX_FMT_YVU420, PIX_FMT_YUV, .desc.yuv_desc = &_YV12 }, + { V4L2_PIX_FMT_YUV420, PIX_FMT_YUV, .desc.yuv_desc = &_YU12 }, { V4L2_PIX_FMT_NV12, PIX_FMT_YUV, .desc.yuv_desc = &_NV12 }, { V4L2_PIX_FMT_NV21, PIX_FMT_YUV, .desc.yuv_desc = &_NV21 }, diff --git a/android/camera/camera-service.c b/android/camera/camera-service.c index 78cb357..282acb4 100644 --- a/android/camera/camera-service.c +++ b/android/camera/camera-service.c @@ -1046,6 +1046,7 @@ _camera_client_query_start(CameraClient* cc, QemudClient* qc, const char* param) /* Make sure that pixel format is known, and calculate video framebuffer size * along the lines. */ switch (cc->pixel_format) { + case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YVU420: case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV21: |