    "in vec2 vTexCoord;\n"
    "out vec4 colorOut;\n"
    "void main() {\n"
    "  float y = texture(uTextureY, vTexCoord).r;\n"
    "  float u = texture(uTextureU, vTexCoord).r - 0.5;\n"
    "  float v = texture(uTextureV, vTexCoord).r - 0.5;\n"
    "  float r = y + 1.402 * v;\n"
    "  float g = y - 0.344 * u - 0.714 * v;\n"
    "  float b = y + 1.772 * u;\n"
    "  colorOut = vec4(r, g, b, 1.0);\n"
    "}\n";
  
  const mat4 device_transform = {{
    1.0,  0.0, 0.0, 0.0,
 
</s> remove   "uniform sampler2D uTextureU;\n"
  "uniform sampler2D uTextureV;\n"
 </s> add   "uniform sampler2D uTextureUV;\n" </s> remove         int dst_index = mad24(dy, dst_step, dst_offset + dx);
 </s> add         int dst_index = mad24(dy, dst_row_stride, dst_offset + dx); </s> remove     uint8_t *u = y + width * height;
    uint8_t *v = u + (width / 2) * (height / 2);
    libyuv::NV12ToI420(f->data[0], f->linesize[0], f->data[1], f->linesize[1],
                       y, width, u, width / 2, v, width / 2, width, height);
 </s> add     uint8_t *uv = y + width * height;
    for (int i = 0; i < height/2; i++) {
      memcpy(y + (i*2 + 0)*width, f->data[0] + (i*2 + 0)*f->linesize[0], width);
      memcpy(y + (i*2 + 1)*width, f->data[0] + (i*2 + 1)*f->linesize[0], width);
      memcpy(uv + i*width, f->data[1] + i*f->linesize[1], width);
    } </s> remove     uint8_t *u = yuv + width * height;
    uint8_t *v = u + (width / 2) * (height / 2);
    libyuv::I420Copy(f->data[0], f->linesize[0],
                     f->data[1], f->linesize[1],
                     f->data[2], f->linesize[2],
                     yuv, width, u, width / 2, v, width / 2,
                     width, height);
 </s> add     uint8_t *y = yuv ? yuv : nv12toyuv_buffer.data();
    uint8_t *uv = y + width * height;
    libyuv::I420ToNV12(f->data[0], f->linesize[0],
                       f->data[1], f->linesize[1],
                       f->data[2], f->linesize[2],
                       y, width,
                       uv, width / 2,
                       width, height); </s> remove                               int dst_step, int dst_offset, int dst_rows, int dst_cols,
 </s> add                               int dst_row_stride, int dst_offset, int dst_rows, int dst_cols,
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
    "in vec2 vTexCoord;\n"
    "out vec4 colorOut;\n"
    "void main() {\n"
    "  float y = texture(uTextureY, vTexCoord).r;\n"
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
  "  vec2 uv = texture(uTextureUV, vTexCoord).rg - 0.5;\n"
  "  float r = y + 1.402 * uv.y;\n"
  "  float g = y - 0.344 * uv.x - 0.714 * uv.y;\n"
  "  float b = y + 1.772 * uv.x;\n"
    "  colorOut = vec4(r, g, b, 1.0);\n"
    "}\n";
  
  const mat4 device_transform = {{
    1.0,  0.0, 0.0, 0.0,
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 nv12: encoderd avoids a full frame copy (#24519)

* rgb to nv12

* nv12 works (w memcpy)

* correct now

* no copy

* fix nv12 with fast debayer

* reverts of unused stuff

* ui use nv12

* comment out thumbnails for now

* rebase fix

* dm read nv12

* model read nv12

* fix ffmpeg encoder

* thumbnails from nv12

* replay to nv12

* python framereader support nv12

* remove hardcoded frame/buffer sizes

* fix build

* ffmpeg encoder fix buffers

* small cleanup

* reduce power usage test

* fix cpu usage test

* fix snapshot

* fix loggerd test

* bump cereal

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Joost Wooning <jwooning@gmail.com> 
selfdrive/ui/qt/widgets/cameraview.cc