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

Side by Side Diff: patched-ffmpeg-mt/libavcodec/rectangle.h

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * rectangle filling function 2 * rectangle filling function
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 19 matching lines...) Expand all
30 30
31 #include <assert.h> 31 #include <assert.h>
32 #include "config.h" 32 #include "config.h"
33 #include "libavutil/common.h" 33 #include "libavutil/common.h"
34 #include "dsputil.h" 34 #include "dsputil.h"
35 35
36 /** 36 /**
37 * fill a rectangle. 37 * fill a rectangle.
38 * @param h height of the rectangle, should be a constant 38 * @param h height of the rectangle, should be a constant
39 * @param w width of the rectangle, should be a constant 39 * @param w width of the rectangle, should be a constant
40 * @param size the size of val (1 or 4), should be a constant 40 * @param size the size of val (1, 2 or 4), should be a constant
41 */ 41 */
42 static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ 42 static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){
43 uint8_t *p= (uint8_t*)vp; 43 uint8_t *p= (uint8_t*)vp;
44 assert(size==1 || size==4); 44 assert(size==1 || size==2 || size==4);
45 assert(w<=4); 45 assert(w<=4);
46 46
47 w *= size; 47 w *= size;
48 stride *= size; 48 stride *= size;
49 49
50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0); 50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
51 assert((stride&(w-1))==0); 51 assert((stride&(w-1))==0);
52 if(w==2){ 52 if(w==2){
53 const uint16_t v= size==4 ? val : val*0x0101; 53 const uint16_t v= size==4 ? val : val*0x0101;
54 *(uint16_t*)(p + 0*stride)= v; 54 *(uint16_t*)(p + 0*stride)= v;
55 if(h==1) return; 55 if(h==1) return;
56 *(uint16_t*)(p + 1*stride)= v; 56 *(uint16_t*)(p + 1*stride)= v;
57 if(h==2) return; 57 if(h==2) return;
58 *(uint16_t*)(p + 2*stride)= v; 58 *(uint16_t*)(p + 2*stride)= v;
59 *(uint16_t*)(p + 3*stride)= v; 59 *(uint16_t*)(p + 3*stride)= v;
60 }else if(w==4){ 60 }else if(w==4){
61 const uint32_t v= size==4 ? val : val*0x01010101; 61 const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010 101;
62 *(uint32_t*)(p + 0*stride)= v; 62 *(uint32_t*)(p + 0*stride)= v;
63 if(h==1) return; 63 if(h==1) return;
64 *(uint32_t*)(p + 1*stride)= v; 64 *(uint32_t*)(p + 1*stride)= v;
65 if(h==2) return; 65 if(h==2) return;
66 *(uint32_t*)(p + 2*stride)= v; 66 *(uint32_t*)(p + 2*stride)= v;
67 *(uint32_t*)(p + 3*stride)= v; 67 *(uint32_t*)(p + 3*stride)= v;
68 }else if(w==8){ 68 }else if(w==8){
69 //gcc can't optimize 64bit math on x86_32 69 //gcc can't optimize 64bit math on x86_32
70 #if HAVE_FAST_64BIT 70 #if HAVE_FAST_64BIT
71 const uint64_t v= val*0x0100000001ULL; 71 const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x010000000 1ULL;
72 *(uint64_t*)(p + 0*stride)= v; 72 *(uint64_t*)(p + 0*stride)= v;
73 if(h==1) return; 73 if(h==1) return;
74 *(uint64_t*)(p + 1*stride)= v; 74 *(uint64_t*)(p + 1*stride)= v;
75 if(h==2) return; 75 if(h==2) return;
76 *(uint64_t*)(p + 2*stride)= v; 76 *(uint64_t*)(p + 2*stride)= v;
77 *(uint64_t*)(p + 3*stride)= v; 77 *(uint64_t*)(p + 3*stride)= v;
78 }else if(w==16){ 78 }else if(w==16){
79 const uint64_t v= val*0x0100000001ULL; 79 const uint64_t v= val*0x0100000001ULL;
80 *(uint64_t*)(p + 0+0*stride)= v; 80 *(uint64_t*)(p + 0+0*stride)= v;
81 *(uint64_t*)(p + 8+0*stride)= v; 81 *(uint64_t*)(p + 8+0*stride)= v;
82 *(uint64_t*)(p + 0+1*stride)= v; 82 *(uint64_t*)(p + 0+1*stride)= v;
83 *(uint64_t*)(p + 8+1*stride)= v; 83 *(uint64_t*)(p + 8+1*stride)= v;
84 if(h==2) return; 84 if(h==2) return;
85 *(uint64_t*)(p + 0+2*stride)= v; 85 *(uint64_t*)(p + 0+2*stride)= v;
86 *(uint64_t*)(p + 8+2*stride)= v; 86 *(uint64_t*)(p + 8+2*stride)= v;
87 *(uint64_t*)(p + 0+3*stride)= v; 87 *(uint64_t*)(p + 0+3*stride)= v;
88 *(uint64_t*)(p + 8+3*stride)= v; 88 *(uint64_t*)(p + 8+3*stride)= v;
89 #else 89 #else
90 *(uint32_t*)(p + 0+0*stride)= val; 90 const uint32_t v= size==2 ? val*0x00010001 : val;
91 *(uint32_t*)(p + 4+0*stride)= val; 91 *(uint32_t*)(p + 0+0*stride)= v;
92 *(uint32_t*)(p + 4+0*stride)= v;
92 if(h==1) return; 93 if(h==1) return;
93 *(uint32_t*)(p + 0+1*stride)= val; 94 *(uint32_t*)(p + 0+1*stride)= v;
94 *(uint32_t*)(p + 4+1*stride)= val; 95 *(uint32_t*)(p + 4+1*stride)= v;
95 if(h==2) return; 96 if(h==2) return;
96 *(uint32_t*)(p + 0+2*stride)= val; 97 *(uint32_t*)(p + 0+2*stride)= v;
97 *(uint32_t*)(p + 4+2*stride)= val; 98 *(uint32_t*)(p + 4+2*stride)= v;
98 *(uint32_t*)(p + 0+3*stride)= val; 99 *(uint32_t*)(p + 0+3*stride)= v;
99 *(uint32_t*)(p + 4+3*stride)= val; 100 *(uint32_t*)(p + 4+3*stride)= v;
100 }else if(w==16){ 101 }else if(w==16){
101 *(uint32_t*)(p + 0+0*stride)= val; 102 *(uint32_t*)(p + 0+0*stride)= val;
102 *(uint32_t*)(p + 4+0*stride)= val; 103 *(uint32_t*)(p + 4+0*stride)= val;
103 *(uint32_t*)(p + 8+0*stride)= val; 104 *(uint32_t*)(p + 8+0*stride)= val;
104 *(uint32_t*)(p +12+0*stride)= val; 105 *(uint32_t*)(p +12+0*stride)= val;
105 *(uint32_t*)(p + 0+1*stride)= val; 106 *(uint32_t*)(p + 0+1*stride)= val;
106 *(uint32_t*)(p + 4+1*stride)= val; 107 *(uint32_t*)(p + 4+1*stride)= val;
107 *(uint32_t*)(p + 8+1*stride)= val; 108 *(uint32_t*)(p + 8+1*stride)= val;
108 *(uint32_t*)(p +12+1*stride)= val; 109 *(uint32_t*)(p +12+1*stride)= val;
109 if(h==2) return; 110 if(h==2) return;
110 *(uint32_t*)(p + 0+2*stride)= val; 111 *(uint32_t*)(p + 0+2*stride)= val;
111 *(uint32_t*)(p + 4+2*stride)= val; 112 *(uint32_t*)(p + 4+2*stride)= val;
112 *(uint32_t*)(p + 8+2*stride)= val; 113 *(uint32_t*)(p + 8+2*stride)= val;
113 *(uint32_t*)(p +12+2*stride)= val; 114 *(uint32_t*)(p +12+2*stride)= val;
114 *(uint32_t*)(p + 0+3*stride)= val; 115 *(uint32_t*)(p + 0+3*stride)= val;
115 *(uint32_t*)(p + 4+3*stride)= val; 116 *(uint32_t*)(p + 4+3*stride)= val;
116 *(uint32_t*)(p + 8+3*stride)= val; 117 *(uint32_t*)(p + 8+3*stride)= val;
117 *(uint32_t*)(p +12+3*stride)= val; 118 *(uint32_t*)(p +12+3*stride)= val;
118 #endif 119 #endif
119 }else 120 }else
120 assert(0); 121 assert(0);
121 assert(h==4); 122 assert(h==4);
122 } 123 }
123 124
124 #endif /* AVCODEC_RECTANGLE_H */ 125 #endif /* AVCODEC_RECTANGLE_H */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698