class Raw12Writer

Defined at line 36 of file ../../src/camera/lib/image_utils/raw12_writer.h

Public Methods

fpromise::result<std::unique_ptr<Raw12Writer>, zx_status_t> Create (uint32_t width, uint32_t height)

Factory method that outputs a Raw12Writer with all its params set for the format.

Args:

|width| Intended width for images to be written (in # of pixels).

|height| Intended height for images to be written (in # of pixels).

|pixel_format| Intended byte representation for each pixel in the images to be written.

Returns:

A Raw12Writer object that writes images to vmos.

Defined at line 32 of file ../../src/camera/lib/image_utils/raw12_writer.cc

zx_status_t Write (zx::vmo * vmo, uint16_t r, uint16_t g, uint16_t b)

Fills a provided vmo with default data in the RAW12 image format. Only a RGGB layout is used at

the moment.

The red pixel value stays consistent at a value of r throughout the image.

The green pixels value increases from 0 to a maximum of g across individual rows.

The blue pixel value increases from 0 to a maximum of b across individual columns.

Each double-pixel is laid out like so:

Bits -> 7 6 5 4 3 2 1 0

Byte0 -> P0[11] P0[10] P0[9] P0[8] P0[7] P0[6] P0[5] P0[4]

Byte1 -> P1[11] P1[10] P1[9] P1[8] P1[7] P1[6] P1[5] P1[4]

Byte2 -> P1[3] P1[2] P1[1] P1[0] P0[3] P0[2] P0[1] P0[0]

A RG row with two double-pixels (six bytes) looks like:

R0[11:4], G0[11:4], G0[3:0]R0[3:0], R1[11:4], G1[11:4], G1[3:0]R1[3:0]

A GB row with two double pixels (six bytes) looks like:

G0[11:4], B0[11:4], B0[3:0]G0[3:0], G1[11:4], B1[11:4], B1[3:0]G1[3:0]

Args:

|vmo| Memory object handle to which the image will be written. The vmo must have been created

before passing it in.

|r| Red pixel value; default is set to kRedPixel.

|g| Green pixel values in the image will range from 0 to g; default is set to kMaxPixelVal.

|b| Blue pixel values in the image will range from 0 to b; default is set to kMaxPixelVal.

TODO(nzo): split g into gr and gb.

TODO(nzo): use a more straightforward filling method; scaling with step functions causes a few

issues downstream of image creation.

Defined at line 43 of file ../../src/camera/lib/image_utils/raw12_writer.cc

void Raw12Writer (uint32_t width, uint32_t height, size_t vmo_size)

Constructor.

Args:

|width| The width of the image to be written.

|height| The height of the image to be written.

|vmo_size| Number of bytes comprising the intended images to be written (width * height * # of

bytes per pixel).

Defined at line 44 of file ../../src/camera/lib/image_utils/raw12_writer.h