• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "media/base/simd/filter_yuv.h"
6 
7 namespace media {
8 
FilterYUVRows_C(uint8 * ybuf,const uint8 * y0_ptr,const uint8 * y1_ptr,int source_width,int source_y_fraction)9 void FilterYUVRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr,
10                      int source_width, int source_y_fraction) {
11   int y1_fraction = source_y_fraction;
12   int y0_fraction = 256 - y1_fraction;
13   uint8* end = ybuf + source_width;
14   uint8* rounded_end = ybuf + (source_width & ~7);
15 
16   while (ybuf < rounded_end) {
17     ybuf[0] = (y0_ptr[0] * y0_fraction + y1_ptr[0] * y1_fraction) >> 8;
18     ybuf[1] = (y0_ptr[1] * y0_fraction + y1_ptr[1] * y1_fraction) >> 8;
19     ybuf[2] = (y0_ptr[2] * y0_fraction + y1_ptr[2] * y1_fraction) >> 8;
20     ybuf[3] = (y0_ptr[3] * y0_fraction + y1_ptr[3] * y1_fraction) >> 8;
21     ybuf[4] = (y0_ptr[4] * y0_fraction + y1_ptr[4] * y1_fraction) >> 8;
22     ybuf[5] = (y0_ptr[5] * y0_fraction + y1_ptr[5] * y1_fraction) >> 8;
23     ybuf[6] = (y0_ptr[6] * y0_fraction + y1_ptr[6] * y1_fraction) >> 8;
24     ybuf[7] = (y0_ptr[7] * y0_fraction + y1_ptr[7] * y1_fraction) >> 8;
25     y0_ptr += 8;
26     y1_ptr += 8;
27     ybuf += 8;
28   }
29 
30   while (ybuf < end) {
31     ybuf[0] = (y0_ptr[0] * y0_fraction + y1_ptr[0] * y1_fraction) >> 8;
32     ++ybuf;
33     ++y0_ptr;
34     ++y1_ptr;
35   }
36 }
37 
38 }  // namespace media
39