MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / fill_rectangle

Function fill_rectangle

libavcodec/rectangle.h:42–123  ·  view source on GitHub ↗

* fill a rectangle. * @param h height of the rectangle, should be a constant * @param w width of the rectangle, should be a constant * @param size the size of val (1, 2 or 4), should be a constant */

Source from the content-addressed store, hash-verified

40 * @param size the size of val (1, 2 or 4), should be a constant
41 */
42static 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;
44 assert(size==1 || size==2 || size==4);
45 assert(w<=4);
46
47 w *= size;
48 stride *= size;
49
50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
51 assert((stride&(w-1))==0);
52 if(w==2){
53 const uint16_t v= size==4 ? val : val*0x0101;
54 *(uint16_t*)(p + 0*stride)= v;
55 if(h==1) return;
56 *(uint16_t*)(p + 1*stride)= v;
57 if(h==2) return;
58 *(uint16_t*)(p + 2*stride)= v;
59 *(uint16_t*)(p + 3*stride)= v;
60 }else if(w==4){
61 const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101;
62 *(uint32_t*)(p + 0*stride)= v;
63 if(h==1) return;
64 *(uint32_t*)(p + 1*stride)= v;
65 if(h==2) return;
66 *(uint32_t*)(p + 2*stride)= v;
67 *(uint32_t*)(p + 3*stride)= v;
68 }else if(w==8){
69 //gcc can't optimize 64bit math on x86_32
70#if HAVE_FAST_64BIT
71 const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL;
72 *(uint64_t*)(p + 0*stride)= v;
73 if(h==1) return;
74 *(uint64_t*)(p + 1*stride)= v;
75 if(h==2) return;
76 *(uint64_t*)(p + 2*stride)= v;
77 *(uint64_t*)(p + 3*stride)= v;
78 }else if(w==16){
79 const uint64_t v= val*0x0100000001ULL;
80 *(uint64_t*)(p + 0+0*stride)= v;
81 *(uint64_t*)(p + 8+0*stride)= v;
82 *(uint64_t*)(p + 0+1*stride)= v;
83 *(uint64_t*)(p + 8+1*stride)= v;
84 if(h==2) return;
85 *(uint64_t*)(p + 0+2*stride)= v;
86 *(uint64_t*)(p + 8+2*stride)= v;
87 *(uint64_t*)(p + 0+3*stride)= v;
88 *(uint64_t*)(p + 8+3*stride)= v;
89#else
90 const uint32_t v= size==2 ? val*0x00010001 : val;
91 *(uint32_t*)(p + 0+0*stride)= v;
92 *(uint32_t*)(p + 4+0*stride)= v;
93 if(h==1) return;
94 *(uint32_t*)(p + 0+1*stride)= v;
95 *(uint32_t*)(p + 4+1*stride)= v;
96 if(h==2) return;
97 *(uint32_t*)(p + 0+2*stride)= v;
98 *(uint32_t*)(p + 4+2*stride)= v;
99 *(uint32_t*)(p + 0+3*stride)= v;

Callers 15

ff_h264_decode_mb_cavlcFunction · 0.70
svq3_mc_dirFunction · 0.70
fill_decode_cachesFunction · 0.70
write_back_motionFunction · 0.70
decode_mb_skipFunction · 0.70
ZERO8x2Function · 0.70
rv34_output_macroblockFunction · 0.70
rv34_decode_mb_headerFunction · 0.70
rv34_decode_macroblockFunction · 0.70
pred_temp_direct_motionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected