sixtappredict_neon.c 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730
  1. /*
  2. * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include <arm_neon.h>
  11. #include <string.h>
  12. #include "./vpx_config.h"
  13. #include "./vp8_rtcd.h"
  14. #include "vpx_dsp/arm/mem_neon.h"
  15. #include "vpx_ports/mem.h"
  16. static const int8_t vp8_sub_pel_filters[8][8] = {
  17. { 0, 0, 128, 0, 0, 0, 0, 0 }, /* note that 1/8 pel positionyys are */
  18. { 0, -6, 123, 12, -1, 0, 0, 0 }, /* just as per alpha -0.5 bicubic */
  19. { 2, -11, 108, 36, -8, 1, 0, 0 }, /* New 1/4 pel 6 tap filter */
  20. { 0, -9, 93, 50, -6, 0, 0, 0 },
  21. { 3, -16, 77, 77, -16, 3, 0, 0 }, /* New 1/2 pel 6 tap filter */
  22. { 0, -6, 50, 93, -9, 0, 0, 0 },
  23. { 1, -8, 36, 108, -11, 2, 0, 0 }, /* New 1/4 pel 6 tap filter */
  24. { 0, -1, 12, 123, -6, 0, 0, 0 },
  25. };
  26. // This table is derived from vp8/common/filter.c:vp8_sub_pel_filters.
  27. // Apply abs() to all the values. Elements 0, 2, 3, and 5 are always positive.
  28. // Elements 1 and 4 are either 0 or negative. The code accounts for this with
  29. // multiply/accumulates which either add or subtract as needed. The other
  30. // functions will be updated to use this table later.
  31. // It is also expanded to 8 elements to allow loading into 64 bit neon
  32. // registers.
  33. static const uint8_t abs_filters[8][8] = {
  34. { 0, 0, 128, 0, 0, 0, 0, 0 }, { 0, 6, 123, 12, 1, 0, 0, 0 },
  35. { 2, 11, 108, 36, 8, 1, 0, 0 }, { 0, 9, 93, 50, 6, 0, 0, 0 },
  36. { 3, 16, 77, 77, 16, 3, 0, 0 }, { 0, 6, 50, 93, 9, 0, 0, 0 },
  37. { 1, 8, 36, 108, 11, 2, 0, 0 }, { 0, 1, 12, 123, 6, 0, 0, 0 },
  38. };
  39. static INLINE uint8x8_t load_and_shift(const unsigned char *a) {
  40. return vreinterpret_u8_u64(vshl_n_u64(vreinterpret_u64_u8(vld1_u8(a)), 32));
  41. }
  42. static INLINE void filter_add_accumulate(const uint8x16_t a, const uint8x16_t b,
  43. const uint8x8_t filter, uint16x8_t *c,
  44. uint16x8_t *d) {
  45. const uint32x2x2_t a_shuf = vzip_u32(vreinterpret_u32_u8(vget_low_u8(a)),
  46. vreinterpret_u32_u8(vget_high_u8(a)));
  47. const uint32x2x2_t b_shuf = vzip_u32(vreinterpret_u32_u8(vget_low_u8(b)),
  48. vreinterpret_u32_u8(vget_high_u8(b)));
  49. *c = vmlal_u8(*c, vreinterpret_u8_u32(a_shuf.val[0]), filter);
  50. *d = vmlal_u8(*d, vreinterpret_u8_u32(b_shuf.val[0]), filter);
  51. }
  52. static INLINE void filter_sub_accumulate(const uint8x16_t a, const uint8x16_t b,
  53. const uint8x8_t filter, uint16x8_t *c,
  54. uint16x8_t *d) {
  55. const uint32x2x2_t a_shuf = vzip_u32(vreinterpret_u32_u8(vget_low_u8(a)),
  56. vreinterpret_u32_u8(vget_high_u8(a)));
  57. const uint32x2x2_t b_shuf = vzip_u32(vreinterpret_u32_u8(vget_low_u8(b)),
  58. vreinterpret_u32_u8(vget_high_u8(b)));
  59. *c = vmlsl_u8(*c, vreinterpret_u8_u32(a_shuf.val[0]), filter);
  60. *d = vmlsl_u8(*d, vreinterpret_u8_u32(b_shuf.val[0]), filter);
  61. }
  62. static INLINE void yonly4x4(const unsigned char *src, int src_stride,
  63. int filter_offset, unsigned char *dst,
  64. int dst_stride) {
  65. uint8x8_t a0, a1, a2, a3, a4, a5, a6, a7, a8;
  66. uint8x8_t b0, b1, b2, b3, b4, b5, b6, b7, b8;
  67. uint16x8_t c0, c1, c2, c3;
  68. int16x8_t d0, d1;
  69. uint8x8_t e0, e1;
  70. const uint8x8_t filter = vld1_u8(abs_filters[filter_offset]);
  71. const uint8x8_t filter0 = vdup_lane_u8(filter, 0);
  72. const uint8x8_t filter1 = vdup_lane_u8(filter, 1);
  73. const uint8x8_t filter2 = vdup_lane_u8(filter, 2);
  74. const uint8x8_t filter3 = vdup_lane_u8(filter, 3);
  75. const uint8x8_t filter4 = vdup_lane_u8(filter, 4);
  76. const uint8x8_t filter5 = vdup_lane_u8(filter, 5);
  77. src -= src_stride * 2;
  78. // Shift the even rows to allow using 'vext' to combine the vectors. armv8
  79. // has vcopy_lane which would be interesting. This started as just a
  80. // horrible workaround for clang adding alignment hints to 32bit loads:
  81. // https://llvm.org/bugs/show_bug.cgi?id=24421
  82. // But it turns out it almost identical to casting the loads.
  83. a0 = load_and_shift(src);
  84. src += src_stride;
  85. a1 = vld1_u8(src);
  86. src += src_stride;
  87. a2 = load_and_shift(src);
  88. src += src_stride;
  89. a3 = vld1_u8(src);
  90. src += src_stride;
  91. a4 = load_and_shift(src);
  92. src += src_stride;
  93. a5 = vld1_u8(src);
  94. src += src_stride;
  95. a6 = load_and_shift(src);
  96. src += src_stride;
  97. a7 = vld1_u8(src);
  98. src += src_stride;
  99. a8 = vld1_u8(src);
  100. // Combine the rows so we can operate on 8 at a time.
  101. b0 = vext_u8(a0, a1, 4);
  102. b2 = vext_u8(a2, a3, 4);
  103. b4 = vext_u8(a4, a5, 4);
  104. b6 = vext_u8(a6, a7, 4);
  105. b8 = a8;
  106. // To keep with the 8-at-a-time theme, combine *alternate* rows. This
  107. // allows combining the odd rows with the even.
  108. b1 = vext_u8(b0, b2, 4);
  109. b3 = vext_u8(b2, b4, 4);
  110. b5 = vext_u8(b4, b6, 4);
  111. b7 = vext_u8(b6, b8, 4);
  112. // Multiply and expand to 16 bits.
  113. c0 = vmull_u8(b0, filter0);
  114. c1 = vmull_u8(b2, filter0);
  115. c2 = vmull_u8(b5, filter5);
  116. c3 = vmull_u8(b7, filter5);
  117. // Multiply, subtract and accumulate for filters 1 and 4 (the negative
  118. // ones).
  119. c0 = vmlsl_u8(c0, b4, filter4);
  120. c1 = vmlsl_u8(c1, b6, filter4);
  121. c2 = vmlsl_u8(c2, b1, filter1);
  122. c3 = vmlsl_u8(c3, b3, filter1);
  123. // Add more positive ones. vmlal should really return a signed type.
  124. // It's doing signed math internally, as evidenced by the fact we can do
  125. // subtractions followed by more additions. Ideally we could use
  126. // vqmlal/sl but that instruction doesn't exist. Might be able to
  127. // shoehorn vqdmlal/vqdmlsl in here but it would take some effort.
  128. c0 = vmlal_u8(c0, b2, filter2);
  129. c1 = vmlal_u8(c1, b4, filter2);
  130. c2 = vmlal_u8(c2, b3, filter3);
  131. c3 = vmlal_u8(c3, b5, filter3);
  132. // Use signed saturation math because vmlsl may have left some negative
  133. // numbers in there.
  134. d0 = vqaddq_s16(vreinterpretq_s16_u16(c2), vreinterpretq_s16_u16(c0));
  135. d1 = vqaddq_s16(vreinterpretq_s16_u16(c3), vreinterpretq_s16_u16(c1));
  136. // Use signed again because numbers like -200 need to be saturated to 0.
  137. e0 = vqrshrun_n_s16(d0, 7);
  138. e1 = vqrshrun_n_s16(d1, 7);
  139. store_unaligned_u8q(dst, dst_stride, vcombine_u8(e0, e1));
  140. }
  141. void vp8_sixtap_predict4x4_neon(unsigned char *src_ptr, int src_pixels_per_line,
  142. int xoffset, int yoffset,
  143. unsigned char *dst_ptr, int dst_pitch) {
  144. uint8x16_t s0, s1, s2, s3, s4;
  145. uint64x2_t s01, s23;
  146. // Variables to hold src[] elements for the given filter[]
  147. uint8x8_t s0_f5, s1_f5, s2_f5, s3_f5, s4_f5;
  148. uint8x8_t s4_f1, s4_f2, s4_f3, s4_f4;
  149. uint8x16_t s01_f0, s23_f0;
  150. uint64x2_t s01_f3, s23_f3;
  151. uint32x2x2_t s01_f3_q, s23_f3_q, s01_f5_q, s23_f5_q;
  152. // Accumulator variables.
  153. uint16x8_t d0123, d4567, d89;
  154. uint16x8_t d0123_a, d4567_a, d89_a;
  155. int16x8_t e0123, e4567, e89;
  156. // Second pass intermediates.
  157. uint8x8_t b0, b1, b2, b3, b4, b5, b6, b7, b8;
  158. uint16x8_t c0, c1, c2, c3;
  159. int16x8_t d0, d1;
  160. uint8x8_t e0, e1;
  161. uint8x8_t filter, filter0, filter1, filter2, filter3, filter4, filter5;
  162. if (xoffset == 0) { // Second pass only.
  163. yonly4x4(src_ptr, src_pixels_per_line, yoffset, dst_ptr, dst_pitch);
  164. return;
  165. }
  166. if (yoffset == 0) { // First pass only.
  167. src_ptr -= 2;
  168. } else { // Add context for the second pass. 2 extra lines on top.
  169. src_ptr -= 2 + (src_pixels_per_line * 2);
  170. }
  171. filter = vld1_u8(abs_filters[xoffset]);
  172. filter0 = vdup_lane_u8(filter, 0);
  173. filter1 = vdup_lane_u8(filter, 1);
  174. filter2 = vdup_lane_u8(filter, 2);
  175. filter3 = vdup_lane_u8(filter, 3);
  176. filter4 = vdup_lane_u8(filter, 4);
  177. filter5 = vdup_lane_u8(filter, 5);
  178. // 2 bytes of context, 4 bytes of src values, 3 bytes of context, 7 bytes of
  179. // garbage. So much effort for that last single bit.
  180. // The low values of each pair are for filter0.
  181. s0 = vld1q_u8(src_ptr);
  182. src_ptr += src_pixels_per_line;
  183. s1 = vld1q_u8(src_ptr);
  184. src_ptr += src_pixels_per_line;
  185. s2 = vld1q_u8(src_ptr);
  186. src_ptr += src_pixels_per_line;
  187. s3 = vld1q_u8(src_ptr);
  188. src_ptr += src_pixels_per_line;
  189. // Shift to extract values for filter[5]
  190. // If src[] is 0, this puts:
  191. // 3 4 5 6 7 8 9 10 in s0_f5
  192. // Can't use vshr.u64 because it crosses the double word boundary.
  193. s0_f5 = vext_u8(vget_low_u8(s0), vget_high_u8(s0), 5);
  194. s1_f5 = vext_u8(vget_low_u8(s1), vget_high_u8(s1), 5);
  195. s2_f5 = vext_u8(vget_low_u8(s2), vget_high_u8(s2), 5);
  196. s3_f5 = vext_u8(vget_low_u8(s3), vget_high_u8(s3), 5);
  197. s01_f0 = vcombine_u8(vget_low_u8(s0), vget_low_u8(s1));
  198. s23_f0 = vcombine_u8(vget_low_u8(s2), vget_low_u8(s3));
  199. s01_f5_q = vzip_u32(vreinterpret_u32_u8(s0_f5), vreinterpret_u32_u8(s1_f5));
  200. s23_f5_q = vzip_u32(vreinterpret_u32_u8(s2_f5), vreinterpret_u32_u8(s3_f5));
  201. d0123 = vmull_u8(vreinterpret_u8_u32(s01_f5_q.val[0]), filter5);
  202. d4567 = vmull_u8(vreinterpret_u8_u32(s23_f5_q.val[0]), filter5);
  203. // Keep original src data as 64 bits to simplify shifting and extracting.
  204. s01 = vreinterpretq_u64_u8(s01_f0);
  205. s23 = vreinterpretq_u64_u8(s23_f0);
  206. // 3 4 5 6 * filter0
  207. filter_add_accumulate(s01_f0, s23_f0, filter0, &d0123, &d4567);
  208. // Shift over one to use -1, 0, 1, 2 for filter1
  209. // -1 0 1 2 * filter1
  210. filter_sub_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 8)),
  211. vreinterpretq_u8_u64(vshrq_n_u64(s23, 8)), filter1,
  212. &d0123, &d4567);
  213. // 2 3 4 5 * filter4
  214. filter_sub_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 32)),
  215. vreinterpretq_u8_u64(vshrq_n_u64(s23, 32)), filter4,
  216. &d0123, &d4567);
  217. // 0 1 2 3 * filter2
  218. filter_add_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 16)),
  219. vreinterpretq_u8_u64(vshrq_n_u64(s23, 16)), filter2,
  220. &d0123, &d4567);
  221. // 1 2 3 4 * filter3
  222. s01_f3 = vshrq_n_u64(s01, 24);
  223. s23_f3 = vshrq_n_u64(s23, 24);
  224. s01_f3_q = vzip_u32(vreinterpret_u32_u64(vget_low_u64(s01_f3)),
  225. vreinterpret_u32_u64(vget_high_u64(s01_f3)));
  226. s23_f3_q = vzip_u32(vreinterpret_u32_u64(vget_low_u64(s23_f3)),
  227. vreinterpret_u32_u64(vget_high_u64(s23_f3)));
  228. // Accumulate into different registers so it can use saturated addition.
  229. d0123_a = vmull_u8(vreinterpret_u8_u32(s01_f3_q.val[0]), filter3);
  230. d4567_a = vmull_u8(vreinterpret_u8_u32(s23_f3_q.val[0]), filter3);
  231. e0123 =
  232. vqaddq_s16(vreinterpretq_s16_u16(d0123), vreinterpretq_s16_u16(d0123_a));
  233. e4567 =
  234. vqaddq_s16(vreinterpretq_s16_u16(d4567), vreinterpretq_s16_u16(d4567_a));
  235. // Shift and narrow.
  236. b0 = vqrshrun_n_s16(e0123, 7);
  237. b2 = vqrshrun_n_s16(e4567, 7);
  238. if (yoffset == 0) { // firstpass_filter4x4_only
  239. store_unaligned_u8q(dst_ptr, dst_pitch, vcombine_u8(b0, b2));
  240. return;
  241. }
  242. // Load additional context when doing both filters.
  243. s0 = vld1q_u8(src_ptr);
  244. src_ptr += src_pixels_per_line;
  245. s1 = vld1q_u8(src_ptr);
  246. src_ptr += src_pixels_per_line;
  247. s2 = vld1q_u8(src_ptr);
  248. src_ptr += src_pixels_per_line;
  249. s3 = vld1q_u8(src_ptr);
  250. src_ptr += src_pixels_per_line;
  251. s4 = vld1q_u8(src_ptr);
  252. s0_f5 = vext_u8(vget_low_u8(s0), vget_high_u8(s0), 5);
  253. s1_f5 = vext_u8(vget_low_u8(s1), vget_high_u8(s1), 5);
  254. s2_f5 = vext_u8(vget_low_u8(s2), vget_high_u8(s2), 5);
  255. s3_f5 = vext_u8(vget_low_u8(s3), vget_high_u8(s3), 5);
  256. s4_f5 = vext_u8(vget_low_u8(s4), vget_high_u8(s4), 5);
  257. // 3 4 5 6 * filter0
  258. s01_f0 = vcombine_u8(vget_low_u8(s0), vget_low_u8(s1));
  259. s23_f0 = vcombine_u8(vget_low_u8(s2), vget_low_u8(s3));
  260. s01_f5_q = vzip_u32(vreinterpret_u32_u8(s0_f5), vreinterpret_u32_u8(s1_f5));
  261. s23_f5_q = vzip_u32(vreinterpret_u32_u8(s2_f5), vreinterpret_u32_u8(s3_f5));
  262. // But this time instead of 16 pixels to filter, there are 20. So an extra
  263. // run with a doubleword register.
  264. d0123 = vmull_u8(vreinterpret_u8_u32(s01_f5_q.val[0]), filter5);
  265. d4567 = vmull_u8(vreinterpret_u8_u32(s23_f5_q.val[0]), filter5);
  266. d89 = vmull_u8(s4_f5, filter5);
  267. // Save a copy as u64 for shifting.
  268. s01 = vreinterpretq_u64_u8(s01_f0);
  269. s23 = vreinterpretq_u64_u8(s23_f0);
  270. filter_add_accumulate(s01_f0, s23_f0, filter0, &d0123, &d4567);
  271. d89 = vmlal_u8(d89, vget_low_u8(s4), filter0);
  272. filter_sub_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 8)),
  273. vreinterpretq_u8_u64(vshrq_n_u64(s23, 8)), filter1,
  274. &d0123, &d4567);
  275. s4_f1 = vext_u8(vget_low_u8(s4), vget_high_u8(s4), 1);
  276. d89 = vmlsl_u8(d89, s4_f1, filter1);
  277. filter_sub_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 32)),
  278. vreinterpretq_u8_u64(vshrq_n_u64(s23, 32)), filter4,
  279. &d0123, &d4567);
  280. s4_f4 = vext_u8(vget_low_u8(s4), vget_high_u8(s4), 4);
  281. d89 = vmlsl_u8(d89, s4_f4, filter4);
  282. filter_add_accumulate(vreinterpretq_u8_u64(vshrq_n_u64(s01, 16)),
  283. vreinterpretq_u8_u64(vshrq_n_u64(s23, 16)), filter2,
  284. &d0123, &d4567);
  285. s4_f2 = vext_u8(vget_low_u8(s4), vget_high_u8(s4), 2);
  286. d89 = vmlal_u8(d89, s4_f2, filter2);
  287. s01_f3 = vshrq_n_u64(s01, 24);
  288. s23_f3 = vshrq_n_u64(s23, 24);
  289. s01_f3_q = vzip_u32(vreinterpret_u32_u64(vget_low_u64(s01_f3)),
  290. vreinterpret_u32_u64(vget_high_u64(s01_f3)));
  291. s23_f3_q = vzip_u32(vreinterpret_u32_u64(vget_low_u64(s23_f3)),
  292. vreinterpret_u32_u64(vget_high_u64(s23_f3)));
  293. s4_f3 = vext_u8(vget_low_u8(s4), vget_high_u8(s4), 3);
  294. d0123_a = vmull_u8(vreinterpret_u8_u32(s01_f3_q.val[0]), filter3);
  295. d4567_a = vmull_u8(vreinterpret_u8_u32(s23_f3_q.val[0]), filter3);
  296. d89_a = vmull_u8(s4_f3, filter3);
  297. e0123 =
  298. vqaddq_s16(vreinterpretq_s16_u16(d0123), vreinterpretq_s16_u16(d0123_a));
  299. e4567 =
  300. vqaddq_s16(vreinterpretq_s16_u16(d4567), vreinterpretq_s16_u16(d4567_a));
  301. e89 = vqaddq_s16(vreinterpretq_s16_u16(d89), vreinterpretq_s16_u16(d89_a));
  302. b4 = vqrshrun_n_s16(e0123, 7);
  303. b6 = vqrshrun_n_s16(e4567, 7);
  304. b8 = vqrshrun_n_s16(e89, 7);
  305. // Second pass: 4x4
  306. filter = vld1_u8(abs_filters[yoffset]);
  307. filter0 = vdup_lane_u8(filter, 0);
  308. filter1 = vdup_lane_u8(filter, 1);
  309. filter2 = vdup_lane_u8(filter, 2);
  310. filter3 = vdup_lane_u8(filter, 3);
  311. filter4 = vdup_lane_u8(filter, 4);
  312. filter5 = vdup_lane_u8(filter, 5);
  313. b1 = vext_u8(b0, b2, 4);
  314. b3 = vext_u8(b2, b4, 4);
  315. b5 = vext_u8(b4, b6, 4);
  316. b7 = vext_u8(b6, b8, 4);
  317. c0 = vmull_u8(b0, filter0);
  318. c1 = vmull_u8(b2, filter0);
  319. c2 = vmull_u8(b5, filter5);
  320. c3 = vmull_u8(b7, filter5);
  321. c0 = vmlsl_u8(c0, b4, filter4);
  322. c1 = vmlsl_u8(c1, b6, filter4);
  323. c2 = vmlsl_u8(c2, b1, filter1);
  324. c3 = vmlsl_u8(c3, b3, filter1);
  325. c0 = vmlal_u8(c0, b2, filter2);
  326. c1 = vmlal_u8(c1, b4, filter2);
  327. c2 = vmlal_u8(c2, b3, filter3);
  328. c3 = vmlal_u8(c3, b5, filter3);
  329. d0 = vqaddq_s16(vreinterpretq_s16_u16(c2), vreinterpretq_s16_u16(c0));
  330. d1 = vqaddq_s16(vreinterpretq_s16_u16(c3), vreinterpretq_s16_u16(c1));
  331. e0 = vqrshrun_n_s16(d0, 7);
  332. e1 = vqrshrun_n_s16(d1, 7);
  333. store_unaligned_u8q(dst_ptr, dst_pitch, vcombine_u8(e0, e1));
  334. }
  335. void vp8_sixtap_predict8x4_neon(unsigned char *src_ptr, int src_pixels_per_line,
  336. int xoffset, int yoffset,
  337. unsigned char *dst_ptr, int dst_pitch) {
  338. unsigned char *src;
  339. uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8, d7u8, d8u8, d9u8;
  340. uint8x8_t d22u8, d23u8, d24u8, d25u8, d26u8;
  341. uint8x8_t d27u8, d28u8, d29u8, d30u8, d31u8;
  342. int8x8_t dtmps8, d0s8, d1s8, d2s8, d3s8, d4s8, d5s8;
  343. uint16x8_t q3u16, q4u16, q5u16, q6u16, q7u16;
  344. uint16x8_t q8u16, q9u16, q10u16, q11u16, q12u16;
  345. int16x8_t q3s16, q4s16, q5s16, q6s16, q7s16;
  346. int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16;
  347. uint8x16_t q3u8, q4u8, q5u8, q6u8, q7u8;
  348. if (xoffset == 0) { // secondpass_filter8x4_only
  349. // load second_pass filter
  350. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  351. d0s8 = vdup_lane_s8(dtmps8, 0);
  352. d1s8 = vdup_lane_s8(dtmps8, 1);
  353. d2s8 = vdup_lane_s8(dtmps8, 2);
  354. d3s8 = vdup_lane_s8(dtmps8, 3);
  355. d4s8 = vdup_lane_s8(dtmps8, 4);
  356. d5s8 = vdup_lane_s8(dtmps8, 5);
  357. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  358. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  359. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  360. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  361. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  362. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  363. // load src data
  364. src = src_ptr - src_pixels_per_line * 2;
  365. d22u8 = vld1_u8(src);
  366. src += src_pixels_per_line;
  367. d23u8 = vld1_u8(src);
  368. src += src_pixels_per_line;
  369. d24u8 = vld1_u8(src);
  370. src += src_pixels_per_line;
  371. d25u8 = vld1_u8(src);
  372. src += src_pixels_per_line;
  373. d26u8 = vld1_u8(src);
  374. src += src_pixels_per_line;
  375. d27u8 = vld1_u8(src);
  376. src += src_pixels_per_line;
  377. d28u8 = vld1_u8(src);
  378. src += src_pixels_per_line;
  379. d29u8 = vld1_u8(src);
  380. src += src_pixels_per_line;
  381. d30u8 = vld1_u8(src);
  382. q3u16 = vmull_u8(d22u8, d0u8);
  383. q4u16 = vmull_u8(d23u8, d0u8);
  384. q5u16 = vmull_u8(d24u8, d0u8);
  385. q6u16 = vmull_u8(d25u8, d0u8);
  386. q3u16 = vmlsl_u8(q3u16, d23u8, d1u8);
  387. q4u16 = vmlsl_u8(q4u16, d24u8, d1u8);
  388. q5u16 = vmlsl_u8(q5u16, d25u8, d1u8);
  389. q6u16 = vmlsl_u8(q6u16, d26u8, d1u8);
  390. q3u16 = vmlsl_u8(q3u16, d26u8, d4u8);
  391. q4u16 = vmlsl_u8(q4u16, d27u8, d4u8);
  392. q5u16 = vmlsl_u8(q5u16, d28u8, d4u8);
  393. q6u16 = vmlsl_u8(q6u16, d29u8, d4u8);
  394. q3u16 = vmlal_u8(q3u16, d24u8, d2u8);
  395. q4u16 = vmlal_u8(q4u16, d25u8, d2u8);
  396. q5u16 = vmlal_u8(q5u16, d26u8, d2u8);
  397. q6u16 = vmlal_u8(q6u16, d27u8, d2u8);
  398. q3u16 = vmlal_u8(q3u16, d27u8, d5u8);
  399. q4u16 = vmlal_u8(q4u16, d28u8, d5u8);
  400. q5u16 = vmlal_u8(q5u16, d29u8, d5u8);
  401. q6u16 = vmlal_u8(q6u16, d30u8, d5u8);
  402. q7u16 = vmull_u8(d25u8, d3u8);
  403. q8u16 = vmull_u8(d26u8, d3u8);
  404. q9u16 = vmull_u8(d27u8, d3u8);
  405. q10u16 = vmull_u8(d28u8, d3u8);
  406. q3s16 = vreinterpretq_s16_u16(q3u16);
  407. q4s16 = vreinterpretq_s16_u16(q4u16);
  408. q5s16 = vreinterpretq_s16_u16(q5u16);
  409. q6s16 = vreinterpretq_s16_u16(q6u16);
  410. q7s16 = vreinterpretq_s16_u16(q7u16);
  411. q8s16 = vreinterpretq_s16_u16(q8u16);
  412. q9s16 = vreinterpretq_s16_u16(q9u16);
  413. q10s16 = vreinterpretq_s16_u16(q10u16);
  414. q7s16 = vqaddq_s16(q7s16, q3s16);
  415. q8s16 = vqaddq_s16(q8s16, q4s16);
  416. q9s16 = vqaddq_s16(q9s16, q5s16);
  417. q10s16 = vqaddq_s16(q10s16, q6s16);
  418. d6u8 = vqrshrun_n_s16(q7s16, 7);
  419. d7u8 = vqrshrun_n_s16(q8s16, 7);
  420. d8u8 = vqrshrun_n_s16(q9s16, 7);
  421. d9u8 = vqrshrun_n_s16(q10s16, 7);
  422. vst1_u8(dst_ptr, d6u8);
  423. dst_ptr += dst_pitch;
  424. vst1_u8(dst_ptr, d7u8);
  425. dst_ptr += dst_pitch;
  426. vst1_u8(dst_ptr, d8u8);
  427. dst_ptr += dst_pitch;
  428. vst1_u8(dst_ptr, d9u8);
  429. return;
  430. }
  431. // load first_pass filter
  432. dtmps8 = vld1_s8(vp8_sub_pel_filters[xoffset]);
  433. d0s8 = vdup_lane_s8(dtmps8, 0);
  434. d1s8 = vdup_lane_s8(dtmps8, 1);
  435. d2s8 = vdup_lane_s8(dtmps8, 2);
  436. d3s8 = vdup_lane_s8(dtmps8, 3);
  437. d4s8 = vdup_lane_s8(dtmps8, 4);
  438. d5s8 = vdup_lane_s8(dtmps8, 5);
  439. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  440. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  441. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  442. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  443. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  444. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  445. // First pass: output_height lines x output_width columns (9x4)
  446. if (yoffset == 0) // firstpass_filter4x4_only
  447. src = src_ptr - 2;
  448. else
  449. src = src_ptr - 2 - (src_pixels_per_line * 2);
  450. q3u8 = vld1q_u8(src);
  451. src += src_pixels_per_line;
  452. q4u8 = vld1q_u8(src);
  453. src += src_pixels_per_line;
  454. q5u8 = vld1q_u8(src);
  455. src += src_pixels_per_line;
  456. q6u8 = vld1q_u8(src);
  457. q7u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
  458. q8u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
  459. q9u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
  460. q10u16 = vmull_u8(vget_low_u8(q6u8), d0u8);
  461. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
  462. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
  463. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
  464. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 1);
  465. q7u16 = vmlsl_u8(q7u16, d28u8, d1u8);
  466. q8u16 = vmlsl_u8(q8u16, d29u8, d1u8);
  467. q9u16 = vmlsl_u8(q9u16, d30u8, d1u8);
  468. q10u16 = vmlsl_u8(q10u16, d31u8, d1u8);
  469. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 4);
  470. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 4);
  471. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 4);
  472. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 4);
  473. q7u16 = vmlsl_u8(q7u16, d28u8, d4u8);
  474. q8u16 = vmlsl_u8(q8u16, d29u8, d4u8);
  475. q9u16 = vmlsl_u8(q9u16, d30u8, d4u8);
  476. q10u16 = vmlsl_u8(q10u16, d31u8, d4u8);
  477. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 2);
  478. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 2);
  479. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 2);
  480. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 2);
  481. q7u16 = vmlal_u8(q7u16, d28u8, d2u8);
  482. q8u16 = vmlal_u8(q8u16, d29u8, d2u8);
  483. q9u16 = vmlal_u8(q9u16, d30u8, d2u8);
  484. q10u16 = vmlal_u8(q10u16, d31u8, d2u8);
  485. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 5);
  486. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 5);
  487. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 5);
  488. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 5);
  489. q7u16 = vmlal_u8(q7u16, d28u8, d5u8);
  490. q8u16 = vmlal_u8(q8u16, d29u8, d5u8);
  491. q9u16 = vmlal_u8(q9u16, d30u8, d5u8);
  492. q10u16 = vmlal_u8(q10u16, d31u8, d5u8);
  493. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 3);
  494. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 3);
  495. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 3);
  496. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 3);
  497. q3u16 = vmull_u8(d28u8, d3u8);
  498. q4u16 = vmull_u8(d29u8, d3u8);
  499. q5u16 = vmull_u8(d30u8, d3u8);
  500. q6u16 = vmull_u8(d31u8, d3u8);
  501. q3s16 = vreinterpretq_s16_u16(q3u16);
  502. q4s16 = vreinterpretq_s16_u16(q4u16);
  503. q5s16 = vreinterpretq_s16_u16(q5u16);
  504. q6s16 = vreinterpretq_s16_u16(q6u16);
  505. q7s16 = vreinterpretq_s16_u16(q7u16);
  506. q8s16 = vreinterpretq_s16_u16(q8u16);
  507. q9s16 = vreinterpretq_s16_u16(q9u16);
  508. q10s16 = vreinterpretq_s16_u16(q10u16);
  509. q7s16 = vqaddq_s16(q7s16, q3s16);
  510. q8s16 = vqaddq_s16(q8s16, q4s16);
  511. q9s16 = vqaddq_s16(q9s16, q5s16);
  512. q10s16 = vqaddq_s16(q10s16, q6s16);
  513. d22u8 = vqrshrun_n_s16(q7s16, 7);
  514. d23u8 = vqrshrun_n_s16(q8s16, 7);
  515. d24u8 = vqrshrun_n_s16(q9s16, 7);
  516. d25u8 = vqrshrun_n_s16(q10s16, 7);
  517. if (yoffset == 0) { // firstpass_filter8x4_only
  518. vst1_u8(dst_ptr, d22u8);
  519. dst_ptr += dst_pitch;
  520. vst1_u8(dst_ptr, d23u8);
  521. dst_ptr += dst_pitch;
  522. vst1_u8(dst_ptr, d24u8);
  523. dst_ptr += dst_pitch;
  524. vst1_u8(dst_ptr, d25u8);
  525. return;
  526. }
  527. // First Pass on rest 5-line data
  528. src += src_pixels_per_line;
  529. q3u8 = vld1q_u8(src);
  530. src += src_pixels_per_line;
  531. q4u8 = vld1q_u8(src);
  532. src += src_pixels_per_line;
  533. q5u8 = vld1q_u8(src);
  534. src += src_pixels_per_line;
  535. q6u8 = vld1q_u8(src);
  536. src += src_pixels_per_line;
  537. q7u8 = vld1q_u8(src);
  538. q8u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
  539. q9u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
  540. q10u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
  541. q11u16 = vmull_u8(vget_low_u8(q6u8), d0u8);
  542. q12u16 = vmull_u8(vget_low_u8(q7u8), d0u8);
  543. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
  544. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
  545. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
  546. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 1);
  547. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 1);
  548. q8u16 = vmlsl_u8(q8u16, d27u8, d1u8);
  549. q9u16 = vmlsl_u8(q9u16, d28u8, d1u8);
  550. q10u16 = vmlsl_u8(q10u16, d29u8, d1u8);
  551. q11u16 = vmlsl_u8(q11u16, d30u8, d1u8);
  552. q12u16 = vmlsl_u8(q12u16, d31u8, d1u8);
  553. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 4);
  554. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 4);
  555. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 4);
  556. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 4);
  557. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 4);
  558. q8u16 = vmlsl_u8(q8u16, d27u8, d4u8);
  559. q9u16 = vmlsl_u8(q9u16, d28u8, d4u8);
  560. q10u16 = vmlsl_u8(q10u16, d29u8, d4u8);
  561. q11u16 = vmlsl_u8(q11u16, d30u8, d4u8);
  562. q12u16 = vmlsl_u8(q12u16, d31u8, d4u8);
  563. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 2);
  564. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 2);
  565. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 2);
  566. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 2);
  567. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 2);
  568. q8u16 = vmlal_u8(q8u16, d27u8, d2u8);
  569. q9u16 = vmlal_u8(q9u16, d28u8, d2u8);
  570. q10u16 = vmlal_u8(q10u16, d29u8, d2u8);
  571. q11u16 = vmlal_u8(q11u16, d30u8, d2u8);
  572. q12u16 = vmlal_u8(q12u16, d31u8, d2u8);
  573. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 5);
  574. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 5);
  575. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 5);
  576. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 5);
  577. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 5);
  578. q8u16 = vmlal_u8(q8u16, d27u8, d5u8);
  579. q9u16 = vmlal_u8(q9u16, d28u8, d5u8);
  580. q10u16 = vmlal_u8(q10u16, d29u8, d5u8);
  581. q11u16 = vmlal_u8(q11u16, d30u8, d5u8);
  582. q12u16 = vmlal_u8(q12u16, d31u8, d5u8);
  583. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 3);
  584. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 3);
  585. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 3);
  586. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 3);
  587. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 3);
  588. q3u16 = vmull_u8(d27u8, d3u8);
  589. q4u16 = vmull_u8(d28u8, d3u8);
  590. q5u16 = vmull_u8(d29u8, d3u8);
  591. q6u16 = vmull_u8(d30u8, d3u8);
  592. q7u16 = vmull_u8(d31u8, d3u8);
  593. q3s16 = vreinterpretq_s16_u16(q3u16);
  594. q4s16 = vreinterpretq_s16_u16(q4u16);
  595. q5s16 = vreinterpretq_s16_u16(q5u16);
  596. q6s16 = vreinterpretq_s16_u16(q6u16);
  597. q7s16 = vreinterpretq_s16_u16(q7u16);
  598. q8s16 = vreinterpretq_s16_u16(q8u16);
  599. q9s16 = vreinterpretq_s16_u16(q9u16);
  600. q10s16 = vreinterpretq_s16_u16(q10u16);
  601. q11s16 = vreinterpretq_s16_u16(q11u16);
  602. q12s16 = vreinterpretq_s16_u16(q12u16);
  603. q8s16 = vqaddq_s16(q8s16, q3s16);
  604. q9s16 = vqaddq_s16(q9s16, q4s16);
  605. q10s16 = vqaddq_s16(q10s16, q5s16);
  606. q11s16 = vqaddq_s16(q11s16, q6s16);
  607. q12s16 = vqaddq_s16(q12s16, q7s16);
  608. d26u8 = vqrshrun_n_s16(q8s16, 7);
  609. d27u8 = vqrshrun_n_s16(q9s16, 7);
  610. d28u8 = vqrshrun_n_s16(q10s16, 7);
  611. d29u8 = vqrshrun_n_s16(q11s16, 7);
  612. d30u8 = vqrshrun_n_s16(q12s16, 7);
  613. // Second pass: 8x4
  614. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  615. d0s8 = vdup_lane_s8(dtmps8, 0);
  616. d1s8 = vdup_lane_s8(dtmps8, 1);
  617. d2s8 = vdup_lane_s8(dtmps8, 2);
  618. d3s8 = vdup_lane_s8(dtmps8, 3);
  619. d4s8 = vdup_lane_s8(dtmps8, 4);
  620. d5s8 = vdup_lane_s8(dtmps8, 5);
  621. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  622. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  623. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  624. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  625. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  626. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  627. q3u16 = vmull_u8(d22u8, d0u8);
  628. q4u16 = vmull_u8(d23u8, d0u8);
  629. q5u16 = vmull_u8(d24u8, d0u8);
  630. q6u16 = vmull_u8(d25u8, d0u8);
  631. q3u16 = vmlsl_u8(q3u16, d23u8, d1u8);
  632. q4u16 = vmlsl_u8(q4u16, d24u8, d1u8);
  633. q5u16 = vmlsl_u8(q5u16, d25u8, d1u8);
  634. q6u16 = vmlsl_u8(q6u16, d26u8, d1u8);
  635. q3u16 = vmlsl_u8(q3u16, d26u8, d4u8);
  636. q4u16 = vmlsl_u8(q4u16, d27u8, d4u8);
  637. q5u16 = vmlsl_u8(q5u16, d28u8, d4u8);
  638. q6u16 = vmlsl_u8(q6u16, d29u8, d4u8);
  639. q3u16 = vmlal_u8(q3u16, d24u8, d2u8);
  640. q4u16 = vmlal_u8(q4u16, d25u8, d2u8);
  641. q5u16 = vmlal_u8(q5u16, d26u8, d2u8);
  642. q6u16 = vmlal_u8(q6u16, d27u8, d2u8);
  643. q3u16 = vmlal_u8(q3u16, d27u8, d5u8);
  644. q4u16 = vmlal_u8(q4u16, d28u8, d5u8);
  645. q5u16 = vmlal_u8(q5u16, d29u8, d5u8);
  646. q6u16 = vmlal_u8(q6u16, d30u8, d5u8);
  647. q7u16 = vmull_u8(d25u8, d3u8);
  648. q8u16 = vmull_u8(d26u8, d3u8);
  649. q9u16 = vmull_u8(d27u8, d3u8);
  650. q10u16 = vmull_u8(d28u8, d3u8);
  651. q3s16 = vreinterpretq_s16_u16(q3u16);
  652. q4s16 = vreinterpretq_s16_u16(q4u16);
  653. q5s16 = vreinterpretq_s16_u16(q5u16);
  654. q6s16 = vreinterpretq_s16_u16(q6u16);
  655. q7s16 = vreinterpretq_s16_u16(q7u16);
  656. q8s16 = vreinterpretq_s16_u16(q8u16);
  657. q9s16 = vreinterpretq_s16_u16(q9u16);
  658. q10s16 = vreinterpretq_s16_u16(q10u16);
  659. q7s16 = vqaddq_s16(q7s16, q3s16);
  660. q8s16 = vqaddq_s16(q8s16, q4s16);
  661. q9s16 = vqaddq_s16(q9s16, q5s16);
  662. q10s16 = vqaddq_s16(q10s16, q6s16);
  663. d6u8 = vqrshrun_n_s16(q7s16, 7);
  664. d7u8 = vqrshrun_n_s16(q8s16, 7);
  665. d8u8 = vqrshrun_n_s16(q9s16, 7);
  666. d9u8 = vqrshrun_n_s16(q10s16, 7);
  667. vst1_u8(dst_ptr, d6u8);
  668. dst_ptr += dst_pitch;
  669. vst1_u8(dst_ptr, d7u8);
  670. dst_ptr += dst_pitch;
  671. vst1_u8(dst_ptr, d8u8);
  672. dst_ptr += dst_pitch;
  673. vst1_u8(dst_ptr, d9u8);
  674. return;
  675. }
  676. void vp8_sixtap_predict8x8_neon(unsigned char *src_ptr, int src_pixels_per_line,
  677. int xoffset, int yoffset,
  678. unsigned char *dst_ptr, int dst_pitch) {
  679. unsigned char *src, *tmpp;
  680. unsigned char tmp[64];
  681. int i;
  682. uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8, d7u8, d8u8, d9u8;
  683. uint8x8_t d18u8, d19u8, d20u8, d21u8, d22u8, d23u8, d24u8, d25u8;
  684. uint8x8_t d26u8, d27u8, d28u8, d29u8, d30u8, d31u8;
  685. int8x8_t dtmps8, d0s8, d1s8, d2s8, d3s8, d4s8, d5s8;
  686. uint16x8_t q3u16, q4u16, q5u16, q6u16, q7u16;
  687. uint16x8_t q8u16, q9u16, q10u16, q11u16, q12u16;
  688. int16x8_t q3s16, q4s16, q5s16, q6s16, q7s16;
  689. int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16;
  690. uint8x16_t q3u8, q4u8, q5u8, q6u8, q7u8, q9u8, q10u8, q11u8, q12u8;
  691. if (xoffset == 0) { // secondpass_filter8x8_only
  692. // load second_pass filter
  693. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  694. d0s8 = vdup_lane_s8(dtmps8, 0);
  695. d1s8 = vdup_lane_s8(dtmps8, 1);
  696. d2s8 = vdup_lane_s8(dtmps8, 2);
  697. d3s8 = vdup_lane_s8(dtmps8, 3);
  698. d4s8 = vdup_lane_s8(dtmps8, 4);
  699. d5s8 = vdup_lane_s8(dtmps8, 5);
  700. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  701. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  702. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  703. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  704. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  705. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  706. // load src data
  707. src = src_ptr - src_pixels_per_line * 2;
  708. d18u8 = vld1_u8(src);
  709. src += src_pixels_per_line;
  710. d19u8 = vld1_u8(src);
  711. src += src_pixels_per_line;
  712. d20u8 = vld1_u8(src);
  713. src += src_pixels_per_line;
  714. d21u8 = vld1_u8(src);
  715. src += src_pixels_per_line;
  716. d22u8 = vld1_u8(src);
  717. src += src_pixels_per_line;
  718. d23u8 = vld1_u8(src);
  719. src += src_pixels_per_line;
  720. d24u8 = vld1_u8(src);
  721. src += src_pixels_per_line;
  722. d25u8 = vld1_u8(src);
  723. src += src_pixels_per_line;
  724. d26u8 = vld1_u8(src);
  725. src += src_pixels_per_line;
  726. d27u8 = vld1_u8(src);
  727. src += src_pixels_per_line;
  728. d28u8 = vld1_u8(src);
  729. src += src_pixels_per_line;
  730. d29u8 = vld1_u8(src);
  731. src += src_pixels_per_line;
  732. d30u8 = vld1_u8(src);
  733. for (i = 2; i > 0; i--) {
  734. q3u16 = vmull_u8(d18u8, d0u8);
  735. q4u16 = vmull_u8(d19u8, d0u8);
  736. q5u16 = vmull_u8(d20u8, d0u8);
  737. q6u16 = vmull_u8(d21u8, d0u8);
  738. q3u16 = vmlsl_u8(q3u16, d19u8, d1u8);
  739. q4u16 = vmlsl_u8(q4u16, d20u8, d1u8);
  740. q5u16 = vmlsl_u8(q5u16, d21u8, d1u8);
  741. q6u16 = vmlsl_u8(q6u16, d22u8, d1u8);
  742. q3u16 = vmlsl_u8(q3u16, d22u8, d4u8);
  743. q4u16 = vmlsl_u8(q4u16, d23u8, d4u8);
  744. q5u16 = vmlsl_u8(q5u16, d24u8, d4u8);
  745. q6u16 = vmlsl_u8(q6u16, d25u8, d4u8);
  746. q3u16 = vmlal_u8(q3u16, d20u8, d2u8);
  747. q4u16 = vmlal_u8(q4u16, d21u8, d2u8);
  748. q5u16 = vmlal_u8(q5u16, d22u8, d2u8);
  749. q6u16 = vmlal_u8(q6u16, d23u8, d2u8);
  750. q3u16 = vmlal_u8(q3u16, d23u8, d5u8);
  751. q4u16 = vmlal_u8(q4u16, d24u8, d5u8);
  752. q5u16 = vmlal_u8(q5u16, d25u8, d5u8);
  753. q6u16 = vmlal_u8(q6u16, d26u8, d5u8);
  754. q7u16 = vmull_u8(d21u8, d3u8);
  755. q8u16 = vmull_u8(d22u8, d3u8);
  756. q9u16 = vmull_u8(d23u8, d3u8);
  757. q10u16 = vmull_u8(d24u8, d3u8);
  758. q3s16 = vreinterpretq_s16_u16(q3u16);
  759. q4s16 = vreinterpretq_s16_u16(q4u16);
  760. q5s16 = vreinterpretq_s16_u16(q5u16);
  761. q6s16 = vreinterpretq_s16_u16(q6u16);
  762. q7s16 = vreinterpretq_s16_u16(q7u16);
  763. q8s16 = vreinterpretq_s16_u16(q8u16);
  764. q9s16 = vreinterpretq_s16_u16(q9u16);
  765. q10s16 = vreinterpretq_s16_u16(q10u16);
  766. q7s16 = vqaddq_s16(q7s16, q3s16);
  767. q8s16 = vqaddq_s16(q8s16, q4s16);
  768. q9s16 = vqaddq_s16(q9s16, q5s16);
  769. q10s16 = vqaddq_s16(q10s16, q6s16);
  770. d6u8 = vqrshrun_n_s16(q7s16, 7);
  771. d7u8 = vqrshrun_n_s16(q8s16, 7);
  772. d8u8 = vqrshrun_n_s16(q9s16, 7);
  773. d9u8 = vqrshrun_n_s16(q10s16, 7);
  774. d18u8 = d22u8;
  775. d19u8 = d23u8;
  776. d20u8 = d24u8;
  777. d21u8 = d25u8;
  778. d22u8 = d26u8;
  779. d23u8 = d27u8;
  780. d24u8 = d28u8;
  781. d25u8 = d29u8;
  782. d26u8 = d30u8;
  783. vst1_u8(dst_ptr, d6u8);
  784. dst_ptr += dst_pitch;
  785. vst1_u8(dst_ptr, d7u8);
  786. dst_ptr += dst_pitch;
  787. vst1_u8(dst_ptr, d8u8);
  788. dst_ptr += dst_pitch;
  789. vst1_u8(dst_ptr, d9u8);
  790. dst_ptr += dst_pitch;
  791. }
  792. return;
  793. }
  794. // load first_pass filter
  795. dtmps8 = vld1_s8(vp8_sub_pel_filters[xoffset]);
  796. d0s8 = vdup_lane_s8(dtmps8, 0);
  797. d1s8 = vdup_lane_s8(dtmps8, 1);
  798. d2s8 = vdup_lane_s8(dtmps8, 2);
  799. d3s8 = vdup_lane_s8(dtmps8, 3);
  800. d4s8 = vdup_lane_s8(dtmps8, 4);
  801. d5s8 = vdup_lane_s8(dtmps8, 5);
  802. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  803. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  804. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  805. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  806. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  807. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  808. // First pass: output_height lines x output_width columns (9x4)
  809. if (yoffset == 0) // firstpass_filter4x4_only
  810. src = src_ptr - 2;
  811. else
  812. src = src_ptr - 2 - (src_pixels_per_line * 2);
  813. tmpp = tmp;
  814. for (i = 2; i > 0; i--) {
  815. q3u8 = vld1q_u8(src);
  816. src += src_pixels_per_line;
  817. q4u8 = vld1q_u8(src);
  818. src += src_pixels_per_line;
  819. q5u8 = vld1q_u8(src);
  820. src += src_pixels_per_line;
  821. q6u8 = vld1q_u8(src);
  822. src += src_pixels_per_line;
  823. __builtin_prefetch(src);
  824. __builtin_prefetch(src + src_pixels_per_line);
  825. __builtin_prefetch(src + src_pixels_per_line * 2);
  826. q7u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
  827. q8u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
  828. q9u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
  829. q10u16 = vmull_u8(vget_low_u8(q6u8), d0u8);
  830. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
  831. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
  832. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
  833. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 1);
  834. q7u16 = vmlsl_u8(q7u16, d28u8, d1u8);
  835. q8u16 = vmlsl_u8(q8u16, d29u8, d1u8);
  836. q9u16 = vmlsl_u8(q9u16, d30u8, d1u8);
  837. q10u16 = vmlsl_u8(q10u16, d31u8, d1u8);
  838. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 4);
  839. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 4);
  840. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 4);
  841. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 4);
  842. q7u16 = vmlsl_u8(q7u16, d28u8, d4u8);
  843. q8u16 = vmlsl_u8(q8u16, d29u8, d4u8);
  844. q9u16 = vmlsl_u8(q9u16, d30u8, d4u8);
  845. q10u16 = vmlsl_u8(q10u16, d31u8, d4u8);
  846. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 2);
  847. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 2);
  848. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 2);
  849. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 2);
  850. q7u16 = vmlal_u8(q7u16, d28u8, d2u8);
  851. q8u16 = vmlal_u8(q8u16, d29u8, d2u8);
  852. q9u16 = vmlal_u8(q9u16, d30u8, d2u8);
  853. q10u16 = vmlal_u8(q10u16, d31u8, d2u8);
  854. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 5);
  855. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 5);
  856. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 5);
  857. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 5);
  858. q7u16 = vmlal_u8(q7u16, d28u8, d5u8);
  859. q8u16 = vmlal_u8(q8u16, d29u8, d5u8);
  860. q9u16 = vmlal_u8(q9u16, d30u8, d5u8);
  861. q10u16 = vmlal_u8(q10u16, d31u8, d5u8);
  862. d28u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 3);
  863. d29u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 3);
  864. d30u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 3);
  865. d31u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 3);
  866. q3u16 = vmull_u8(d28u8, d3u8);
  867. q4u16 = vmull_u8(d29u8, d3u8);
  868. q5u16 = vmull_u8(d30u8, d3u8);
  869. q6u16 = vmull_u8(d31u8, d3u8);
  870. q3s16 = vreinterpretq_s16_u16(q3u16);
  871. q4s16 = vreinterpretq_s16_u16(q4u16);
  872. q5s16 = vreinterpretq_s16_u16(q5u16);
  873. q6s16 = vreinterpretq_s16_u16(q6u16);
  874. q7s16 = vreinterpretq_s16_u16(q7u16);
  875. q8s16 = vreinterpretq_s16_u16(q8u16);
  876. q9s16 = vreinterpretq_s16_u16(q9u16);
  877. q10s16 = vreinterpretq_s16_u16(q10u16);
  878. q7s16 = vqaddq_s16(q7s16, q3s16);
  879. q8s16 = vqaddq_s16(q8s16, q4s16);
  880. q9s16 = vqaddq_s16(q9s16, q5s16);
  881. q10s16 = vqaddq_s16(q10s16, q6s16);
  882. d22u8 = vqrshrun_n_s16(q7s16, 7);
  883. d23u8 = vqrshrun_n_s16(q8s16, 7);
  884. d24u8 = vqrshrun_n_s16(q9s16, 7);
  885. d25u8 = vqrshrun_n_s16(q10s16, 7);
  886. if (yoffset == 0) { // firstpass_filter8x4_only
  887. vst1_u8(dst_ptr, d22u8);
  888. dst_ptr += dst_pitch;
  889. vst1_u8(dst_ptr, d23u8);
  890. dst_ptr += dst_pitch;
  891. vst1_u8(dst_ptr, d24u8);
  892. dst_ptr += dst_pitch;
  893. vst1_u8(dst_ptr, d25u8);
  894. dst_ptr += dst_pitch;
  895. } else {
  896. vst1_u8(tmpp, d22u8);
  897. tmpp += 8;
  898. vst1_u8(tmpp, d23u8);
  899. tmpp += 8;
  900. vst1_u8(tmpp, d24u8);
  901. tmpp += 8;
  902. vst1_u8(tmpp, d25u8);
  903. tmpp += 8;
  904. }
  905. }
  906. if (yoffset == 0) return;
  907. // First Pass on rest 5-line data
  908. q3u8 = vld1q_u8(src);
  909. src += src_pixels_per_line;
  910. q4u8 = vld1q_u8(src);
  911. src += src_pixels_per_line;
  912. q5u8 = vld1q_u8(src);
  913. src += src_pixels_per_line;
  914. q6u8 = vld1q_u8(src);
  915. src += src_pixels_per_line;
  916. q7u8 = vld1q_u8(src);
  917. q8u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
  918. q9u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
  919. q10u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
  920. q11u16 = vmull_u8(vget_low_u8(q6u8), d0u8);
  921. q12u16 = vmull_u8(vget_low_u8(q7u8), d0u8);
  922. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
  923. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
  924. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
  925. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 1);
  926. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 1);
  927. q8u16 = vmlsl_u8(q8u16, d27u8, d1u8);
  928. q9u16 = vmlsl_u8(q9u16, d28u8, d1u8);
  929. q10u16 = vmlsl_u8(q10u16, d29u8, d1u8);
  930. q11u16 = vmlsl_u8(q11u16, d30u8, d1u8);
  931. q12u16 = vmlsl_u8(q12u16, d31u8, d1u8);
  932. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 4);
  933. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 4);
  934. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 4);
  935. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 4);
  936. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 4);
  937. q8u16 = vmlsl_u8(q8u16, d27u8, d4u8);
  938. q9u16 = vmlsl_u8(q9u16, d28u8, d4u8);
  939. q10u16 = vmlsl_u8(q10u16, d29u8, d4u8);
  940. q11u16 = vmlsl_u8(q11u16, d30u8, d4u8);
  941. q12u16 = vmlsl_u8(q12u16, d31u8, d4u8);
  942. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 2);
  943. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 2);
  944. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 2);
  945. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 2);
  946. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 2);
  947. q8u16 = vmlal_u8(q8u16, d27u8, d2u8);
  948. q9u16 = vmlal_u8(q9u16, d28u8, d2u8);
  949. q10u16 = vmlal_u8(q10u16, d29u8, d2u8);
  950. q11u16 = vmlal_u8(q11u16, d30u8, d2u8);
  951. q12u16 = vmlal_u8(q12u16, d31u8, d2u8);
  952. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 5);
  953. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 5);
  954. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 5);
  955. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 5);
  956. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 5);
  957. q8u16 = vmlal_u8(q8u16, d27u8, d5u8);
  958. q9u16 = vmlal_u8(q9u16, d28u8, d5u8);
  959. q10u16 = vmlal_u8(q10u16, d29u8, d5u8);
  960. q11u16 = vmlal_u8(q11u16, d30u8, d5u8);
  961. q12u16 = vmlal_u8(q12u16, d31u8, d5u8);
  962. d27u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 3);
  963. d28u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 3);
  964. d29u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 3);
  965. d30u8 = vext_u8(vget_low_u8(q6u8), vget_high_u8(q6u8), 3);
  966. d31u8 = vext_u8(vget_low_u8(q7u8), vget_high_u8(q7u8), 3);
  967. q3u16 = vmull_u8(d27u8, d3u8);
  968. q4u16 = vmull_u8(d28u8, d3u8);
  969. q5u16 = vmull_u8(d29u8, d3u8);
  970. q6u16 = vmull_u8(d30u8, d3u8);
  971. q7u16 = vmull_u8(d31u8, d3u8);
  972. q3s16 = vreinterpretq_s16_u16(q3u16);
  973. q4s16 = vreinterpretq_s16_u16(q4u16);
  974. q5s16 = vreinterpretq_s16_u16(q5u16);
  975. q6s16 = vreinterpretq_s16_u16(q6u16);
  976. q7s16 = vreinterpretq_s16_u16(q7u16);
  977. q8s16 = vreinterpretq_s16_u16(q8u16);
  978. q9s16 = vreinterpretq_s16_u16(q9u16);
  979. q10s16 = vreinterpretq_s16_u16(q10u16);
  980. q11s16 = vreinterpretq_s16_u16(q11u16);
  981. q12s16 = vreinterpretq_s16_u16(q12u16);
  982. q8s16 = vqaddq_s16(q8s16, q3s16);
  983. q9s16 = vqaddq_s16(q9s16, q4s16);
  984. q10s16 = vqaddq_s16(q10s16, q5s16);
  985. q11s16 = vqaddq_s16(q11s16, q6s16);
  986. q12s16 = vqaddq_s16(q12s16, q7s16);
  987. d26u8 = vqrshrun_n_s16(q8s16, 7);
  988. d27u8 = vqrshrun_n_s16(q9s16, 7);
  989. d28u8 = vqrshrun_n_s16(q10s16, 7);
  990. d29u8 = vqrshrun_n_s16(q11s16, 7);
  991. d30u8 = vqrshrun_n_s16(q12s16, 7);
  992. // Second pass: 8x8
  993. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  994. d0s8 = vdup_lane_s8(dtmps8, 0);
  995. d1s8 = vdup_lane_s8(dtmps8, 1);
  996. d2s8 = vdup_lane_s8(dtmps8, 2);
  997. d3s8 = vdup_lane_s8(dtmps8, 3);
  998. d4s8 = vdup_lane_s8(dtmps8, 4);
  999. d5s8 = vdup_lane_s8(dtmps8, 5);
  1000. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  1001. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  1002. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  1003. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  1004. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  1005. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  1006. tmpp = tmp;
  1007. q9u8 = vld1q_u8(tmpp);
  1008. tmpp += 16;
  1009. q10u8 = vld1q_u8(tmpp);
  1010. tmpp += 16;
  1011. q11u8 = vld1q_u8(tmpp);
  1012. tmpp += 16;
  1013. q12u8 = vld1q_u8(tmpp);
  1014. d18u8 = vget_low_u8(q9u8);
  1015. d19u8 = vget_high_u8(q9u8);
  1016. d20u8 = vget_low_u8(q10u8);
  1017. d21u8 = vget_high_u8(q10u8);
  1018. d22u8 = vget_low_u8(q11u8);
  1019. d23u8 = vget_high_u8(q11u8);
  1020. d24u8 = vget_low_u8(q12u8);
  1021. d25u8 = vget_high_u8(q12u8);
  1022. for (i = 2; i > 0; i--) {
  1023. q3u16 = vmull_u8(d18u8, d0u8);
  1024. q4u16 = vmull_u8(d19u8, d0u8);
  1025. q5u16 = vmull_u8(d20u8, d0u8);
  1026. q6u16 = vmull_u8(d21u8, d0u8);
  1027. q3u16 = vmlsl_u8(q3u16, d19u8, d1u8);
  1028. q4u16 = vmlsl_u8(q4u16, d20u8, d1u8);
  1029. q5u16 = vmlsl_u8(q5u16, d21u8, d1u8);
  1030. q6u16 = vmlsl_u8(q6u16, d22u8, d1u8);
  1031. q3u16 = vmlsl_u8(q3u16, d22u8, d4u8);
  1032. q4u16 = vmlsl_u8(q4u16, d23u8, d4u8);
  1033. q5u16 = vmlsl_u8(q5u16, d24u8, d4u8);
  1034. q6u16 = vmlsl_u8(q6u16, d25u8, d4u8);
  1035. q3u16 = vmlal_u8(q3u16, d20u8, d2u8);
  1036. q4u16 = vmlal_u8(q4u16, d21u8, d2u8);
  1037. q5u16 = vmlal_u8(q5u16, d22u8, d2u8);
  1038. q6u16 = vmlal_u8(q6u16, d23u8, d2u8);
  1039. q3u16 = vmlal_u8(q3u16, d23u8, d5u8);
  1040. q4u16 = vmlal_u8(q4u16, d24u8, d5u8);
  1041. q5u16 = vmlal_u8(q5u16, d25u8, d5u8);
  1042. q6u16 = vmlal_u8(q6u16, d26u8, d5u8);
  1043. q7u16 = vmull_u8(d21u8, d3u8);
  1044. q8u16 = vmull_u8(d22u8, d3u8);
  1045. q9u16 = vmull_u8(d23u8, d3u8);
  1046. q10u16 = vmull_u8(d24u8, d3u8);
  1047. q3s16 = vreinterpretq_s16_u16(q3u16);
  1048. q4s16 = vreinterpretq_s16_u16(q4u16);
  1049. q5s16 = vreinterpretq_s16_u16(q5u16);
  1050. q6s16 = vreinterpretq_s16_u16(q6u16);
  1051. q7s16 = vreinterpretq_s16_u16(q7u16);
  1052. q8s16 = vreinterpretq_s16_u16(q8u16);
  1053. q9s16 = vreinterpretq_s16_u16(q9u16);
  1054. q10s16 = vreinterpretq_s16_u16(q10u16);
  1055. q7s16 = vqaddq_s16(q7s16, q3s16);
  1056. q8s16 = vqaddq_s16(q8s16, q4s16);
  1057. q9s16 = vqaddq_s16(q9s16, q5s16);
  1058. q10s16 = vqaddq_s16(q10s16, q6s16);
  1059. d6u8 = vqrshrun_n_s16(q7s16, 7);
  1060. d7u8 = vqrshrun_n_s16(q8s16, 7);
  1061. d8u8 = vqrshrun_n_s16(q9s16, 7);
  1062. d9u8 = vqrshrun_n_s16(q10s16, 7);
  1063. d18u8 = d22u8;
  1064. d19u8 = d23u8;
  1065. d20u8 = d24u8;
  1066. d21u8 = d25u8;
  1067. d22u8 = d26u8;
  1068. d23u8 = d27u8;
  1069. d24u8 = d28u8;
  1070. d25u8 = d29u8;
  1071. d26u8 = d30u8;
  1072. vst1_u8(dst_ptr, d6u8);
  1073. dst_ptr += dst_pitch;
  1074. vst1_u8(dst_ptr, d7u8);
  1075. dst_ptr += dst_pitch;
  1076. vst1_u8(dst_ptr, d8u8);
  1077. dst_ptr += dst_pitch;
  1078. vst1_u8(dst_ptr, d9u8);
  1079. dst_ptr += dst_pitch;
  1080. }
  1081. return;
  1082. }
  1083. void vp8_sixtap_predict16x16_neon(unsigned char *src_ptr,
  1084. int src_pixels_per_line, int xoffset,
  1085. int yoffset, unsigned char *dst_ptr,
  1086. int dst_pitch) {
  1087. unsigned char *src, *src_tmp, *dst, *tmpp;
  1088. unsigned char tmp[336];
  1089. int i, j;
  1090. uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8, d7u8, d8u8, d9u8;
  1091. uint8x8_t d10u8, d11u8, d12u8, d13u8, d14u8, d15u8, d18u8, d19u8;
  1092. uint8x8_t d20u8, d21u8, d22u8, d23u8, d24u8, d25u8, d26u8, d27u8;
  1093. uint8x8_t d28u8, d29u8, d30u8, d31u8;
  1094. int8x8_t dtmps8, d0s8, d1s8, d2s8, d3s8, d4s8, d5s8;
  1095. uint8x16_t q3u8, q4u8;
  1096. uint16x8_t q3u16, q4u16, q5u16, q6u16, q7u16, q8u16, q9u16, q10u16;
  1097. uint16x8_t q11u16, q12u16, q13u16, q15u16;
  1098. int16x8_t q3s16, q4s16, q5s16, q6s16, q7s16, q8s16, q9s16, q10s16;
  1099. int16x8_t q11s16, q12s16, q13s16, q15s16;
  1100. if (xoffset == 0) { // secondpass_filter8x8_only
  1101. // load second_pass filter
  1102. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  1103. d0s8 = vdup_lane_s8(dtmps8, 0);
  1104. d1s8 = vdup_lane_s8(dtmps8, 1);
  1105. d2s8 = vdup_lane_s8(dtmps8, 2);
  1106. d3s8 = vdup_lane_s8(dtmps8, 3);
  1107. d4s8 = vdup_lane_s8(dtmps8, 4);
  1108. d5s8 = vdup_lane_s8(dtmps8, 5);
  1109. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  1110. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  1111. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  1112. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  1113. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  1114. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  1115. // load src data
  1116. src_tmp = src_ptr - src_pixels_per_line * 2;
  1117. for (i = 0; i < 2; ++i) {
  1118. src = src_tmp + i * 8;
  1119. dst = dst_ptr + i * 8;
  1120. d18u8 = vld1_u8(src);
  1121. src += src_pixels_per_line;
  1122. d19u8 = vld1_u8(src);
  1123. src += src_pixels_per_line;
  1124. d20u8 = vld1_u8(src);
  1125. src += src_pixels_per_line;
  1126. d21u8 = vld1_u8(src);
  1127. src += src_pixels_per_line;
  1128. d22u8 = vld1_u8(src);
  1129. src += src_pixels_per_line;
  1130. for (j = 0; j < 4; ++j) {
  1131. d23u8 = vld1_u8(src);
  1132. src += src_pixels_per_line;
  1133. d24u8 = vld1_u8(src);
  1134. src += src_pixels_per_line;
  1135. d25u8 = vld1_u8(src);
  1136. src += src_pixels_per_line;
  1137. d26u8 = vld1_u8(src);
  1138. src += src_pixels_per_line;
  1139. q3u16 = vmull_u8(d18u8, d0u8);
  1140. q4u16 = vmull_u8(d19u8, d0u8);
  1141. q5u16 = vmull_u8(d20u8, d0u8);
  1142. q6u16 = vmull_u8(d21u8, d0u8);
  1143. q3u16 = vmlsl_u8(q3u16, d19u8, d1u8);
  1144. q4u16 = vmlsl_u8(q4u16, d20u8, d1u8);
  1145. q5u16 = vmlsl_u8(q5u16, d21u8, d1u8);
  1146. q6u16 = vmlsl_u8(q6u16, d22u8, d1u8);
  1147. q3u16 = vmlsl_u8(q3u16, d22u8, d4u8);
  1148. q4u16 = vmlsl_u8(q4u16, d23u8, d4u8);
  1149. q5u16 = vmlsl_u8(q5u16, d24u8, d4u8);
  1150. q6u16 = vmlsl_u8(q6u16, d25u8, d4u8);
  1151. q3u16 = vmlal_u8(q3u16, d20u8, d2u8);
  1152. q4u16 = vmlal_u8(q4u16, d21u8, d2u8);
  1153. q5u16 = vmlal_u8(q5u16, d22u8, d2u8);
  1154. q6u16 = vmlal_u8(q6u16, d23u8, d2u8);
  1155. q3u16 = vmlal_u8(q3u16, d23u8, d5u8);
  1156. q4u16 = vmlal_u8(q4u16, d24u8, d5u8);
  1157. q5u16 = vmlal_u8(q5u16, d25u8, d5u8);
  1158. q6u16 = vmlal_u8(q6u16, d26u8, d5u8);
  1159. q7u16 = vmull_u8(d21u8, d3u8);
  1160. q8u16 = vmull_u8(d22u8, d3u8);
  1161. q9u16 = vmull_u8(d23u8, d3u8);
  1162. q10u16 = vmull_u8(d24u8, d3u8);
  1163. q3s16 = vreinterpretq_s16_u16(q3u16);
  1164. q4s16 = vreinterpretq_s16_u16(q4u16);
  1165. q5s16 = vreinterpretq_s16_u16(q5u16);
  1166. q6s16 = vreinterpretq_s16_u16(q6u16);
  1167. q7s16 = vreinterpretq_s16_u16(q7u16);
  1168. q8s16 = vreinterpretq_s16_u16(q8u16);
  1169. q9s16 = vreinterpretq_s16_u16(q9u16);
  1170. q10s16 = vreinterpretq_s16_u16(q10u16);
  1171. q7s16 = vqaddq_s16(q7s16, q3s16);
  1172. q8s16 = vqaddq_s16(q8s16, q4s16);
  1173. q9s16 = vqaddq_s16(q9s16, q5s16);
  1174. q10s16 = vqaddq_s16(q10s16, q6s16);
  1175. d6u8 = vqrshrun_n_s16(q7s16, 7);
  1176. d7u8 = vqrshrun_n_s16(q8s16, 7);
  1177. d8u8 = vqrshrun_n_s16(q9s16, 7);
  1178. d9u8 = vqrshrun_n_s16(q10s16, 7);
  1179. d18u8 = d22u8;
  1180. d19u8 = d23u8;
  1181. d20u8 = d24u8;
  1182. d21u8 = d25u8;
  1183. d22u8 = d26u8;
  1184. vst1_u8(dst, d6u8);
  1185. dst += dst_pitch;
  1186. vst1_u8(dst, d7u8);
  1187. dst += dst_pitch;
  1188. vst1_u8(dst, d8u8);
  1189. dst += dst_pitch;
  1190. vst1_u8(dst, d9u8);
  1191. dst += dst_pitch;
  1192. }
  1193. }
  1194. return;
  1195. }
  1196. // load first_pass filter
  1197. dtmps8 = vld1_s8(vp8_sub_pel_filters[xoffset]);
  1198. d0s8 = vdup_lane_s8(dtmps8, 0);
  1199. d1s8 = vdup_lane_s8(dtmps8, 1);
  1200. d2s8 = vdup_lane_s8(dtmps8, 2);
  1201. d3s8 = vdup_lane_s8(dtmps8, 3);
  1202. d4s8 = vdup_lane_s8(dtmps8, 4);
  1203. d5s8 = vdup_lane_s8(dtmps8, 5);
  1204. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  1205. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  1206. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  1207. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  1208. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  1209. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  1210. // First pass: output_height lines x output_width columns (9x4)
  1211. if (yoffset == 0) { // firstpass_filter4x4_only
  1212. src = src_ptr - 2;
  1213. dst = dst_ptr;
  1214. for (i = 0; i < 8; ++i) {
  1215. d6u8 = vld1_u8(src);
  1216. d7u8 = vld1_u8(src + 8);
  1217. d8u8 = vld1_u8(src + 16);
  1218. src += src_pixels_per_line;
  1219. d9u8 = vld1_u8(src);
  1220. d10u8 = vld1_u8(src + 8);
  1221. d11u8 = vld1_u8(src + 16);
  1222. src += src_pixels_per_line;
  1223. __builtin_prefetch(src);
  1224. __builtin_prefetch(src + src_pixels_per_line);
  1225. q6u16 = vmull_u8(d6u8, d0u8);
  1226. q7u16 = vmull_u8(d7u8, d0u8);
  1227. q8u16 = vmull_u8(d9u8, d0u8);
  1228. q9u16 = vmull_u8(d10u8, d0u8);
  1229. d20u8 = vext_u8(d6u8, d7u8, 1);
  1230. d21u8 = vext_u8(d9u8, d10u8, 1);
  1231. d22u8 = vext_u8(d7u8, d8u8, 1);
  1232. d23u8 = vext_u8(d10u8, d11u8, 1);
  1233. d24u8 = vext_u8(d6u8, d7u8, 4);
  1234. d25u8 = vext_u8(d9u8, d10u8, 4);
  1235. d26u8 = vext_u8(d7u8, d8u8, 4);
  1236. d27u8 = vext_u8(d10u8, d11u8, 4);
  1237. d28u8 = vext_u8(d6u8, d7u8, 5);
  1238. d29u8 = vext_u8(d9u8, d10u8, 5);
  1239. q6u16 = vmlsl_u8(q6u16, d20u8, d1u8);
  1240. q8u16 = vmlsl_u8(q8u16, d21u8, d1u8);
  1241. q7u16 = vmlsl_u8(q7u16, d22u8, d1u8);
  1242. q9u16 = vmlsl_u8(q9u16, d23u8, d1u8);
  1243. q6u16 = vmlsl_u8(q6u16, d24u8, d4u8);
  1244. q8u16 = vmlsl_u8(q8u16, d25u8, d4u8);
  1245. q7u16 = vmlsl_u8(q7u16, d26u8, d4u8);
  1246. q9u16 = vmlsl_u8(q9u16, d27u8, d4u8);
  1247. q6u16 = vmlal_u8(q6u16, d28u8, d5u8);
  1248. q8u16 = vmlal_u8(q8u16, d29u8, d5u8);
  1249. d20u8 = vext_u8(d7u8, d8u8, 5);
  1250. d21u8 = vext_u8(d10u8, d11u8, 5);
  1251. d22u8 = vext_u8(d6u8, d7u8, 2);
  1252. d23u8 = vext_u8(d9u8, d10u8, 2);
  1253. d24u8 = vext_u8(d7u8, d8u8, 2);
  1254. d25u8 = vext_u8(d10u8, d11u8, 2);
  1255. d26u8 = vext_u8(d6u8, d7u8, 3);
  1256. d27u8 = vext_u8(d9u8, d10u8, 3);
  1257. d28u8 = vext_u8(d7u8, d8u8, 3);
  1258. d29u8 = vext_u8(d10u8, d11u8, 3);
  1259. q7u16 = vmlal_u8(q7u16, d20u8, d5u8);
  1260. q9u16 = vmlal_u8(q9u16, d21u8, d5u8);
  1261. q6u16 = vmlal_u8(q6u16, d22u8, d2u8);
  1262. q8u16 = vmlal_u8(q8u16, d23u8, d2u8);
  1263. q7u16 = vmlal_u8(q7u16, d24u8, d2u8);
  1264. q9u16 = vmlal_u8(q9u16, d25u8, d2u8);
  1265. q10u16 = vmull_u8(d26u8, d3u8);
  1266. q11u16 = vmull_u8(d27u8, d3u8);
  1267. q12u16 = vmull_u8(d28u8, d3u8);
  1268. q15u16 = vmull_u8(d29u8, d3u8);
  1269. q6s16 = vreinterpretq_s16_u16(q6u16);
  1270. q7s16 = vreinterpretq_s16_u16(q7u16);
  1271. q8s16 = vreinterpretq_s16_u16(q8u16);
  1272. q9s16 = vreinterpretq_s16_u16(q9u16);
  1273. q10s16 = vreinterpretq_s16_u16(q10u16);
  1274. q11s16 = vreinterpretq_s16_u16(q11u16);
  1275. q12s16 = vreinterpretq_s16_u16(q12u16);
  1276. q15s16 = vreinterpretq_s16_u16(q15u16);
  1277. q6s16 = vqaddq_s16(q6s16, q10s16);
  1278. q8s16 = vqaddq_s16(q8s16, q11s16);
  1279. q7s16 = vqaddq_s16(q7s16, q12s16);
  1280. q9s16 = vqaddq_s16(q9s16, q15s16);
  1281. d6u8 = vqrshrun_n_s16(q6s16, 7);
  1282. d7u8 = vqrshrun_n_s16(q7s16, 7);
  1283. d8u8 = vqrshrun_n_s16(q8s16, 7);
  1284. d9u8 = vqrshrun_n_s16(q9s16, 7);
  1285. q3u8 = vcombine_u8(d6u8, d7u8);
  1286. q4u8 = vcombine_u8(d8u8, d9u8);
  1287. vst1q_u8(dst, q3u8);
  1288. dst += dst_pitch;
  1289. vst1q_u8(dst, q4u8);
  1290. dst += dst_pitch;
  1291. }
  1292. return;
  1293. }
  1294. src = src_ptr - 2 - src_pixels_per_line * 2;
  1295. tmpp = tmp;
  1296. for (i = 0; i < 7; ++i) {
  1297. d6u8 = vld1_u8(src);
  1298. d7u8 = vld1_u8(src + 8);
  1299. d8u8 = vld1_u8(src + 16);
  1300. src += src_pixels_per_line;
  1301. d9u8 = vld1_u8(src);
  1302. d10u8 = vld1_u8(src + 8);
  1303. d11u8 = vld1_u8(src + 16);
  1304. src += src_pixels_per_line;
  1305. d12u8 = vld1_u8(src);
  1306. d13u8 = vld1_u8(src + 8);
  1307. d14u8 = vld1_u8(src + 16);
  1308. src += src_pixels_per_line;
  1309. __builtin_prefetch(src);
  1310. __builtin_prefetch(src + src_pixels_per_line);
  1311. __builtin_prefetch(src + src_pixels_per_line * 2);
  1312. q8u16 = vmull_u8(d6u8, d0u8);
  1313. q9u16 = vmull_u8(d7u8, d0u8);
  1314. q10u16 = vmull_u8(d9u8, d0u8);
  1315. q11u16 = vmull_u8(d10u8, d0u8);
  1316. q12u16 = vmull_u8(d12u8, d0u8);
  1317. q13u16 = vmull_u8(d13u8, d0u8);
  1318. d28u8 = vext_u8(d6u8, d7u8, 1);
  1319. d29u8 = vext_u8(d9u8, d10u8, 1);
  1320. d30u8 = vext_u8(d12u8, d13u8, 1);
  1321. q8u16 = vmlsl_u8(q8u16, d28u8, d1u8);
  1322. q10u16 = vmlsl_u8(q10u16, d29u8, d1u8);
  1323. q12u16 = vmlsl_u8(q12u16, d30u8, d1u8);
  1324. d28u8 = vext_u8(d7u8, d8u8, 1);
  1325. d29u8 = vext_u8(d10u8, d11u8, 1);
  1326. d30u8 = vext_u8(d13u8, d14u8, 1);
  1327. q9u16 = vmlsl_u8(q9u16, d28u8, d1u8);
  1328. q11u16 = vmlsl_u8(q11u16, d29u8, d1u8);
  1329. q13u16 = vmlsl_u8(q13u16, d30u8, d1u8);
  1330. d28u8 = vext_u8(d6u8, d7u8, 4);
  1331. d29u8 = vext_u8(d9u8, d10u8, 4);
  1332. d30u8 = vext_u8(d12u8, d13u8, 4);
  1333. q8u16 = vmlsl_u8(q8u16, d28u8, d4u8);
  1334. q10u16 = vmlsl_u8(q10u16, d29u8, d4u8);
  1335. q12u16 = vmlsl_u8(q12u16, d30u8, d4u8);
  1336. d28u8 = vext_u8(d7u8, d8u8, 4);
  1337. d29u8 = vext_u8(d10u8, d11u8, 4);
  1338. d30u8 = vext_u8(d13u8, d14u8, 4);
  1339. q9u16 = vmlsl_u8(q9u16, d28u8, d4u8);
  1340. q11u16 = vmlsl_u8(q11u16, d29u8, d4u8);
  1341. q13u16 = vmlsl_u8(q13u16, d30u8, d4u8);
  1342. d28u8 = vext_u8(d6u8, d7u8, 5);
  1343. d29u8 = vext_u8(d9u8, d10u8, 5);
  1344. d30u8 = vext_u8(d12u8, d13u8, 5);
  1345. q8u16 = vmlal_u8(q8u16, d28u8, d5u8);
  1346. q10u16 = vmlal_u8(q10u16, d29u8, d5u8);
  1347. q12u16 = vmlal_u8(q12u16, d30u8, d5u8);
  1348. d28u8 = vext_u8(d7u8, d8u8, 5);
  1349. d29u8 = vext_u8(d10u8, d11u8, 5);
  1350. d30u8 = vext_u8(d13u8, d14u8, 5);
  1351. q9u16 = vmlal_u8(q9u16, d28u8, d5u8);
  1352. q11u16 = vmlal_u8(q11u16, d29u8, d5u8);
  1353. q13u16 = vmlal_u8(q13u16, d30u8, d5u8);
  1354. d28u8 = vext_u8(d6u8, d7u8, 2);
  1355. d29u8 = vext_u8(d9u8, d10u8, 2);
  1356. d30u8 = vext_u8(d12u8, d13u8, 2);
  1357. q8u16 = vmlal_u8(q8u16, d28u8, d2u8);
  1358. q10u16 = vmlal_u8(q10u16, d29u8, d2u8);
  1359. q12u16 = vmlal_u8(q12u16, d30u8, d2u8);
  1360. d28u8 = vext_u8(d7u8, d8u8, 2);
  1361. d29u8 = vext_u8(d10u8, d11u8, 2);
  1362. d30u8 = vext_u8(d13u8, d14u8, 2);
  1363. q9u16 = vmlal_u8(q9u16, d28u8, d2u8);
  1364. q11u16 = vmlal_u8(q11u16, d29u8, d2u8);
  1365. q13u16 = vmlal_u8(q13u16, d30u8, d2u8);
  1366. d28u8 = vext_u8(d6u8, d7u8, 3);
  1367. d29u8 = vext_u8(d9u8, d10u8, 3);
  1368. d30u8 = vext_u8(d12u8, d13u8, 3);
  1369. d15u8 = vext_u8(d7u8, d8u8, 3);
  1370. d31u8 = vext_u8(d10u8, d11u8, 3);
  1371. d6u8 = vext_u8(d13u8, d14u8, 3);
  1372. q4u16 = vmull_u8(d28u8, d3u8);
  1373. q5u16 = vmull_u8(d29u8, d3u8);
  1374. q6u16 = vmull_u8(d30u8, d3u8);
  1375. q4s16 = vreinterpretq_s16_u16(q4u16);
  1376. q5s16 = vreinterpretq_s16_u16(q5u16);
  1377. q6s16 = vreinterpretq_s16_u16(q6u16);
  1378. q8s16 = vreinterpretq_s16_u16(q8u16);
  1379. q10s16 = vreinterpretq_s16_u16(q10u16);
  1380. q12s16 = vreinterpretq_s16_u16(q12u16);
  1381. q8s16 = vqaddq_s16(q8s16, q4s16);
  1382. q10s16 = vqaddq_s16(q10s16, q5s16);
  1383. q12s16 = vqaddq_s16(q12s16, q6s16);
  1384. q6u16 = vmull_u8(d15u8, d3u8);
  1385. q7u16 = vmull_u8(d31u8, d3u8);
  1386. q3u16 = vmull_u8(d6u8, d3u8);
  1387. q3s16 = vreinterpretq_s16_u16(q3u16);
  1388. q6s16 = vreinterpretq_s16_u16(q6u16);
  1389. q7s16 = vreinterpretq_s16_u16(q7u16);
  1390. q9s16 = vreinterpretq_s16_u16(q9u16);
  1391. q11s16 = vreinterpretq_s16_u16(q11u16);
  1392. q13s16 = vreinterpretq_s16_u16(q13u16);
  1393. q9s16 = vqaddq_s16(q9s16, q6s16);
  1394. q11s16 = vqaddq_s16(q11s16, q7s16);
  1395. q13s16 = vqaddq_s16(q13s16, q3s16);
  1396. d6u8 = vqrshrun_n_s16(q8s16, 7);
  1397. d7u8 = vqrshrun_n_s16(q9s16, 7);
  1398. d8u8 = vqrshrun_n_s16(q10s16, 7);
  1399. d9u8 = vqrshrun_n_s16(q11s16, 7);
  1400. d10u8 = vqrshrun_n_s16(q12s16, 7);
  1401. d11u8 = vqrshrun_n_s16(q13s16, 7);
  1402. vst1_u8(tmpp, d6u8);
  1403. tmpp += 8;
  1404. vst1_u8(tmpp, d7u8);
  1405. tmpp += 8;
  1406. vst1_u8(tmpp, d8u8);
  1407. tmpp += 8;
  1408. vst1_u8(tmpp, d9u8);
  1409. tmpp += 8;
  1410. vst1_u8(tmpp, d10u8);
  1411. tmpp += 8;
  1412. vst1_u8(tmpp, d11u8);
  1413. tmpp += 8;
  1414. }
  1415. // Second pass: 16x16
  1416. dtmps8 = vld1_s8(vp8_sub_pel_filters[yoffset]);
  1417. d0s8 = vdup_lane_s8(dtmps8, 0);
  1418. d1s8 = vdup_lane_s8(dtmps8, 1);
  1419. d2s8 = vdup_lane_s8(dtmps8, 2);
  1420. d3s8 = vdup_lane_s8(dtmps8, 3);
  1421. d4s8 = vdup_lane_s8(dtmps8, 4);
  1422. d5s8 = vdup_lane_s8(dtmps8, 5);
  1423. d0u8 = vreinterpret_u8_s8(vabs_s8(d0s8));
  1424. d1u8 = vreinterpret_u8_s8(vabs_s8(d1s8));
  1425. d2u8 = vreinterpret_u8_s8(vabs_s8(d2s8));
  1426. d3u8 = vreinterpret_u8_s8(vabs_s8(d3s8));
  1427. d4u8 = vreinterpret_u8_s8(vabs_s8(d4s8));
  1428. d5u8 = vreinterpret_u8_s8(vabs_s8(d5s8));
  1429. for (i = 0; i < 2; ++i) {
  1430. dst = dst_ptr + 8 * i;
  1431. tmpp = tmp + 8 * i;
  1432. d18u8 = vld1_u8(tmpp);
  1433. tmpp += 16;
  1434. d19u8 = vld1_u8(tmpp);
  1435. tmpp += 16;
  1436. d20u8 = vld1_u8(tmpp);
  1437. tmpp += 16;
  1438. d21u8 = vld1_u8(tmpp);
  1439. tmpp += 16;
  1440. d22u8 = vld1_u8(tmpp);
  1441. tmpp += 16;
  1442. for (j = 0; j < 4; ++j) {
  1443. d23u8 = vld1_u8(tmpp);
  1444. tmpp += 16;
  1445. d24u8 = vld1_u8(tmpp);
  1446. tmpp += 16;
  1447. d25u8 = vld1_u8(tmpp);
  1448. tmpp += 16;
  1449. d26u8 = vld1_u8(tmpp);
  1450. tmpp += 16;
  1451. q3u16 = vmull_u8(d18u8, d0u8);
  1452. q4u16 = vmull_u8(d19u8, d0u8);
  1453. q5u16 = vmull_u8(d20u8, d0u8);
  1454. q6u16 = vmull_u8(d21u8, d0u8);
  1455. q3u16 = vmlsl_u8(q3u16, d19u8, d1u8);
  1456. q4u16 = vmlsl_u8(q4u16, d20u8, d1u8);
  1457. q5u16 = vmlsl_u8(q5u16, d21u8, d1u8);
  1458. q6u16 = vmlsl_u8(q6u16, d22u8, d1u8);
  1459. q3u16 = vmlsl_u8(q3u16, d22u8, d4u8);
  1460. q4u16 = vmlsl_u8(q4u16, d23u8, d4u8);
  1461. q5u16 = vmlsl_u8(q5u16, d24u8, d4u8);
  1462. q6u16 = vmlsl_u8(q6u16, d25u8, d4u8);
  1463. q3u16 = vmlal_u8(q3u16, d20u8, d2u8);
  1464. q4u16 = vmlal_u8(q4u16, d21u8, d2u8);
  1465. q5u16 = vmlal_u8(q5u16, d22u8, d2u8);
  1466. q6u16 = vmlal_u8(q6u16, d23u8, d2u8);
  1467. q3u16 = vmlal_u8(q3u16, d23u8, d5u8);
  1468. q4u16 = vmlal_u8(q4u16, d24u8, d5u8);
  1469. q5u16 = vmlal_u8(q5u16, d25u8, d5u8);
  1470. q6u16 = vmlal_u8(q6u16, d26u8, d5u8);
  1471. q7u16 = vmull_u8(d21u8, d3u8);
  1472. q8u16 = vmull_u8(d22u8, d3u8);
  1473. q9u16 = vmull_u8(d23u8, d3u8);
  1474. q10u16 = vmull_u8(d24u8, d3u8);
  1475. q3s16 = vreinterpretq_s16_u16(q3u16);
  1476. q4s16 = vreinterpretq_s16_u16(q4u16);
  1477. q5s16 = vreinterpretq_s16_u16(q5u16);
  1478. q6s16 = vreinterpretq_s16_u16(q6u16);
  1479. q7s16 = vreinterpretq_s16_u16(q7u16);
  1480. q8s16 = vreinterpretq_s16_u16(q8u16);
  1481. q9s16 = vreinterpretq_s16_u16(q9u16);
  1482. q10s16 = vreinterpretq_s16_u16(q10u16);
  1483. q7s16 = vqaddq_s16(q7s16, q3s16);
  1484. q8s16 = vqaddq_s16(q8s16, q4s16);
  1485. q9s16 = vqaddq_s16(q9s16, q5s16);
  1486. q10s16 = vqaddq_s16(q10s16, q6s16);
  1487. d6u8 = vqrshrun_n_s16(q7s16, 7);
  1488. d7u8 = vqrshrun_n_s16(q8s16, 7);
  1489. d8u8 = vqrshrun_n_s16(q9s16, 7);
  1490. d9u8 = vqrshrun_n_s16(q10s16, 7);
  1491. d18u8 = d22u8;
  1492. d19u8 = d23u8;
  1493. d20u8 = d24u8;
  1494. d21u8 = d25u8;
  1495. d22u8 = d26u8;
  1496. vst1_u8(dst, d6u8);
  1497. dst += dst_pitch;
  1498. vst1_u8(dst, d7u8);
  1499. dst += dst_pitch;
  1500. vst1_u8(dst, d8u8);
  1501. dst += dst_pitch;
  1502. vst1_u8(dst, d9u8);
  1503. dst += dst_pitch;
  1504. }
  1505. }
  1506. return;
  1507. }