[svn] / trunk / xvidcore / src / image / colorspace.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/image/colorspace.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 605, Sat Oct 19 12:20:33 2002 UTC revision 677, Tue Nov 26 23:44:11 2002 UTC
# Line 6  Line 6 
6   *  Copyright(C) 2002 Peter Ross <pross@xvid.org>   *  Copyright(C) 2002 Peter Ross <pross@xvid.org>
7   *               2002 Michael Militzer <isibaar@xvid.org>   *               2002 Michael Militzer <isibaar@xvid.org>
8   *   *
9   *  This program is an implementation of a part of one or more MPEG-4   *  This file is part of XviD, a free MPEG-4 video encoder/decoder
  *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  
  *  to use this software module in hardware or software products are  
  *  advised that its use may infringe existing patents or copyrights, and  
  *  any such use would be at such party's own risk.  The original  
  *  developer of this software module and his/her company, and subsequent  
  *  editors and their companies, will have no liability for use of this  
  *  software or modifications or derivatives thereof.  
10   *   *
11   *  This program is free software; you can redistribute it and/or modify   *  XviD is free software; you can redistribute it and/or modify it
12   *  it under the terms of the GNU General Public License as published by   *  under the terms of the GNU General Public License as published by
13   *  the Free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
14   *  (at your option) any later version.   *  (at your option) any later version.
15   *   *
# Line 29  Line 22 
22   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
23   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
24   *   *
25     *  Under section 8 of the GNU General Public License, the copyright
26     *  holders of XVID explicitly forbid distribution in the following
27     *  countries:
28     *
29     *    - Japan
30     *    - United States of America
31     *
32     *  Linking XviD statically or dynamically with other modules is making a
33     *  combined work based on XviD.  Thus, the terms and conditions of the
34     *  GNU General Public License cover the whole combination.
35     *
36     *  As a special exception, the copyright holders of XviD give you
37     *  permission to link XviD with independent modules that communicate with
38     *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
39     *  license terms of these independent modules, and to copy and distribute
40     *  the resulting combined work under terms of your choice, provided that
41     *  every copy of the combined work is accompanied by a complete copy of
42     *  the source code of XviD (the version of XviD used to produce the
43     *  combined work), being distributed under the terms of the GNU General
44     *  Public License plus this exception.  An independent module is a module
45     *  which is not derived from or based on XviD.
46     *
47     *  Note that people who make modified versions of XviD are not obligated
48     *  to grant this special exception for their modified versions; it is
49     *  their choice whether to do so.  The GNU General Public License gives
50     *  permission to release a modified version without this exception; this
51     *  exception also makes it possible to release a modified version which
52     *  carries forward this exception.
53     *
54     * $Id: colorspace.c,v 1.7 2002-11-26 23:44:10 edgomez Exp $
55     *
56   ****************************************************************************/   ****************************************************************************/
57    
58  #include <string.h>                             // memcpy  #include <string.h>                             /* memcpy */
59    
60  #include "colorspace.h"  #include "colorspace.h"
61  #include "../divx4.h"                   // DEC_PICTURE  #include "../divx4.h"                   /* DEC_PICTURE */
62    
63  // function pointers  /* function pointers */
64    
65  /* input */  /* input */
66  color_inputFuncPtr rgb555_to_yv12;  color_inputFuncPtr rgb555_to_yv12;
# Line 118  Line 142 
142    
143    
144          for (y = height / 2; y; y--) {          for (y = height / 2; y; y--) {
145                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
146                  for (x = 0; x < (uint32_t) width; x += 2) {                  for (x = 0; x < (uint32_t) width; x += 2) {
147                          int rgb, r, g, b, r4, g4, b4;                          int rgb, r, g, b, r4, g4, b4;
148    
# Line 203  Line 227 
227    
228    
229          for (y = height / 2; y; y--) {          for (y = height / 2; y; y--) {
230                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
231                  for (x = 0; x < (uint32_t) width; x += 2) {                  for (x = 0; x < (uint32_t) width; x += 2) {
232                          int rgb, r, g, b, r4, g4, b4;                          int rgb, r, g, b, r4, g4, b4;
233    
# Line 475  Line 499 
499    
500                  for (x = width >> 1; x; x--) {                  for (x = width >> 1; x; x--) {
501                          *y_out++ = *src++;                          *y_out++ = *src++;
502                          //*u_out++ = *src++;                          /**u_out++ = *src++; */
503                          *u_out++ = (*(src + width2) + *src) >> 1;                          *u_out++ = (*(src + width2) + *src) >> 1;
504                          src++;                          src++;
505                          *y_out++ = *src++;                          *y_out++ = *src++;
506                          //*v_out++ = *src++;                          /**v_out++ = *src++; */
507                          *v_out++ = (*(src + width2) + *src) >> 1;                          *v_out++ = (*(src + width2) + *src) >> 1;
508                          src++;                          src++;
509    
# Line 527  Line 551 
551    
552                  for (x = width >> 1; x; x--) {                  for (x = width >> 1; x; x--) {
553                          *u_out++ = *src++;                          *u_out++ = *src++;
554                          // *u_out++ = (*(src+width2) + *src++) >> 1;                          /* *u_out++ = (*(src+width2) + *src++) >> 1; */
555                          *y_out++ = *src++;                          *y_out++ = *src++;
556                          //*v_out++ = *src++;                          /**v_out++ = *src++; */
557                          *v_out++ = (*(src + width2) + *src) >> 1;                          *v_out++ = (*(src + width2) + *src) >> 1;
558                          src++;                          src++;
559                          *y_out++ = *src++;                          *y_out++ = *src++;
# Line 628  Line 652 
652                  r = g = b = 0;                  r = g = b = 0;
653                  r2 = g2 = b2 = 0;                  r2 = g2 = b2 = 0;
654    
655                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
656                  for (x = 0; x < (uint32_t) width / 2; x++) {                  for (x = 0; x < (uint32_t) width / 2; x++) {
657                          int u, v;                          int u, v;
658                          int b_u, g_uv, r_v, rgb_y;                          int b_u, g_uv, r_v, rgb_y;
# Line 710  Line 734 
734          uint8_t *y_src2 = y_src + y_stride;          uint8_t *y_src2 = y_src + y_stride;
735          uint32_t x, y;          uint32_t x, y;
736    
737          if (height < 0) {                       // flip image?          if (height < 0) {                       /* flip image? */
738                  height = -height;                  height = -height;
739                  y_src += (height - 1) * y_stride;                  y_src += (height - 1) * y_stride;
740                  y_src2 = y_src - y_stride;                  y_src2 = y_src - y_stride;
# Line 727  Line 751 
751                  r = g = b = 0;                  r = g = b = 0;
752                  r2 = g2 = b2 = 0;                  r2 = g2 = b2 = 0;
753    
754                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
755                  for (x = 0; x < (uint32_t) width / 2; x++) {                  for (x = 0; x < (uint32_t) width / 2; x++) {
756                          int u, v;                          int u, v;
757                          int b_u, g_uv, r_v, rgb_y;                          int b_u, g_uv, r_v, rgb_y;
# Line 804  Line 828 
828          uint8_t *y_src2 = y_src + y_stride;          uint8_t *y_src2 = y_src + y_stride;
829          uint32_t x, y;          uint32_t x, y;
830    
831          if (height < 0) {                       // flip image?          if (height < 0) {                       /* flip image? */
832                  height = -height;                  height = -height;
833                  y_src += (height - 1) * y_stride;                  y_src += (height - 1) * y_stride;
834                  y_src2 = y_src - y_stride;                  y_src2 = y_src - y_stride;
# Line 815  Line 839 
839          }          }
840    
841          for (y = height / 2; y; y--) {          for (y = height / 2; y; y--) {
842                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
843                  for (x = 0; x < (uint32_t) width / 2; x++) {                  for (x = 0; x < (uint32_t) width / 2; x++) {
844                          int u, v;                          int u, v;
845                          int b_u, g_uv, r_v, rgb_y;                          int b_u, g_uv, r_v, rgb_y;
# Line 901  Line 925 
925          uint8_t *y_src2 = y_src + y_stride;          uint8_t *y_src2 = y_src + y_stride;
926          uint32_t x, y;          uint32_t x, y;
927    
928          if (height < 0) {                       // flip image?          if (height < 0) {                       /* flip image? */
929                  height = -height;                  height = -height;
930                  y_src += (height - 1) * y_stride;                  y_src += (height - 1) * y_stride;
931                  y_src2 = y_src - y_stride;                  y_src2 = y_src - y_stride;
# Line 912  Line 936 
936          }          }
937    
938          for (y = height / 2; y; y--) {          for (y = height / 2; y; y--) {
939                  // process one 2x2 block per iteration                  /* process one 2x2 block per iteration */
940                  for (x = 0; x < (uint32_t) width / 2; x++) {                  for (x = 0; x < (uint32_t) width / 2; x++) {
941                          int u, v;                          int u, v;
942                          int b_u, g_uv, r_v, rgb_y;                          int b_u, g_uv, r_v, rgb_y;

Legend:
Removed from v.605  
changed lines
  Added in v.677

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4