Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: remoting/base/encoder_vp8.cc

Issue 5510003: Fix RGB->YUV conversion: input is BGR instead of RGB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/base/encoder_vp8.h" 5 #include "remoting/base/encoder_vp8.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/callback.h" 8 #include "media/base/callback.h"
9 #include "media/base/media.h" 9 #include "media/base/media.h"
10 #include "remoting/base/capture_data.h" 10 #include "remoting/base/capture_data.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 uint8* in = capture_data->data_planes().data[0]; 120 uint8* in = capture_data->data_planes().data[0];
121 const int in_stride = capture_data->data_planes().strides[0]; 121 const int in_stride = capture_data->data_planes().strides[0];
122 uint8* y_out = yuv_image_.get(); 122 uint8* y_out = yuv_image_.get();
123 uint8* u_out = yuv_image_.get() + plane_size; 123 uint8* u_out = yuv_image_.get() + plane_size;
124 uint8* v_out = yuv_image_.get() + plane_size + plane_size / 4; 124 uint8* v_out = yuv_image_.get() + plane_size + plane_size / 4;
125 const int out_stride = image_->stride[0]; 125 const int out_stride = image_->stride[0];
126 for (int i = 0; i < capture_data->height(); ++i) { 126 for (int i = 0; i < capture_data->height(); ++i) {
127 for (int j = 0; j < capture_data->width(); ++j) { 127 for (int j = 0; j < capture_data->width(); ++j) {
128 // Since the input pixel format is RGB32, there are 4 bytes per pixel. 128 // Since the input pixel format is RGB32, there are 4 bytes per pixel.
129 uint8* pixel = in + 4 * j; 129 uint8* pixel = in + 4 * j;
130 y_out[j] = clip_byte(((pixel[0] * 66 + pixel[1] * 129 + 130 y_out[j] = clip_byte(((pixel[2] * 66 + pixel[1] * 129 +
131 pixel[2] * 25 + 128) >> 8) + 16); 131 pixel[0] * 25 + 128) >> 8) + 16);
132 if (i % 2 == 0 && j % 2 == 0) { 132 if (i % 2 == 0 && j % 2 == 0) {
133 u_out[j / 2] = clip_byte(((pixel[0] * -38 + pixel[1] * -74 + 133 u_out[j / 2] = clip_byte(((pixel[2] * -38 + pixel[1] * -74 +
134 pixel[2] * 112 + 128) >> 8) + 128); 134 pixel[0] * 112 + 128) >> 8) + 128);
135 v_out[j / 2] = clip_byte(((pixel[0] * 112 + pixel[1] * -94 + 135 v_out[j / 2] = clip_byte(((pixel[2] * 112 + pixel[1] * -94 +
136 pixel[2] * -18 + 128) >> 8) + 128); 136 pixel[1] * -18 + 128) >> 8) + 128);
137 } 137 }
138 } 138 }
139 in += in_stride; 139 in += in_stride;
140 y_out += out_stride; 140 y_out += out_stride;
141 if (i % 2 == 0) { 141 if (i % 2 == 0) {
142 u_out += out_stride / 2; 142 u_out += out_stride / 2;
143 v_out += out_stride / 2; 143 v_out += out_stride / 2;
144 } 144 }
145 } 145 }
146 return true; 146 return true;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 message->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); 199 message->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8);
200 message->set_flags(VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET); 200 message->set_flags(VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET);
201 201
202 data_available_callback->Run(message); 202 data_available_callback->Run(message);
203 delete data_available_callback; 203 delete data_available_callback;
204 } 204 }
205 205
206 } // namespace remoting 206 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698