12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512 |
- /*
- * Copyright 2016 The LibYuv Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
- #include <string.h>
- #include "libyuv/row.h"
- // This module is for GCC MSA
- #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
- #include "libyuv/macros_msa.h"
- #ifdef __cplusplus
- namespace libyuv {
- extern "C" {
- #endif
- #define ALPHA_VAL (-1)
- // Fill YUV -> RGB conversion constants into vectors
- #define YUVTORGB_SETUP(yuvconst, ub, vr, ug, vg, bb, bg, br, yg) \
- { \
- ub = __msa_fill_w(yuvconst->kUVToB[0]); \
- vr = __msa_fill_w(yuvconst->kUVToR[1]); \
- ug = __msa_fill_w(yuvconst->kUVToG[0]); \
- vg = __msa_fill_w(yuvconst->kUVToG[1]); \
- bb = __msa_fill_w(yuvconst->kUVBiasB[0]); \
- bg = __msa_fill_w(yuvconst->kUVBiasG[0]); \
- br = __msa_fill_w(yuvconst->kUVBiasR[0]); \
- yg = __msa_fill_w(yuvconst->kYToRgb[0]); \
- }
- // Load YUV 422 pixel data
- #define READYUV422(psrc_y, psrc_u, psrc_v, out_y, out_u, out_v) \
- { \
- uint64_t y_m; \
- uint32_t u_m, v_m; \
- v4i32 zero_m = {0}; \
- y_m = LD(psrc_y); \
- u_m = LW(psrc_u); \
- v_m = LW(psrc_v); \
- out_y = (v16u8)__msa_insert_d((v2i64)zero_m, 0, (int64_t)y_m); \
- out_u = (v16u8)__msa_insert_w(zero_m, 0, (int32_t)u_m); \
- out_v = (v16u8)__msa_insert_w(zero_m, 0, (int32_t)v_m); \
- }
- // Clip input vector elements between 0 to 255
- #define CLIP_0TO255(in0, in1, in2, in3, in4, in5) \
- { \
- v4i32 max_m = __msa_ldi_w(0xFF); \
- \
- in0 = __msa_maxi_s_w(in0, 0); \
- in1 = __msa_maxi_s_w(in1, 0); \
- in2 = __msa_maxi_s_w(in2, 0); \
- in3 = __msa_maxi_s_w(in3, 0); \
- in4 = __msa_maxi_s_w(in4, 0); \
- in5 = __msa_maxi_s_w(in5, 0); \
- in0 = __msa_min_s_w(max_m, in0); \
- in1 = __msa_min_s_w(max_m, in1); \
- in2 = __msa_min_s_w(max_m, in2); \
- in3 = __msa_min_s_w(max_m, in3); \
- in4 = __msa_min_s_w(max_m, in4); \
- in5 = __msa_min_s_w(max_m, in5); \
- }
- // Convert 8 pixels of YUV 420 to RGB.
- #define YUVTORGB(in_y, in_uv, ubvr, ugvg, bb, bg, br, yg, out_b, out_g, out_r) \
- { \
- v8i16 vec0_m, vec1_m; \
- v4i32 reg0_m, reg1_m, reg2_m, reg3_m, reg4_m; \
- v4i32 reg5_m, reg6_m, reg7_m; \
- v16i8 zero_m = {0}; \
- \
- vec0_m = (v8i16)__msa_ilvr_b((v16i8)in_y, (v16i8)in_y); \
- vec1_m = (v8i16)__msa_ilvr_b((v16i8)zero_m, (v16i8)in_uv); \
- reg0_m = (v4i32)__msa_ilvr_h((v8i16)zero_m, (v8i16)vec0_m); \
- reg1_m = (v4i32)__msa_ilvl_h((v8i16)zero_m, (v8i16)vec0_m); \
- reg2_m = (v4i32)__msa_ilvr_h((v8i16)zero_m, (v8i16)vec1_m); \
- reg3_m = (v4i32)__msa_ilvl_h((v8i16)zero_m, (v8i16)vec1_m); \
- reg0_m *= yg; \
- reg1_m *= yg; \
- reg2_m *= ubvr; \
- reg3_m *= ubvr; \
- reg0_m = __msa_srai_w(reg0_m, 16); \
- reg1_m = __msa_srai_w(reg1_m, 16); \
- reg4_m = __msa_dotp_s_w((v8i16)vec1_m, (v8i16)ugvg); \
- reg5_m = __msa_ilvev_w(reg2_m, reg2_m); \
- reg6_m = __msa_ilvev_w(reg3_m, reg3_m); \
- reg7_m = __msa_ilvr_w(reg4_m, reg4_m); \
- reg2_m = __msa_ilvod_w(reg2_m, reg2_m); \
- reg3_m = __msa_ilvod_w(reg3_m, reg3_m); \
- reg4_m = __msa_ilvl_w(reg4_m, reg4_m); \
- reg5_m = reg0_m - reg5_m; \
- reg6_m = reg1_m - reg6_m; \
- reg2_m = reg0_m - reg2_m; \
- reg3_m = reg1_m - reg3_m; \
- reg7_m = reg0_m - reg7_m; \
- reg4_m = reg1_m - reg4_m; \
- reg5_m += bb; \
- reg6_m += bb; \
- reg7_m += bg; \
- reg4_m += bg; \
- reg2_m += br; \
- reg3_m += br; \
- reg5_m = __msa_srai_w(reg5_m, 6); \
- reg6_m = __msa_srai_w(reg6_m, 6); \
- reg7_m = __msa_srai_w(reg7_m, 6); \
- reg4_m = __msa_srai_w(reg4_m, 6); \
- reg2_m = __msa_srai_w(reg2_m, 6); \
- reg3_m = __msa_srai_w(reg3_m, 6); \
- CLIP_0TO255(reg5_m, reg6_m, reg7_m, reg4_m, reg2_m, reg3_m); \
- out_b = __msa_pckev_h((v8i16)reg6_m, (v8i16)reg5_m); \
- out_g = __msa_pckev_h((v8i16)reg4_m, (v8i16)reg7_m); \
- out_r = __msa_pckev_h((v8i16)reg3_m, (v8i16)reg2_m); \
- }
- // Pack and Store 8 ARGB values.
- #define STOREARGB(in0, in1, in2, in3, pdst_argb) \
- { \
- v8i16 vec0_m, vec1_m; \
- v16u8 dst0_m, dst1_m; \
- vec0_m = (v8i16)__msa_ilvev_b((v16i8)in1, (v16i8)in0); \
- vec1_m = (v8i16)__msa_ilvev_b((v16i8)in3, (v16i8)in2); \
- dst0_m = (v16u8)__msa_ilvr_h(vec1_m, vec0_m); \
- dst1_m = (v16u8)__msa_ilvl_h(vec1_m, vec0_m); \
- ST_UB2(dst0_m, dst1_m, pdst_argb, 16); \
- }
- // Takes ARGB input and calculates Y.
- #define ARGBTOY(argb0, argb1, argb2, argb3, const0, const1, const2, shift, \
- y_out) \
- { \
- v16u8 vec0_m, vec1_m, vec2_m, vec3_m; \
- v8u16 reg0_m, reg1_m; \
- \
- vec0_m = (v16u8)__msa_pckev_h((v8i16)argb1, (v8i16)argb0); \
- vec1_m = (v16u8)__msa_pckev_h((v8i16)argb3, (v8i16)argb2); \
- vec2_m = (v16u8)__msa_pckod_h((v8i16)argb1, (v8i16)argb0); \
- vec3_m = (v16u8)__msa_pckod_h((v8i16)argb3, (v8i16)argb2); \
- reg0_m = __msa_dotp_u_h(vec0_m, const0); \
- reg1_m = __msa_dotp_u_h(vec1_m, const0); \
- reg0_m = __msa_dpadd_u_h(reg0_m, vec2_m, const1); \
- reg1_m = __msa_dpadd_u_h(reg1_m, vec3_m, const1); \
- reg0_m += const2; \
- reg1_m += const2; \
- reg0_m = (v8u16)__msa_srai_h((v8i16)reg0_m, shift); \
- reg1_m = (v8u16)__msa_srai_h((v8i16)reg1_m, shift); \
- y_out = (v16u8)__msa_pckev_b((v16i8)reg1_m, (v16i8)reg0_m); \
- }
- // Loads current and next row of ARGB input and averages it to calculate U and V
- #define READ_ARGB(s_ptr, t_ptr, argb0, argb1, argb2, argb3) \
- { \
- v16u8 src0_m, src1_m, src2_m, src3_m, src4_m, src5_m, src6_m, src7_m; \
- v16u8 vec0_m, vec1_m, vec2_m, vec3_m, vec4_m, vec5_m, vec6_m, vec7_m; \
- v16u8 vec8_m, vec9_m; \
- v8u16 reg0_m, reg1_m, reg2_m, reg3_m, reg4_m, reg5_m, reg6_m, reg7_m; \
- v8u16 reg8_m, reg9_m; \
- \
- src0_m = (v16u8)__msa_ld_b((v16i8*)s, 0); \
- src1_m = (v16u8)__msa_ld_b((v16i8*)s, 16); \
- src2_m = (v16u8)__msa_ld_b((v16i8*)s, 32); \
- src3_m = (v16u8)__msa_ld_b((v16i8*)s, 48); \
- src4_m = (v16u8)__msa_ld_b((v16i8*)t, 0); \
- src5_m = (v16u8)__msa_ld_b((v16i8*)t, 16); \
- src6_m = (v16u8)__msa_ld_b((v16i8*)t, 32); \
- src7_m = (v16u8)__msa_ld_b((v16i8*)t, 48); \
- vec0_m = (v16u8)__msa_ilvr_b((v16i8)src0_m, (v16i8)src4_m); \
- vec1_m = (v16u8)__msa_ilvr_b((v16i8)src1_m, (v16i8)src5_m); \
- vec2_m = (v16u8)__msa_ilvr_b((v16i8)src2_m, (v16i8)src6_m); \
- vec3_m = (v16u8)__msa_ilvr_b((v16i8)src3_m, (v16i8)src7_m); \
- vec4_m = (v16u8)__msa_ilvl_b((v16i8)src0_m, (v16i8)src4_m); \
- vec5_m = (v16u8)__msa_ilvl_b((v16i8)src1_m, (v16i8)src5_m); \
- vec6_m = (v16u8)__msa_ilvl_b((v16i8)src2_m, (v16i8)src6_m); \
- vec7_m = (v16u8)__msa_ilvl_b((v16i8)src3_m, (v16i8)src7_m); \
- reg0_m = __msa_hadd_u_h(vec0_m, vec0_m); \
- reg1_m = __msa_hadd_u_h(vec1_m, vec1_m); \
- reg2_m = __msa_hadd_u_h(vec2_m, vec2_m); \
- reg3_m = __msa_hadd_u_h(vec3_m, vec3_m); \
- reg4_m = __msa_hadd_u_h(vec4_m, vec4_m); \
- reg5_m = __msa_hadd_u_h(vec5_m, vec5_m); \
- reg6_m = __msa_hadd_u_h(vec6_m, vec6_m); \
- reg7_m = __msa_hadd_u_h(vec7_m, vec7_m); \
- reg8_m = (v8u16)__msa_pckev_d((v2i64)reg4_m, (v2i64)reg0_m); \
- reg9_m = (v8u16)__msa_pckev_d((v2i64)reg5_m, (v2i64)reg1_m); \
- reg8_m += (v8u16)__msa_pckod_d((v2i64)reg4_m, (v2i64)reg0_m); \
- reg9_m += (v8u16)__msa_pckod_d((v2i64)reg5_m, (v2i64)reg1_m); \
- reg0_m = (v8u16)__msa_pckev_d((v2i64)reg6_m, (v2i64)reg2_m); \
- reg1_m = (v8u16)__msa_pckev_d((v2i64)reg7_m, (v2i64)reg3_m); \
- reg0_m += (v8u16)__msa_pckod_d((v2i64)reg6_m, (v2i64)reg2_m); \
- reg1_m += (v8u16)__msa_pckod_d((v2i64)reg7_m, (v2i64)reg3_m); \
- reg8_m = (v8u16)__msa_srai_h((v8i16)reg8_m, 2); \
- reg9_m = (v8u16)__msa_srai_h((v8i16)reg9_m, 2); \
- reg0_m = (v8u16)__msa_srai_h((v8i16)reg0_m, 2); \
- reg1_m = (v8u16)__msa_srai_h((v8i16)reg1_m, 2); \
- argb0 = (v16u8)__msa_pckev_b((v16i8)reg9_m, (v16i8)reg8_m); \
- argb1 = (v16u8)__msa_pckev_b((v16i8)reg1_m, (v16i8)reg0_m); \
- src0_m = (v16u8)__msa_ld_b((v16i8*)s, 64); \
- src1_m = (v16u8)__msa_ld_b((v16i8*)s, 80); \
- src2_m = (v16u8)__msa_ld_b((v16i8*)s, 96); \
- src3_m = (v16u8)__msa_ld_b((v16i8*)s, 112); \
- src4_m = (v16u8)__msa_ld_b((v16i8*)t, 64); \
- src5_m = (v16u8)__msa_ld_b((v16i8*)t, 80); \
- src6_m = (v16u8)__msa_ld_b((v16i8*)t, 96); \
- src7_m = (v16u8)__msa_ld_b((v16i8*)t, 112); \
- vec2_m = (v16u8)__msa_ilvr_b((v16i8)src0_m, (v16i8)src4_m); \
- vec3_m = (v16u8)__msa_ilvr_b((v16i8)src1_m, (v16i8)src5_m); \
- vec4_m = (v16u8)__msa_ilvr_b((v16i8)src2_m, (v16i8)src6_m); \
- vec5_m = (v16u8)__msa_ilvr_b((v16i8)src3_m, (v16i8)src7_m); \
- vec6_m = (v16u8)__msa_ilvl_b((v16i8)src0_m, (v16i8)src4_m); \
- vec7_m = (v16u8)__msa_ilvl_b((v16i8)src1_m, (v16i8)src5_m); \
- vec8_m = (v16u8)__msa_ilvl_b((v16i8)src2_m, (v16i8)src6_m); \
- vec9_m = (v16u8)__msa_ilvl_b((v16i8)src3_m, (v16i8)src7_m); \
- reg0_m = __msa_hadd_u_h(vec2_m, vec2_m); \
- reg1_m = __msa_hadd_u_h(vec3_m, vec3_m); \
- reg2_m = __msa_hadd_u_h(vec4_m, vec4_m); \
- reg3_m = __msa_hadd_u_h(vec5_m, vec5_m); \
- reg4_m = __msa_hadd_u_h(vec6_m, vec6_m); \
- reg5_m = __msa_hadd_u_h(vec7_m, vec7_m); \
- reg6_m = __msa_hadd_u_h(vec8_m, vec8_m); \
- reg7_m = __msa_hadd_u_h(vec9_m, vec9_m); \
- reg8_m = (v8u16)__msa_pckev_d((v2i64)reg4_m, (v2i64)reg0_m); \
- reg9_m = (v8u16)__msa_pckev_d((v2i64)reg5_m, (v2i64)reg1_m); \
- reg8_m += (v8u16)__msa_pckod_d((v2i64)reg4_m, (v2i64)reg0_m); \
- reg9_m += (v8u16)__msa_pckod_d((v2i64)reg5_m, (v2i64)reg1_m); \
- reg0_m = (v8u16)__msa_pckev_d((v2i64)reg6_m, (v2i64)reg2_m); \
- reg1_m = (v8u16)__msa_pckev_d((v2i64)reg7_m, (v2i64)reg3_m); \
- reg0_m += (v8u16)__msa_pckod_d((v2i64)reg6_m, (v2i64)reg2_m); \
- reg1_m += (v8u16)__msa_pckod_d((v2i64)reg7_m, (v2i64)reg3_m); \
- reg8_m = (v8u16)__msa_srai_h((v8i16)reg8_m, 2); \
- reg9_m = (v8u16)__msa_srai_h((v8i16)reg9_m, 2); \
- reg0_m = (v8u16)__msa_srai_h((v8i16)reg0_m, 2); \
- reg1_m = (v8u16)__msa_srai_h((v8i16)reg1_m, 2); \
- argb2 = (v16u8)__msa_pckev_b((v16i8)reg9_m, (v16i8)reg8_m); \
- argb3 = (v16u8)__msa_pckev_b((v16i8)reg1_m, (v16i8)reg0_m); \
- }
- // Takes ARGB input and calculates U and V.
- #define ARGBTOUV(argb0, argb1, argb2, argb3, const0, const1, const2, const3, \
- shf0, shf1, shf2, shf3, v_out, u_out) \
- { \
- v16u8 vec0_m, vec1_m, vec2_m, vec3_m, vec4_m, vec5_m, vec6_m, vec7_m; \
- v8u16 reg0_m, reg1_m, reg2_m, reg3_m; \
- \
- vec0_m = (v16u8)__msa_vshf_b(shf0, (v16i8)argb1, (v16i8)argb0); \
- vec1_m = (v16u8)__msa_vshf_b(shf0, (v16i8)argb3, (v16i8)argb2); \
- vec2_m = (v16u8)__msa_vshf_b(shf1, (v16i8)argb1, (v16i8)argb0); \
- vec3_m = (v16u8)__msa_vshf_b(shf1, (v16i8)argb3, (v16i8)argb2); \
- vec4_m = (v16u8)__msa_vshf_b(shf2, (v16i8)argb1, (v16i8)argb0); \
- vec5_m = (v16u8)__msa_vshf_b(shf2, (v16i8)argb3, (v16i8)argb2); \
- vec6_m = (v16u8)__msa_vshf_b(shf3, (v16i8)argb1, (v16i8)argb0); \
- vec7_m = (v16u8)__msa_vshf_b(shf3, (v16i8)argb3, (v16i8)argb2); \
- reg0_m = __msa_dotp_u_h(vec0_m, const1); \
- reg1_m = __msa_dotp_u_h(vec1_m, const1); \
- reg2_m = __msa_dotp_u_h(vec4_m, const1); \
- reg3_m = __msa_dotp_u_h(vec5_m, const1); \
- reg0_m += const3; \
- reg1_m += const3; \
- reg2_m += const3; \
- reg3_m += const3; \
- reg0_m -= __msa_dotp_u_h(vec2_m, const0); \
- reg1_m -= __msa_dotp_u_h(vec3_m, const0); \
- reg2_m -= __msa_dotp_u_h(vec6_m, const2); \
- reg3_m -= __msa_dotp_u_h(vec7_m, const2); \
- v_out = (v16u8)__msa_pckod_b((v16i8)reg1_m, (v16i8)reg0_m); \
- u_out = (v16u8)__msa_pckod_b((v16i8)reg3_m, (v16i8)reg2_m); \
- }
- // Load I444 pixel data
- #define READI444(psrc_y, psrc_u, psrc_v, out_y, out_u, out_v) \
- { \
- uint64_t y_m, u_m, v_m; \
- v2i64 zero_m = {0}; \
- y_m = LD(psrc_y); \
- u_m = LD(psrc_u); \
- v_m = LD(psrc_v); \
- out_y = (v16u8)__msa_insert_d(zero_m, 0, (int64_t)y_m); \
- out_u = (v16u8)__msa_insert_d(zero_m, 0, (int64_t)u_m); \
- out_v = (v16u8)__msa_insert_d(zero_m, 0, (int64_t)v_m); \
- }
- void MirrorRow_MSA(const uint8_t* src, uint8_t* dst, int width) {
- int x;
- v16u8 src0, src1, src2, src3;
- v16u8 dst0, dst1, dst2, dst3;
- v16i8 shuffler = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- src += width - 64;
- for (x = 0; x < width; x += 64) {
- LD_UB4(src, 16, src3, src2, src1, src0);
- VSHF_B2_UB(src3, src3, src2, src2, shuffler, shuffler, dst3, dst2);
- VSHF_B2_UB(src1, src1, src0, src0, shuffler, shuffler, dst1, dst0);
- ST_UB4(dst0, dst1, dst2, dst3, dst, 16);
- dst += 64;
- src -= 64;
- }
- }
- void ARGBMirrorRow_MSA(const uint8_t* src, uint8_t* dst, int width) {
- int x;
- v16u8 src0, src1, src2, src3;
- v16u8 dst0, dst1, dst2, dst3;
- v16i8 shuffler = {12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3};
- src += width * 4 - 64;
- for (x = 0; x < width; x += 16) {
- LD_UB4(src, 16, src3, src2, src1, src0);
- VSHF_B2_UB(src3, src3, src2, src2, shuffler, shuffler, dst3, dst2);
- VSHF_B2_UB(src1, src1, src0, src0, shuffler, shuffler, dst1, dst0);
- ST_UB4(dst0, dst1, dst2, dst3, dst, 16);
- dst += 64;
- src -= 64;
- }
- }
- void I422ToYUY2Row_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_yuy2,
- int width) {
- int x;
- v16u8 src_u0, src_v0, src_y0, src_y1, vec_uv0, vec_uv1;
- v16u8 dst_yuy2_0, dst_yuy2_1, dst_yuy2_2, dst_yuy2_3;
- for (x = 0; x < width; x += 32) {
- src_u0 = LD_UB(src_u);
- src_v0 = LD_UB(src_v);
- LD_UB2(src_y, 16, src_y0, src_y1);
- ILVRL_B2_UB(src_v0, src_u0, vec_uv0, vec_uv1);
- ILVRL_B2_UB(vec_uv0, src_y0, dst_yuy2_0, dst_yuy2_1);
- ILVRL_B2_UB(vec_uv1, src_y1, dst_yuy2_2, dst_yuy2_3);
- ST_UB4(dst_yuy2_0, dst_yuy2_1, dst_yuy2_2, dst_yuy2_3, dst_yuy2, 16);
- src_u += 16;
- src_v += 16;
- src_y += 32;
- dst_yuy2 += 64;
- }
- }
- void I422ToUYVYRow_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_uyvy,
- int width) {
- int x;
- v16u8 src_u0, src_v0, src_y0, src_y1, vec_uv0, vec_uv1;
- v16u8 dst_uyvy0, dst_uyvy1, dst_uyvy2, dst_uyvy3;
- for (x = 0; x < width; x += 32) {
- src_u0 = LD_UB(src_u);
- src_v0 = LD_UB(src_v);
- LD_UB2(src_y, 16, src_y0, src_y1);
- ILVRL_B2_UB(src_v0, src_u0, vec_uv0, vec_uv1);
- ILVRL_B2_UB(src_y0, vec_uv0, dst_uyvy0, dst_uyvy1);
- ILVRL_B2_UB(src_y1, vec_uv1, dst_uyvy2, dst_uyvy3);
- ST_UB4(dst_uyvy0, dst_uyvy1, dst_uyvy2, dst_uyvy3, dst_uyvy, 16);
- src_u += 16;
- src_v += 16;
- src_y += 32;
- dst_uyvy += 64;
- }
- }
- void I422ToARGBRow_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- dst_argb += 32;
- }
- }
- void I422ToRGBARow_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- STOREARGB(alpha, vec0, vec1, vec2, dst_argb);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- dst_argb += 32;
- }
- }
- void I422AlphaToARGBRow_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- const uint8_t* src_a,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- int64_t data_a;
- v16u8 src0, src1, src2, src3;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v4i32 zero = {0};
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- data_a = LD(src_a);
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- src3 = (v16u8)__msa_insert_d((v2i64)zero, 0, data_a);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- src3 = (v16u8)__msa_ilvr_b((v16i8)src3, (v16i8)src3);
- STOREARGB(vec0, vec1, vec2, src3, dst_argb);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- src_a += 8;
- dst_argb += 32;
- }
- }
- void I422ToRGB24Row_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int32_t width) {
- int x;
- int64_t data_u, data_v;
- v16u8 src0, src1, src2, src3, src4, dst0, dst1, dst2;
- v8i16 vec0, vec1, vec2, vec3, vec4, vec5;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 reg0, reg1, reg2, reg3;
- v2i64 zero = {0};
- v16i8 shuffler0 = {0, 1, 16, 2, 3, 17, 4, 5, 18, 6, 7, 19, 8, 9, 20, 10};
- v16i8 shuffler1 = {0, 21, 1, 2, 22, 3, 4, 23, 5, 6, 24, 7, 8, 25, 9, 10};
- v16i8 shuffler2 = {26, 6, 7, 27, 8, 9, 28, 10,
- 11, 29, 12, 13, 30, 14, 15, 31};
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((v16u8*)src_y, 0);
- data_u = LD(src_u);
- data_v = LD(src_v);
- src1 = (v16u8)__msa_insert_d(zero, 0, data_u);
- src2 = (v16u8)__msa_insert_d(zero, 0, data_v);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- src3 = (v16u8)__msa_sldi_b((v16i8)src0, (v16i8)src0, 8);
- src4 = (v16u8)__msa_sldi_b((v16i8)src1, (v16i8)src1, 8);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- YUVTORGB(src3, src4, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec3, vec4, vec5);
- reg0 = (v16u8)__msa_ilvev_b((v16i8)vec1, (v16i8)vec0);
- reg2 = (v16u8)__msa_ilvev_b((v16i8)vec4, (v16i8)vec3);
- reg3 = (v16u8)__msa_pckev_b((v16i8)vec5, (v16i8)vec2);
- reg1 = (v16u8)__msa_sldi_b((v16i8)reg2, (v16i8)reg0, 11);
- dst0 = (v16u8)__msa_vshf_b(shuffler0, (v16i8)reg3, (v16i8)reg0);
- dst1 = (v16u8)__msa_vshf_b(shuffler1, (v16i8)reg3, (v16i8)reg1);
- dst2 = (v16u8)__msa_vshf_b(shuffler2, (v16i8)reg3, (v16i8)reg2);
- ST_UB2(dst0, dst1, dst_argb, 16);
- ST_UB(dst2, (dst_argb + 32));
- src_y += 16;
- src_u += 8;
- src_v += 8;
- dst_argb += 48;
- }
- }
- // TODO(fbarchard): Consider AND instead of shift to isolate 5 upper bits of R.
- void I422ToRGB565Row_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_rgb565,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2, dst0;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec2, vec1);
- vec0 = __msa_srai_h(vec0, 3);
- vec1 = __msa_srai_h(vec1, 3);
- vec2 = __msa_srai_h(vec2, 2);
- vec1 = __msa_slli_h(vec1, 11);
- vec2 = __msa_slli_h(vec2, 5);
- vec0 |= vec1;
- dst0 = (v16u8)(vec2 | vec0);
- ST_UB(dst0, dst_rgb565);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- dst_rgb565 += 16;
- }
- }
- // TODO(fbarchard): Consider AND instead of shift to isolate 4 upper bits of G.
- void I422ToARGB4444Row_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb4444,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2, dst0;
- v8i16 vec0, vec1, vec2;
- v8u16 reg0, reg1, reg2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v8u16 const_0xF000 = (v8u16)__msa_fill_h(0xF000);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- reg0 = (v8u16)__msa_srai_h(vec0, 4);
- reg1 = (v8u16)__msa_srai_h(vec1, 4);
- reg2 = (v8u16)__msa_srai_h(vec2, 4);
- reg1 = (v8u16)__msa_slli_h((v8i16)reg1, 4);
- reg2 = (v8u16)__msa_slli_h((v8i16)reg2, 8);
- reg1 |= const_0xF000;
- reg0 |= reg2;
- dst0 = (v16u8)(reg1 | reg0);
- ST_UB(dst0, dst_argb4444);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- dst_argb4444 += 16;
- }
- }
- void I422ToARGB1555Row_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb1555,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2, dst0;
- v8i16 vec0, vec1, vec2;
- v8u16 reg0, reg1, reg2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v8u16 const_0x8000 = (v8u16)__msa_fill_h(0x8000);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- READYUV422(src_y, src_u, src_v, src0, src1, src2);
- src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- reg0 = (v8u16)__msa_srai_h(vec0, 3);
- reg1 = (v8u16)__msa_srai_h(vec1, 3);
- reg2 = (v8u16)__msa_srai_h(vec2, 3);
- reg1 = (v8u16)__msa_slli_h((v8i16)reg1, 5);
- reg2 = (v8u16)__msa_slli_h((v8i16)reg2, 10);
- reg1 |= const_0x8000;
- reg0 |= reg2;
- dst0 = (v16u8)(reg1 | reg0);
- ST_UB(dst0, dst_argb1555);
- src_y += 8;
- src_u += 4;
- src_v += 4;
- dst_argb1555 += 16;
- }
- }
- void YUY2ToYRow_MSA(const uint8_t* src_yuy2, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_yuy2, 16, src0, src1, src2, src3);
- dst0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_y, 16);
- src_yuy2 += 64;
- dst_y += 32;
- }
- }
- void YUY2ToUVRow_MSA(const uint8_t* src_yuy2,
- int src_stride_yuy2,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- const uint8_t* src_yuy2_next = src_yuy2 + src_stride_yuy2;
- int x;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v16u8 vec0, vec1, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_yuy2, 16, src0, src1, src2, src3);
- LD_UB4(src_yuy2_next, 16, src4, src5, src6, src7);
- src0 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- src1 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- src2 = (v16u8)__msa_pckod_b((v16i8)src5, (v16i8)src4);
- src3 = (v16u8)__msa_pckod_b((v16i8)src7, (v16i8)src6);
- vec0 = __msa_aver_u_b(src0, src2);
- vec1 = __msa_aver_u_b(src1, src3);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_yuy2 += 64;
- src_yuy2_next += 64;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void YUY2ToUV422Row_MSA(const uint8_t* src_yuy2,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_yuy2, 16, src0, src1, src2, src3);
- src0 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- src1 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- dst0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_yuy2 += 64;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void UYVYToYRow_MSA(const uint8_t* src_uyvy, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_uyvy, 16, src0, src1, src2, src3);
- dst0 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_y, 16);
- src_uyvy += 64;
- dst_y += 32;
- }
- }
- void UYVYToUVRow_MSA(const uint8_t* src_uyvy,
- int src_stride_uyvy,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- const uint8_t* src_uyvy_next = src_uyvy + src_stride_uyvy;
- int x;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v16u8 vec0, vec1, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_uyvy, 16, src0, src1, src2, src3);
- LD_UB4(src_uyvy_next, 16, src4, src5, src6, src7);
- src0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- src1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- src2 = (v16u8)__msa_pckev_b((v16i8)src5, (v16i8)src4);
- src3 = (v16u8)__msa_pckev_b((v16i8)src7, (v16i8)src6);
- vec0 = __msa_aver_u_b(src0, src2);
- vec1 = __msa_aver_u_b(src1, src3);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_uyvy += 64;
- src_uyvy_next += 64;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void UYVYToUV422Row_MSA(const uint8_t* src_uyvy,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- LD_UB4(src_uyvy, 16, src0, src1, src2, src3);
- src0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- src1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- dst0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_uyvy += 64;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void ARGBToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, vec0, vec1, vec2, vec3, dst0;
- v8u16 reg0, reg1, reg2, reg3, reg4, reg5;
- v16i8 zero = {0};
- v8u16 const_0x19 = (v8u16)__msa_ldi_h(0x19);
- v8u16 const_0x81 = (v8u16)__msa_ldi_h(0x81);
- v8u16 const_0x42 = (v8u16)__msa_ldi_h(0x42);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 48);
- vec0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- vec1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- vec2 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- vec3 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- reg0 = (v8u16)__msa_ilvev_b(zero, (v16i8)vec0);
- reg1 = (v8u16)__msa_ilvev_b(zero, (v16i8)vec1);
- reg2 = (v8u16)__msa_ilvev_b(zero, (v16i8)vec2);
- reg3 = (v8u16)__msa_ilvev_b(zero, (v16i8)vec3);
- reg4 = (v8u16)__msa_ilvod_b(zero, (v16i8)vec0);
- reg5 = (v8u16)__msa_ilvod_b(zero, (v16i8)vec1);
- reg0 *= const_0x19;
- reg1 *= const_0x19;
- reg2 *= const_0x81;
- reg3 *= const_0x81;
- reg4 *= const_0x42;
- reg5 *= const_0x42;
- reg0 += reg2;
- reg1 += reg3;
- reg0 += reg4;
- reg1 += reg5;
- reg0 += const_0x1080;
- reg1 += const_0x1080;
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 8);
- reg1 = (v8u16)__msa_srai_h((v8i16)reg1, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg1, (v16i8)reg0);
- ST_UB(dst0, dst_y);
- src_argb0 += 64;
- dst_y += 16;
- }
- }
- void ARGBToUVRow_MSA(const uint8_t* src_argb0,
- int src_stride_argb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* src_argb0_next = src_argb0 + src_stride_argb;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9;
- v8u16 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg8, reg9;
- v16u8 dst0, dst1;
- v8u16 const_0x70 = (v8u16)__msa_ldi_h(0x70);
- v8u16 const_0x4A = (v8u16)__msa_ldi_h(0x4A);
- v8u16 const_0x26 = (v8u16)__msa_ldi_h(0x26);
- v8u16 const_0x5E = (v8u16)__msa_ldi_h(0x5E);
- v8u16 const_0x12 = (v8u16)__msa_ldi_h(0x12);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 48);
- src4 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 64);
- src5 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 80);
- src6 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 96);
- src7 = (v16u8)__msa_ld_b((v16u8*)src_argb0, 112);
- vec0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- vec1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- vec2 = (v16u8)__msa_pckev_b((v16i8)src5, (v16i8)src4);
- vec3 = (v16u8)__msa_pckev_b((v16i8)src7, (v16i8)src6);
- vec4 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- vec5 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- vec6 = (v16u8)__msa_pckod_b((v16i8)src5, (v16i8)src4);
- vec7 = (v16u8)__msa_pckod_b((v16i8)src7, (v16i8)src6);
- vec8 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- vec9 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- vec4 = (v16u8)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- vec5 = (v16u8)__msa_pckev_b((v16i8)vec7, (v16i8)vec6);
- vec0 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec0);
- vec1 = (v16u8)__msa_pckod_b((v16i8)vec3, (v16i8)vec2);
- reg0 = __msa_hadd_u_h(vec8, vec8);
- reg1 = __msa_hadd_u_h(vec9, vec9);
- reg2 = __msa_hadd_u_h(vec4, vec4);
- reg3 = __msa_hadd_u_h(vec5, vec5);
- reg4 = __msa_hadd_u_h(vec0, vec0);
- reg5 = __msa_hadd_u_h(vec1, vec1);
- src0 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 0);
- src1 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 16);
- src2 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 32);
- src3 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 48);
- src4 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 64);
- src5 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 80);
- src6 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 96);
- src7 = (v16u8)__msa_ld_b((v16u8*)src_argb0_next, 112);
- vec0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- vec1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- vec2 = (v16u8)__msa_pckev_b((v16i8)src5, (v16i8)src4);
- vec3 = (v16u8)__msa_pckev_b((v16i8)src7, (v16i8)src6);
- vec4 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- vec5 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- vec6 = (v16u8)__msa_pckod_b((v16i8)src5, (v16i8)src4);
- vec7 = (v16u8)__msa_pckod_b((v16i8)src7, (v16i8)src6);
- vec8 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- vec9 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- vec4 = (v16u8)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- vec5 = (v16u8)__msa_pckev_b((v16i8)vec7, (v16i8)vec6);
- vec0 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec0);
- vec1 = (v16u8)__msa_pckod_b((v16i8)vec3, (v16i8)vec2);
- reg0 += __msa_hadd_u_h(vec8, vec8);
- reg1 += __msa_hadd_u_h(vec9, vec9);
- reg2 += __msa_hadd_u_h(vec4, vec4);
- reg3 += __msa_hadd_u_h(vec5, vec5);
- reg4 += __msa_hadd_u_h(vec0, vec0);
- reg5 += __msa_hadd_u_h(vec1, vec1);
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 2);
- reg1 = (v8u16)__msa_srai_h((v8i16)reg1, 2);
- reg2 = (v8u16)__msa_srai_h((v8i16)reg2, 2);
- reg3 = (v8u16)__msa_srai_h((v8i16)reg3, 2);
- reg4 = (v8u16)__msa_srai_h((v8i16)reg4, 2);
- reg5 = (v8u16)__msa_srai_h((v8i16)reg5, 2);
- reg6 = reg0 * const_0x70;
- reg7 = reg1 * const_0x70;
- reg8 = reg2 * const_0x4A;
- reg9 = reg3 * const_0x4A;
- reg6 += const_0x8080;
- reg7 += const_0x8080;
- reg8 += reg4 * const_0x26;
- reg9 += reg5 * const_0x26;
- reg0 *= const_0x12;
- reg1 *= const_0x12;
- reg2 *= const_0x5E;
- reg3 *= const_0x5E;
- reg4 *= const_0x70;
- reg5 *= const_0x70;
- reg2 += reg0;
- reg3 += reg1;
- reg4 += const_0x8080;
- reg5 += const_0x8080;
- reg6 -= reg8;
- reg7 -= reg9;
- reg4 -= reg2;
- reg5 -= reg3;
- reg6 = (v8u16)__msa_srai_h((v8i16)reg6, 8);
- reg7 = (v8u16)__msa_srai_h((v8i16)reg7, 8);
- reg4 = (v8u16)__msa_srai_h((v8i16)reg4, 8);
- reg5 = (v8u16)__msa_srai_h((v8i16)reg5, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg7, (v16i8)reg6);
- dst1 = (v16u8)__msa_pckev_b((v16i8)reg5, (v16i8)reg4);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_argb0 += 128;
- src_argb0_next += 128;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void ARGBToRGB24Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1, dst2;
- v16i8 shuffler0 = {0, 1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 20};
- v16i8 shuffler1 = {5, 6, 8, 9, 10, 12, 13, 14,
- 16, 17, 18, 20, 21, 22, 24, 25};
- v16i8 shuffler2 = {10, 12, 13, 14, 16, 17, 18, 20,
- 21, 22, 24, 25, 26, 28, 29, 30};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 48);
- dst0 = (v16u8)__msa_vshf_b(shuffler0, (v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(shuffler1, (v16i8)src2, (v16i8)src1);
- dst2 = (v16u8)__msa_vshf_b(shuffler2, (v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_rgb, 16);
- ST_UB(dst2, (dst_rgb + 32));
- src_argb += 64;
- dst_rgb += 48;
- }
- }
- void ARGBToRAWRow_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1, dst2;
- v16i8 shuffler0 = {2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, 18, 17, 16, 22};
- v16i8 shuffler1 = {5, 4, 10, 9, 8, 14, 13, 12,
- 18, 17, 16, 22, 21, 20, 26, 25};
- v16i8 shuffler2 = {8, 14, 13, 12, 18, 17, 16, 22,
- 21, 20, 26, 25, 24, 30, 29, 28};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 48);
- dst0 = (v16u8)__msa_vshf_b(shuffler0, (v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(shuffler1, (v16i8)src2, (v16i8)src1);
- dst2 = (v16u8)__msa_vshf_b(shuffler2, (v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_rgb, 16);
- ST_UB(dst2, (dst_rgb + 32));
- src_argb += 64;
- dst_rgb += 48;
- }
- }
- void ARGBToRGB565Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width) {
- int x;
- v16u8 src0, src1, dst0;
- v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v16i8 zero = {0};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec0 = (v16u8)__msa_srai_b((v16i8)src0, 3);
- vec1 = (v16u8)__msa_slli_b((v16i8)src0, 3);
- vec2 = (v16u8)__msa_srai_b((v16i8)src0, 5);
- vec4 = (v16u8)__msa_srai_b((v16i8)src1, 3);
- vec5 = (v16u8)__msa_slli_b((v16i8)src1, 3);
- vec6 = (v16u8)__msa_srai_b((v16i8)src1, 5);
- vec1 = (v16u8)__msa_sldi_b(zero, (v16i8)vec1, 1);
- vec2 = (v16u8)__msa_sldi_b(zero, (v16i8)vec2, 1);
- vec5 = (v16u8)__msa_sldi_b(zero, (v16i8)vec5, 1);
- vec6 = (v16u8)__msa_sldi_b(zero, (v16i8)vec6, 1);
- vec3 = (v16u8)__msa_sldi_b(zero, (v16i8)src0, 2);
- vec7 = (v16u8)__msa_sldi_b(zero, (v16i8)src1, 2);
- vec0 = __msa_binsli_b(vec0, vec1, 2);
- vec1 = __msa_binsli_b(vec2, vec3, 4);
- vec4 = __msa_binsli_b(vec4, vec5, 2);
- vec5 = __msa_binsli_b(vec6, vec7, 4);
- vec0 = (v16u8)__msa_ilvev_b((v16i8)vec1, (v16i8)vec0);
- vec4 = (v16u8)__msa_ilvev_b((v16i8)vec5, (v16i8)vec4);
- dst0 = (v16u8)__msa_pckev_h((v8i16)vec4, (v8i16)vec0);
- ST_UB(dst0, dst_rgb);
- src_argb += 32;
- dst_rgb += 16;
- }
- }
- void ARGBToARGB1555Row_MSA(const uint8_t* src_argb,
- uint8_t* dst_rgb,
- int width) {
- int x;
- v16u8 src0, src1, dst0;
- v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9;
- v16i8 zero = {0};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec0 = (v16u8)__msa_srai_b((v16i8)src0, 3);
- vec1 = (v16u8)__msa_slli_b((v16i8)src0, 2);
- vec2 = (v16u8)__msa_srai_b((v16i8)vec0, 3);
- vec1 = (v16u8)__msa_sldi_b(zero, (v16i8)vec1, 1);
- vec2 = (v16u8)__msa_sldi_b(zero, (v16i8)vec2, 1);
- vec3 = (v16u8)__msa_srai_b((v16i8)src0, 1);
- vec5 = (v16u8)__msa_srai_b((v16i8)src1, 3);
- vec6 = (v16u8)__msa_slli_b((v16i8)src1, 2);
- vec7 = (v16u8)__msa_srai_b((v16i8)vec5, 3);
- vec6 = (v16u8)__msa_sldi_b(zero, (v16i8)vec6, 1);
- vec7 = (v16u8)__msa_sldi_b(zero, (v16i8)vec7, 1);
- vec8 = (v16u8)__msa_srai_b((v16i8)src1, 1);
- vec3 = (v16u8)__msa_sldi_b(zero, (v16i8)vec3, 2);
- vec8 = (v16u8)__msa_sldi_b(zero, (v16i8)vec8, 2);
- vec4 = (v16u8)__msa_sldi_b(zero, (v16i8)src0, 3);
- vec9 = (v16u8)__msa_sldi_b(zero, (v16i8)src1, 3);
- vec0 = __msa_binsli_b(vec0, vec1, 2);
- vec5 = __msa_binsli_b(vec5, vec6, 2);
- vec1 = __msa_binsli_b(vec2, vec3, 5);
- vec6 = __msa_binsli_b(vec7, vec8, 5);
- vec1 = __msa_binsli_b(vec1, vec4, 0);
- vec6 = __msa_binsli_b(vec6, vec9, 0);
- vec0 = (v16u8)__msa_ilvev_b((v16i8)vec1, (v16i8)vec0);
- vec1 = (v16u8)__msa_ilvev_b((v16i8)vec6, (v16i8)vec5);
- dst0 = (v16u8)__msa_pckev_h((v8i16)vec1, (v8i16)vec0);
- ST_UB(dst0, dst_rgb);
- src_argb += 32;
- dst_rgb += 16;
- }
- }
- void ARGBToARGB4444Row_MSA(const uint8_t* src_argb,
- uint8_t* dst_rgb,
- int width) {
- int x;
- v16u8 src0, src1;
- v16u8 vec0, vec1;
- v16u8 dst0;
- v16i8 zero = {0};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec0 = (v16u8)__msa_srai_b((v16i8)src0, 4);
- vec1 = (v16u8)__msa_srai_b((v16i8)src1, 4);
- src0 = (v16u8)__msa_sldi_b(zero, (v16i8)src0, 1);
- src1 = (v16u8)__msa_sldi_b(zero, (v16i8)src1, 1);
- vec0 = __msa_binsli_b(vec0, src0, 3);
- vec1 = __msa_binsli_b(vec1, src1, 3);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_rgb);
- src_argb += 32;
- dst_rgb += 16;
- }
- }
- void ARGBToUV444Row_MSA(const uint8_t* src_argb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int32_t width) {
- int32_t x;
- v16u8 src0, src1, src2, src3, reg0, reg1, reg2, reg3, dst0, dst1;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v8u16 vec8, vec9, vec10, vec11;
- v8u16 const_112 = (v8u16)__msa_ldi_h(112);
- v8u16 const_74 = (v8u16)__msa_ldi_h(74);
- v8u16 const_38 = (v8u16)__msa_ldi_h(38);
- v8u16 const_94 = (v8u16)__msa_ldi_h(94);
- v8u16 const_18 = (v8u16)__msa_ldi_h(18);
- v8u16 const_32896 = (v8u16)__msa_fill_h(32896);
- v16i8 zero = {0};
- for (x = width; x > 0; x -= 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 48);
- reg0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- reg1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- reg2 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- reg3 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- src0 = (v16u8)__msa_pckev_b((v16i8)reg1, (v16i8)reg0);
- src1 = (v16u8)__msa_pckev_b((v16i8)reg3, (v16i8)reg2);
- src2 = (v16u8)__msa_pckod_b((v16i8)reg1, (v16i8)reg0);
- vec0 = (v8u16)__msa_ilvr_b(zero, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b(zero, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b(zero, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b(zero, (v16i8)src1);
- vec4 = (v8u16)__msa_ilvr_b(zero, (v16i8)src2);
- vec5 = (v8u16)__msa_ilvl_b(zero, (v16i8)src2);
- vec10 = vec0 * const_18;
- vec11 = vec1 * const_18;
- vec8 = vec2 * const_94;
- vec9 = vec3 * const_94;
- vec6 = vec4 * const_112;
- vec7 = vec5 * const_112;
- vec0 *= const_112;
- vec1 *= const_112;
- vec2 *= const_74;
- vec3 *= const_74;
- vec4 *= const_38;
- vec5 *= const_38;
- vec8 += vec10;
- vec9 += vec11;
- vec6 += const_32896;
- vec7 += const_32896;
- vec0 += const_32896;
- vec1 += const_32896;
- vec2 += vec4;
- vec3 += vec5;
- vec0 -= vec2;
- vec1 -= vec3;
- vec6 -= vec8;
- vec7 -= vec9;
- vec0 = (v8u16)__msa_srai_h((v8i16)vec0, 8);
- vec1 = (v8u16)__msa_srai_h((v8i16)vec1, 8);
- vec6 = (v8u16)__msa_srai_h((v8i16)vec6, 8);
- vec7 = (v8u16)__msa_srai_h((v8i16)vec7, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec7, (v16i8)vec6);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- src_argb += 64;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void ARGBMultiplyRow_MSA(const uint8_t* src_argb0,
- const uint8_t* src_argb1,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, dst0;
- v8u16 vec0, vec1, vec2, vec3;
- v4u32 reg0, reg1, reg2, reg3;
- v8i16 zero = {0};
- for (x = 0; x < width; x += 4) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 0);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src0, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b((v16i8)zero, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b((v16i8)zero, (v16i8)src1);
- reg0 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec0);
- reg1 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec0);
- reg2 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec1);
- reg3 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec1);
- reg0 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec2);
- reg1 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec2);
- reg2 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec3);
- reg3 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec3);
- reg0 = (v4u32)__msa_srai_w((v4i32)reg0, 16);
- reg1 = (v4u32)__msa_srai_w((v4i32)reg1, 16);
- reg2 = (v4u32)__msa_srai_w((v4i32)reg2, 16);
- reg3 = (v4u32)__msa_srai_w((v4i32)reg3, 16);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_argb);
- src_argb0 += 16;
- src_argb1 += 16;
- dst_argb += 16;
- }
- }
- void ARGBAddRow_MSA(const uint8_t* src_argb0,
- const uint8_t* src_argb1,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 16);
- dst0 = __msa_adds_u_b(src0, src2);
- dst1 = __msa_adds_u_b(src1, src3);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb0 += 32;
- src_argb1 += 32;
- dst_argb += 32;
- }
- }
- void ARGBSubtractRow_MSA(const uint8_t* src_argb0,
- const uint8_t* src_argb1,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 16);
- dst0 = __msa_subs_u_b(src0, src2);
- dst1 = __msa_subs_u_b(src1, src3);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb0 += 32;
- src_argb1 += 32;
- dst_argb += 32;
- }
- }
- void ARGBAttenuateRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, dst0, dst1;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9;
- v4u32 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
- v8i16 zero = {0};
- v16u8 mask = {0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src0, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b((v16i8)src1, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b((v16i8)src1, (v16i8)src1);
- vec4 = (v8u16)__msa_fill_h(vec0[3]);
- vec5 = (v8u16)__msa_fill_h(vec0[7]);
- vec6 = (v8u16)__msa_fill_h(vec1[3]);
- vec7 = (v8u16)__msa_fill_h(vec1[7]);
- vec4 = (v8u16)__msa_pckev_d((v2i64)vec5, (v2i64)vec4);
- vec5 = (v8u16)__msa_pckev_d((v2i64)vec7, (v2i64)vec6);
- vec6 = (v8u16)__msa_fill_h(vec2[3]);
- vec7 = (v8u16)__msa_fill_h(vec2[7]);
- vec8 = (v8u16)__msa_fill_h(vec3[3]);
- vec9 = (v8u16)__msa_fill_h(vec3[7]);
- vec6 = (v8u16)__msa_pckev_d((v2i64)vec7, (v2i64)vec6);
- vec7 = (v8u16)__msa_pckev_d((v2i64)vec9, (v2i64)vec8);
- reg0 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec4);
- reg1 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec4);
- reg2 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec5);
- reg3 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec5);
- reg4 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec6);
- reg5 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec6);
- reg6 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec7);
- reg7 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec7);
- reg0 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec0);
- reg1 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec0);
- reg2 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec1);
- reg3 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec1);
- reg4 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec2);
- reg5 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec2);
- reg6 *= (v4u32)__msa_ilvr_h(zero, (v8i16)vec3);
- reg7 *= (v4u32)__msa_ilvl_h(zero, (v8i16)vec3);
- reg0 = (v4u32)__msa_srai_w((v4i32)reg0, 24);
- reg1 = (v4u32)__msa_srai_w((v4i32)reg1, 24);
- reg2 = (v4u32)__msa_srai_w((v4i32)reg2, 24);
- reg3 = (v4u32)__msa_srai_w((v4i32)reg3, 24);
- reg4 = (v4u32)__msa_srai_w((v4i32)reg4, 24);
- reg5 = (v4u32)__msa_srai_w((v4i32)reg5, 24);
- reg6 = (v4u32)__msa_srai_w((v4i32)reg6, 24);
- reg7 = (v4u32)__msa_srai_w((v4i32)reg7, 24);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec2 = (v8u16)__msa_pckev_h((v8i16)reg5, (v8i16)reg4);
- vec3 = (v8u16)__msa_pckev_h((v8i16)reg7, (v8i16)reg6);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- dst0 = __msa_bmnz_v(dst0, src0, mask);
- dst1 = __msa_bmnz_v(dst1, src1, mask);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb += 32;
- dst_argb += 32;
- }
- }
- void ARGBToRGB565DitherRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_rgb,
- uint32_t dither4,
- int width) {
- int x;
- v16u8 src0, src1, dst0, vec0, vec1;
- v8i16 vec_d0;
- v8i16 reg0, reg1, reg2;
- v16i8 zero = {0};
- v8i16 max = __msa_ldi_h(0xFF);
- vec_d0 = (v8i16)__msa_fill_w(dither4);
- vec_d0 = (v8i16)__msa_ilvr_b(zero, (v16i8)vec_d0);
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- vec1 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- reg0 = (v8i16)__msa_ilvev_b(zero, (v16i8)vec0);
- reg1 = (v8i16)__msa_ilvev_b(zero, (v16i8)vec1);
- reg2 = (v8i16)__msa_ilvod_b(zero, (v16i8)vec0);
- reg0 += vec_d0;
- reg1 += vec_d0;
- reg2 += vec_d0;
- reg0 = __msa_maxi_s_h((v8i16)reg0, 0);
- reg1 = __msa_maxi_s_h((v8i16)reg1, 0);
- reg2 = __msa_maxi_s_h((v8i16)reg2, 0);
- reg0 = __msa_min_s_h((v8i16)max, (v8i16)reg0);
- reg1 = __msa_min_s_h((v8i16)max, (v8i16)reg1);
- reg2 = __msa_min_s_h((v8i16)max, (v8i16)reg2);
- reg0 = __msa_srai_h(reg0, 3);
- reg2 = __msa_srai_h(reg2, 3);
- reg1 = __msa_srai_h(reg1, 2);
- reg2 = __msa_slli_h(reg2, 11);
- reg1 = __msa_slli_h(reg1, 5);
- reg0 |= reg1;
- dst0 = (v16u8)(reg0 | reg2);
- ST_UB(dst0, dst_rgb);
- src_argb += 32;
- dst_rgb += 16;
- }
- }
- void ARGBShuffleRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_argb,
- const uint8_t* shuffler,
- int width) {
- int x;
- v16u8 src0, src1, dst0, dst1;
- v16i8 vec0;
- v16i8 shuffler_vec = {0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 12};
- int32_t val = LW((int32_t*)shuffler);
- vec0 = (v16i8)__msa_fill_w(val);
- shuffler_vec += vec0;
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16u8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16u8*)src_argb, 16);
- dst0 = (v16u8)__msa_vshf_b(shuffler_vec, (v16i8)src0, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(shuffler_vec, (v16i8)src1, (v16i8)src1);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb += 32;
- dst_argb += 32;
- }
- }
- void ARGBShadeRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_argb,
- int width,
- uint32_t value) {
- int x;
- v16u8 src0, dst0;
- v8u16 vec0, vec1;
- v4u32 reg0, reg1, reg2, reg3, rgba_scale;
- v8i16 zero = {0};
- rgba_scale[0] = value;
- rgba_scale = (v4u32)__msa_ilvr_b((v16i8)rgba_scale, (v16i8)rgba_scale);
- rgba_scale = (v4u32)__msa_ilvr_h(zero, (v8i16)rgba_scale);
- for (x = 0; x < width; x += 4) {
- src0 = (v16u8)__msa_ld_b((const v16u8*)src_argb, 0);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src0, (v16i8)src0);
- reg0 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec0);
- reg1 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec0);
- reg2 = (v4u32)__msa_ilvr_h(zero, (v8i16)vec1);
- reg3 = (v4u32)__msa_ilvl_h(zero, (v8i16)vec1);
- reg0 *= rgba_scale;
- reg1 *= rgba_scale;
- reg2 *= rgba_scale;
- reg3 *= rgba_scale;
- reg0 = (v4u32)__msa_srai_w((v4i32)reg0, 24);
- reg1 = (v4u32)__msa_srai_w((v4i32)reg1, 24);
- reg2 = (v4u32)__msa_srai_w((v4i32)reg2, 24);
- reg3 = (v4u32)__msa_srai_w((v4i32)reg3, 24);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_argb);
- src_argb += 16;
- dst_argb += 16;
- }
- }
- void ARGBGrayRow_MSA(const uint8_t* src_argb, uint8_t* dst_argb, int width) {
- int x;
- v16u8 src0, src1, vec0, vec1, dst0, dst1;
- v8u16 reg0;
- v16u8 const_0x26 = (v16u8)__msa_ldi_h(0x26);
- v16u8 const_0x4B0F = (v16u8)__msa_fill_h(0x4B0F);
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16u8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16u8*)src_argb, 16);
- vec0 = (v16u8)__msa_pckev_h((v8i16)src1, (v8i16)src0);
- vec1 = (v16u8)__msa_pckod_h((v8i16)src1, (v8i16)src0);
- reg0 = __msa_dotp_u_h(vec0, const_0x4B0F);
- reg0 = __msa_dpadd_u_h(reg0, vec1, const_0x26);
- reg0 = (v8u16)__msa_srari_h((v8i16)reg0, 7);
- vec0 = (v16u8)__msa_ilvev_b((v16i8)reg0, (v16i8)reg0);
- vec1 = (v16u8)__msa_ilvod_b((v16i8)vec1, (v16i8)vec0);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)vec1, (v16i8)vec0);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb += 32;
- dst_argb += 32;
- }
- }
- void ARGBSepiaRow_MSA(uint8_t* dst_argb, int width) {
- int x;
- v16u8 src0, src1, dst0, dst1, vec0, vec1, vec2, vec3, vec4, vec5;
- v8u16 reg0, reg1, reg2;
- v16u8 const_0x4411 = (v16u8)__msa_fill_h(0x4411);
- v16u8 const_0x23 = (v16u8)__msa_ldi_h(0x23);
- v16u8 const_0x5816 = (v16u8)__msa_fill_h(0x5816);
- v16u8 const_0x2D = (v16u8)__msa_ldi_h(0x2D);
- v16u8 const_0x6218 = (v16u8)__msa_fill_h(0x6218);
- v16u8 const_0x32 = (v16u8)__msa_ldi_h(0x32);
- v8u16 const_0xFF = (v8u16)__msa_ldi_h(0xFF);
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((v16u8*)dst_argb, 0);
- src1 = (v16u8)__msa_ld_b((v16u8*)dst_argb, 16);
- vec0 = (v16u8)__msa_pckev_h((v8i16)src1, (v8i16)src0);
- vec1 = (v16u8)__msa_pckod_h((v8i16)src1, (v8i16)src0);
- vec3 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec1);
- reg0 = (v8u16)__msa_dotp_u_h(vec0, const_0x4411);
- reg1 = (v8u16)__msa_dotp_u_h(vec0, const_0x5816);
- reg2 = (v8u16)__msa_dotp_u_h(vec0, const_0x6218);
- reg0 = (v8u16)__msa_dpadd_u_h(reg0, vec1, const_0x23);
- reg1 = (v8u16)__msa_dpadd_u_h(reg1, vec1, const_0x2D);
- reg2 = (v8u16)__msa_dpadd_u_h(reg2, vec1, const_0x32);
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 7);
- reg1 = (v8u16)__msa_srai_h((v8i16)reg1, 7);
- reg2 = (v8u16)__msa_srai_h((v8i16)reg2, 7);
- reg1 = (v8u16)__msa_min_u_h((v8u16)reg1, const_0xFF);
- reg2 = (v8u16)__msa_min_u_h((v8u16)reg2, const_0xFF);
- vec0 = (v16u8)__msa_pckev_b((v16i8)reg0, (v16i8)reg0);
- vec1 = (v16u8)__msa_pckev_b((v16i8)reg1, (v16i8)reg1);
- vec2 = (v16u8)__msa_pckev_b((v16i8)reg2, (v16i8)reg2);
- vec4 = (v16u8)__msa_ilvr_b((v16i8)vec2, (v16i8)vec0);
- vec5 = (v16u8)__msa_ilvr_b((v16i8)vec3, (v16i8)vec1);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)vec5, (v16i8)vec4);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)vec5, (v16i8)vec4);
- ST_UB2(dst0, dst1, dst_argb, 16);
- dst_argb += 32;
- }
- }
- void ARGB4444ToARGBRow_MSA(const uint8_t* src_argb4444,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1;
- v8u16 vec0, vec1, vec2, vec3;
- v16u8 dst0, dst1, dst2, dst3;
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16u8*)src_argb4444, 0);
- src1 = (v16u8)__msa_ld_b((const v16u8*)src_argb4444, 16);
- vec0 = (v8u16)__msa_andi_b(src0, 0x0F);
- vec1 = (v8u16)__msa_andi_b(src1, 0x0F);
- vec2 = (v8u16)__msa_andi_b(src0, 0xF0);
- vec3 = (v8u16)__msa_andi_b(src1, 0xF0);
- vec0 |= (v8u16)__msa_slli_b((v16i8)vec0, 4);
- vec1 |= (v8u16)__msa_slli_b((v16i8)vec1, 4);
- vec2 |= (v8u16)__msa_srli_b((v16i8)vec2, 4);
- vec3 |= (v8u16)__msa_srli_b((v16i8)vec3, 4);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)vec2, (v16i8)vec0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)vec2, (v16i8)vec0);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)vec3, (v16i8)vec1);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)vec3, (v16i8)vec1);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_argb4444 += 32;
- dst_argb += 64;
- }
- }
- void ARGB1555ToARGBRow_MSA(const uint8_t* src_argb1555,
- uint8_t* dst_argb,
- int width) {
- int x;
- v8u16 src0, src1;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5;
- v16u8 reg0, reg1, reg2, reg3, reg4, reg5, reg6;
- v16u8 dst0, dst1, dst2, dst3;
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_h((const v8u16*)src_argb1555, 0);
- src1 = (v8u16)__msa_ld_h((const v8u16*)src_argb1555, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src1 & const_0x1F;
- src0 = (v8u16)__msa_srli_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srli_h((v8i16)src1, 5);
- vec2 = src0 & const_0x1F;
- vec3 = src1 & const_0x1F;
- src0 = (v8u16)__msa_srli_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srli_h((v8i16)src1, 5);
- vec4 = src0 & const_0x1F;
- vec5 = src1 & const_0x1F;
- src0 = (v8u16)__msa_srli_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srli_h((v8i16)src1, 5);
- reg0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- reg1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- reg2 = (v16u8)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- reg3 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- reg4 = (v16u8)__msa_slli_b((v16i8)reg0, 3);
- reg5 = (v16u8)__msa_slli_b((v16i8)reg1, 3);
- reg6 = (v16u8)__msa_slli_b((v16i8)reg2, 3);
- reg4 |= (v16u8)__msa_srai_b((v16i8)reg0, 2);
- reg5 |= (v16u8)__msa_srai_b((v16i8)reg1, 2);
- reg6 |= (v16u8)__msa_srai_b((v16i8)reg2, 2);
- reg3 = -reg3;
- reg0 = (v16u8)__msa_ilvr_b((v16i8)reg6, (v16i8)reg4);
- reg1 = (v16u8)__msa_ilvl_b((v16i8)reg6, (v16i8)reg4);
- reg2 = (v16u8)__msa_ilvr_b((v16i8)reg3, (v16i8)reg5);
- reg3 = (v16u8)__msa_ilvl_b((v16i8)reg3, (v16i8)reg5);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)reg2, (v16i8)reg0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)reg2, (v16i8)reg0);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)reg3, (v16i8)reg1);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)reg3, (v16i8)reg1);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_argb1555 += 32;
- dst_argb += 64;
- }
- }
- void RGB565ToARGBRow_MSA(const uint8_t* src_rgb565,
- uint8_t* dst_argb,
- int width) {
- int x;
- v8u16 src0, src1, vec0, vec1, vec2, vec3, vec4, vec5;
- v8u16 reg0, reg1, reg2, reg3, reg4, reg5;
- v16u8 res0, res1, res2, res3, dst0, dst1, dst2, dst3;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- v8u16 const_0x7E0 = (v8u16)__msa_fill_h(0x7E0);
- v8u16 const_0xF800 = (v8u16)__msa_fill_h(0xF800);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_h((const v8u16*)src_rgb565, 0);
- src1 = (v8u16)__msa_ld_h((const v8u16*)src_rgb565, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src0 & const_0x7E0;
- vec2 = src0 & const_0xF800;
- vec3 = src1 & const_0x1F;
- vec4 = src1 & const_0x7E0;
- vec5 = src1 & const_0xF800;
- reg0 = (v8u16)__msa_slli_h((v8i16)vec0, 3);
- reg1 = (v8u16)__msa_srli_h((v8i16)vec1, 3);
- reg2 = (v8u16)__msa_srli_h((v8i16)vec2, 8);
- reg3 = (v8u16)__msa_slli_h((v8i16)vec3, 3);
- reg4 = (v8u16)__msa_srli_h((v8i16)vec4, 3);
- reg5 = (v8u16)__msa_srli_h((v8i16)vec5, 8);
- reg0 |= (v8u16)__msa_srli_h((v8i16)vec0, 2);
- reg1 |= (v8u16)__msa_srli_h((v8i16)vec1, 9);
- reg2 |= (v8u16)__msa_srli_h((v8i16)vec2, 13);
- reg3 |= (v8u16)__msa_srli_h((v8i16)vec3, 2);
- reg4 |= (v8u16)__msa_srli_h((v8i16)vec4, 9);
- reg5 |= (v8u16)__msa_srli_h((v8i16)vec5, 13);
- res0 = (v16u8)__msa_ilvev_b((v16i8)reg2, (v16i8)reg0);
- res1 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)reg1);
- res2 = (v16u8)__msa_ilvev_b((v16i8)reg5, (v16i8)reg3);
- res3 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)reg4);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)res1, (v16i8)res0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)res1, (v16i8)res0);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)res3, (v16i8)res2);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)res3, (v16i8)res2);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_rgb565 += 32;
- dst_argb += 64;
- }
- }
- void RGB24ToARGBRow_MSA(const uint8_t* src_rgb24,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, src2;
- v16u8 vec0, vec1, vec2;
- v16u8 dst0, dst1, dst2, dst3;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v16i8 shuffler = {0, 1, 2, 16, 3, 4, 5, 17, 6, 7, 8, 18, 9, 10, 11, 19};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_rgb24, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_rgb24, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_rgb24, 32);
- vec0 = (v16u8)__msa_sldi_b((v16i8)src1, (v16i8)src0, 12);
- vec1 = (v16u8)__msa_sldi_b((v16i8)src2, (v16i8)src1, 8);
- vec2 = (v16u8)__msa_sldi_b((v16i8)src2, (v16i8)src2, 4);
- dst0 = (v16u8)__msa_vshf_b(shuffler, (v16i8)alpha, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(shuffler, (v16i8)alpha, (v16i8)vec0);
- dst2 = (v16u8)__msa_vshf_b(shuffler, (v16i8)alpha, (v16i8)vec1);
- dst3 = (v16u8)__msa_vshf_b(shuffler, (v16i8)alpha, (v16i8)vec2);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_rgb24 += 48;
- dst_argb += 64;
- }
- }
- void RAWToARGBRow_MSA(const uint8_t* src_raw, uint8_t* dst_argb, int width) {
- int x;
- v16u8 src0, src1, src2;
- v16u8 vec0, vec1, vec2;
- v16u8 dst0, dst1, dst2, dst3;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v16i8 mask = {2, 1, 0, 16, 5, 4, 3, 17, 8, 7, 6, 18, 11, 10, 9, 19};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 32);
- vec0 = (v16u8)__msa_sldi_b((v16i8)src1, (v16i8)src0, 12);
- vec1 = (v16u8)__msa_sldi_b((v16i8)src2, (v16i8)src1, 8);
- vec2 = (v16u8)__msa_sldi_b((v16i8)src2, (v16i8)src2, 4);
- dst0 = (v16u8)__msa_vshf_b(mask, (v16i8)alpha, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(mask, (v16i8)alpha, (v16i8)vec0);
- dst2 = (v16u8)__msa_vshf_b(mask, (v16i8)alpha, (v16i8)vec1);
- dst3 = (v16u8)__msa_vshf_b(mask, (v16i8)alpha, (v16i8)vec2);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_raw += 48;
- dst_argb += 64;
- }
- }
- void ARGB1555ToYRow_MSA(const uint8_t* src_argb1555,
- uint8_t* dst_y,
- int width) {
- int x;
- v8u16 src0, src1, vec0, vec1, vec2, vec3, vec4, vec5;
- v8u16 reg0, reg1, reg2, reg3, reg4, reg5;
- v16u8 dst0;
- v8u16 const_0x19 = (v8u16)__msa_ldi_h(0x19);
- v8u16 const_0x81 = (v8u16)__msa_ldi_h(0x81);
- v8u16 const_0x42 = (v8u16)__msa_ldi_h(0x42);
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_b((const v8i16*)src_argb1555, 0);
- src1 = (v8u16)__msa_ld_b((const v8i16*)src_argb1555, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src1 & const_0x1F;
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 5);
- vec2 = src0 & const_0x1F;
- vec3 = src1 & const_0x1F;
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 5);
- vec4 = src0 & const_0x1F;
- vec5 = src1 & const_0x1F;
- reg0 = (v8u16)__msa_slli_h((v8i16)vec0, 3);
- reg1 = (v8u16)__msa_slli_h((v8i16)vec1, 3);
- reg0 |= (v8u16)__msa_srai_h((v8i16)vec0, 2);
- reg1 |= (v8u16)__msa_srai_h((v8i16)vec1, 2);
- reg2 = (v8u16)__msa_slli_h((v8i16)vec2, 3);
- reg3 = (v8u16)__msa_slli_h((v8i16)vec3, 3);
- reg2 |= (v8u16)__msa_srai_h((v8i16)vec2, 2);
- reg3 |= (v8u16)__msa_srai_h((v8i16)vec3, 2);
- reg4 = (v8u16)__msa_slli_h((v8i16)vec4, 3);
- reg5 = (v8u16)__msa_slli_h((v8i16)vec5, 3);
- reg4 |= (v8u16)__msa_srai_h((v8i16)vec4, 2);
- reg5 |= (v8u16)__msa_srai_h((v8i16)vec5, 2);
- reg0 *= const_0x19;
- reg1 *= const_0x19;
- reg2 *= const_0x81;
- reg3 *= const_0x81;
- reg4 *= const_0x42;
- reg5 *= const_0x42;
- reg0 += reg2;
- reg1 += reg3;
- reg0 += reg4;
- reg1 += reg5;
- reg0 += const_0x1080;
- reg1 += const_0x1080;
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 8);
- reg1 = (v8u16)__msa_srai_h((v8i16)reg1, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg1, (v16i8)reg0);
- ST_UB(dst0, dst_y);
- src_argb1555 += 32;
- dst_y += 16;
- }
- }
- void RGB565ToYRow_MSA(const uint8_t* src_rgb565, uint8_t* dst_y, int width) {
- int x;
- v8u16 src0, src1, vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v8u16 reg0, reg1, reg2, reg3, reg4, reg5;
- v4u32 res0, res1, res2, res3;
- v16u8 dst0;
- v4u32 const_0x810019 = (v4u32)__msa_fill_w(0x810019);
- v4u32 const_0x010042 = (v4u32)__msa_fill_w(0x010042);
- v8i16 const_0x1080 = __msa_fill_h(0x1080);
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- v8u16 const_0x7E0 = (v8u16)__msa_fill_h(0x7E0);
- v8u16 const_0xF800 = (v8u16)__msa_fill_h(0xF800);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_b((const v8i16*)src_rgb565, 0);
- src1 = (v8u16)__msa_ld_b((const v8i16*)src_rgb565, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src0 & const_0x7E0;
- vec2 = src0 & const_0xF800;
- vec3 = src1 & const_0x1F;
- vec4 = src1 & const_0x7E0;
- vec5 = src1 & const_0xF800;
- reg0 = (v8u16)__msa_slli_h((v8i16)vec0, 3);
- reg1 = (v8u16)__msa_srli_h((v8i16)vec1, 3);
- reg2 = (v8u16)__msa_srli_h((v8i16)vec2, 8);
- reg3 = (v8u16)__msa_slli_h((v8i16)vec3, 3);
- reg4 = (v8u16)__msa_srli_h((v8i16)vec4, 3);
- reg5 = (v8u16)__msa_srli_h((v8i16)vec5, 8);
- reg0 |= (v8u16)__msa_srli_h((v8i16)vec0, 2);
- reg1 |= (v8u16)__msa_srli_h((v8i16)vec1, 9);
- reg2 |= (v8u16)__msa_srli_h((v8i16)vec2, 13);
- reg3 |= (v8u16)__msa_srli_h((v8i16)vec3, 2);
- reg4 |= (v8u16)__msa_srli_h((v8i16)vec4, 9);
- reg5 |= (v8u16)__msa_srli_h((v8i16)vec5, 13);
- vec0 = (v8u16)__msa_ilvr_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_ilvl_h((v8i16)reg1, (v8i16)reg0);
- vec2 = (v8u16)__msa_ilvr_h((v8i16)reg4, (v8i16)reg3);
- vec3 = (v8u16)__msa_ilvl_h((v8i16)reg4, (v8i16)reg3);
- vec4 = (v8u16)__msa_ilvr_h(const_0x1080, (v8i16)reg2);
- vec5 = (v8u16)__msa_ilvl_h(const_0x1080, (v8i16)reg2);
- vec6 = (v8u16)__msa_ilvr_h(const_0x1080, (v8i16)reg5);
- vec7 = (v8u16)__msa_ilvl_h(const_0x1080, (v8i16)reg5);
- res0 = __msa_dotp_u_w(vec0, (v8u16)const_0x810019);
- res1 = __msa_dotp_u_w(vec1, (v8u16)const_0x810019);
- res2 = __msa_dotp_u_w(vec2, (v8u16)const_0x810019);
- res3 = __msa_dotp_u_w(vec3, (v8u16)const_0x810019);
- res0 = __msa_dpadd_u_w(res0, vec4, (v8u16)const_0x010042);
- res1 = __msa_dpadd_u_w(res1, vec5, (v8u16)const_0x010042);
- res2 = __msa_dpadd_u_w(res2, vec6, (v8u16)const_0x010042);
- res3 = __msa_dpadd_u_w(res3, vec7, (v8u16)const_0x010042);
- res0 = (v4u32)__msa_srai_w((v4i32)res0, 8);
- res1 = (v4u32)__msa_srai_w((v4i32)res1, 8);
- res2 = (v4u32)__msa_srai_w((v4i32)res2, 8);
- res3 = (v4u32)__msa_srai_w((v4i32)res3, 8);
- vec0 = (v8u16)__msa_pckev_h((v8i16)res1, (v8i16)res0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)res3, (v8i16)res2);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_y);
- src_rgb565 += 32;
- dst_y += 16;
- }
- }
- void RGB24ToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, reg0, reg1, reg2, reg3, dst0;
- v8u16 vec0, vec1, vec2, vec3;
- v8u16 const_0x8119 = (v8u16)__msa_fill_h(0x8119);
- v8u16 const_0x42 = (v8u16)__msa_fill_h(0x42);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- v16i8 mask0 = {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12};
- v16i8 mask1 = {12, 13, 14, 15, 15, 16, 17, 18,
- 18, 19, 20, 21, 21, 22, 23, 24};
- v16i8 mask2 = {8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20};
- v16i8 mask3 = {4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- reg0 = (v16u8)__msa_vshf_b(mask0, zero, (v16i8)src0);
- reg1 = (v16u8)__msa_vshf_b(mask1, (v16i8)src1, (v16i8)src0);
- reg2 = (v16u8)__msa_vshf_b(mask2, (v16i8)src2, (v16i8)src1);
- reg3 = (v16u8)__msa_vshf_b(mask3, zero, (v16i8)src2);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec2 = (v8u16)__msa_pckod_h((v8i16)reg1, (v8i16)reg0);
- vec3 = (v8u16)__msa_pckod_h((v8i16)reg3, (v8i16)reg2);
- vec0 = __msa_dotp_u_h((v16u8)vec0, (v16u8)const_0x8119);
- vec1 = __msa_dotp_u_h((v16u8)vec1, (v16u8)const_0x8119);
- vec0 = __msa_dpadd_u_h(vec0, (v16u8)vec2, (v16u8)const_0x42);
- vec1 = __msa_dpadd_u_h(vec1, (v16u8)vec3, (v16u8)const_0x42);
- vec0 += const_0x1080;
- vec1 += const_0x1080;
- vec0 = (v8u16)__msa_srai_h((v8i16)vec0, 8);
- vec1 = (v8u16)__msa_srai_h((v8i16)vec1, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_y);
- src_argb0 += 48;
- dst_y += 16;
- }
- }
- void RAWToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, reg0, reg1, reg2, reg3, dst0;
- v8u16 vec0, vec1, vec2, vec3;
- v8u16 const_0x8142 = (v8u16)__msa_fill_h(0x8142);
- v8u16 const_0x19 = (v8u16)__msa_fill_h(0x19);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- v16i8 mask0 = {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12};
- v16i8 mask1 = {12, 13, 14, 15, 15, 16, 17, 18,
- 18, 19, 20, 21, 21, 22, 23, 24};
- v16i8 mask2 = {8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20};
- v16i8 mask3 = {4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- reg0 = (v16u8)__msa_vshf_b(mask0, zero, (v16i8)src0);
- reg1 = (v16u8)__msa_vshf_b(mask1, (v16i8)src1, (v16i8)src0);
- reg2 = (v16u8)__msa_vshf_b(mask2, (v16i8)src2, (v16i8)src1);
- reg3 = (v16u8)__msa_vshf_b(mask3, zero, (v16i8)src2);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec2 = (v8u16)__msa_pckod_h((v8i16)reg1, (v8i16)reg0);
- vec3 = (v8u16)__msa_pckod_h((v8i16)reg3, (v8i16)reg2);
- vec0 = __msa_dotp_u_h((v16u8)vec0, (v16u8)const_0x8142);
- vec1 = __msa_dotp_u_h((v16u8)vec1, (v16u8)const_0x8142);
- vec0 = __msa_dpadd_u_h(vec0, (v16u8)vec2, (v16u8)const_0x19);
- vec1 = __msa_dpadd_u_h(vec1, (v16u8)vec3, (v16u8)const_0x19);
- vec0 += const_0x1080;
- vec1 += const_0x1080;
- vec0 = (v8u16)__msa_srai_h((v8i16)vec0, 8);
- vec1 = (v8u16)__msa_srai_h((v8i16)vec1, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_y);
- src_argb0 += 48;
- dst_y += 16;
- }
- }
- void ARGB1555ToUVRow_MSA(const uint8_t* src_argb1555,
- int src_stride_argb1555,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint16_t* s = (const uint16_t*)src_argb1555;
- const uint16_t* t = (const uint16_t*)(src_argb1555 + src_stride_argb1555);
- int64_t res0, res1;
- v8u16 src0, src1, src2, src3, reg0, reg1, reg2, reg3;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6;
- v16u8 dst0;
- v8u16 const_0x70 = (v8u16)__msa_ldi_h(0x70);
- v8u16 const_0x4A = (v8u16)__msa_ldi_h(0x4A);
- v8u16 const_0x26 = (v8u16)__msa_ldi_h(0x26);
- v8u16 const_0x5E = (v8u16)__msa_ldi_h(0x5E);
- v8u16 const_0x12 = (v8u16)__msa_ldi_h(0x12);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_b((v8i16*)s, 0);
- src1 = (v8u16)__msa_ld_b((v8i16*)s, 16);
- src2 = (v8u16)__msa_ld_b((v8i16*)t, 0);
- src3 = (v8u16)__msa_ld_b((v8i16*)t, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src1 & const_0x1F;
- vec0 += src2 & const_0x1F;
- vec1 += src3 & const_0x1F;
- vec0 = (v8u16)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 5);
- src2 = (v8u16)__msa_srai_h((v8i16)src2, 5);
- src3 = (v8u16)__msa_srai_h((v8i16)src3, 5);
- vec2 = src0 & const_0x1F;
- vec3 = src1 & const_0x1F;
- vec2 += src2 & const_0x1F;
- vec3 += src3 & const_0x1F;
- vec2 = (v8u16)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 5);
- src2 = (v8u16)__msa_srai_h((v8i16)src2, 5);
- src3 = (v8u16)__msa_srai_h((v8i16)src3, 5);
- vec4 = src0 & const_0x1F;
- vec5 = src1 & const_0x1F;
- vec4 += src2 & const_0x1F;
- vec5 += src3 & const_0x1F;
- vec4 = (v8u16)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- vec0 = __msa_hadd_u_h((v16u8)vec0, (v16u8)vec0);
- vec2 = __msa_hadd_u_h((v16u8)vec2, (v16u8)vec2);
- vec4 = __msa_hadd_u_h((v16u8)vec4, (v16u8)vec4);
- vec6 = (v8u16)__msa_slli_h((v8i16)vec0, 1);
- vec6 |= (v8u16)__msa_srai_h((v8i16)vec0, 6);
- vec0 = (v8u16)__msa_slli_h((v8i16)vec2, 1);
- vec0 |= (v8u16)__msa_srai_h((v8i16)vec2, 6);
- vec2 = (v8u16)__msa_slli_h((v8i16)vec4, 1);
- vec2 |= (v8u16)__msa_srai_h((v8i16)vec4, 6);
- reg0 = vec6 * const_0x70;
- reg1 = vec0 * const_0x4A;
- reg2 = vec2 * const_0x70;
- reg3 = vec0 * const_0x5E;
- reg0 += const_0x8080;
- reg1 += vec2 * const_0x26;
- reg2 += const_0x8080;
- reg3 += vec6 * const_0x12;
- reg0 -= reg1;
- reg2 -= reg3;
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 8);
- reg2 = (v8u16)__msa_srai_h((v8i16)reg2, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg2, (v16i8)reg0);
- res0 = __msa_copy_u_d((v2i64)dst0, 0);
- res1 = __msa_copy_u_d((v2i64)dst0, 1);
- SD(res0, dst_u);
- SD(res1, dst_v);
- s += 16;
- t += 16;
- dst_u += 8;
- dst_v += 8;
- }
- }
- void RGB565ToUVRow_MSA(const uint8_t* src_rgb565,
- int src_stride_rgb565,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint16_t* s = (const uint16_t*)src_rgb565;
- const uint16_t* t = (const uint16_t*)(src_rgb565 + src_stride_rgb565);
- int64_t res0, res1;
- v8u16 src0, src1, src2, src3, reg0, reg1, reg2, reg3;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5;
- v16u8 dst0;
- v8u16 const_0x70 = (v8u16)__msa_ldi_h(0x70);
- v8u16 const_0x4A = (v8u16)__msa_ldi_h(0x4A);
- v8u16 const_0x26 = (v8u16)__msa_ldi_h(0x26);
- v8u16 const_0x5E = (v8u16)__msa_ldi_h(0x5E);
- v8u16 const_0x12 = (v8u16)__msa_ldi_h(0x12);
- v8u16 const_32896 = (v8u16)__msa_fill_h(0x8080);
- v8u16 const_0x1F = (v8u16)__msa_ldi_h(0x1F);
- v8u16 const_0x3F = (v8u16)__msa_fill_h(0x3F);
- for (x = 0; x < width; x += 16) {
- src0 = (v8u16)__msa_ld_b((v8i16*)s, 0);
- src1 = (v8u16)__msa_ld_b((v8i16*)s, 16);
- src2 = (v8u16)__msa_ld_b((v8i16*)t, 0);
- src3 = (v8u16)__msa_ld_b((v8i16*)t, 16);
- vec0 = src0 & const_0x1F;
- vec1 = src1 & const_0x1F;
- vec0 += src2 & const_0x1F;
- vec1 += src3 & const_0x1F;
- vec0 = (v8u16)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 5);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 5);
- src2 = (v8u16)__msa_srai_h((v8i16)src2, 5);
- src3 = (v8u16)__msa_srai_h((v8i16)src3, 5);
- vec2 = src0 & const_0x3F;
- vec3 = src1 & const_0x3F;
- vec2 += src2 & const_0x3F;
- vec3 += src3 & const_0x3F;
- vec1 = (v8u16)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- src0 = (v8u16)__msa_srai_h((v8i16)src0, 6);
- src1 = (v8u16)__msa_srai_h((v8i16)src1, 6);
- src2 = (v8u16)__msa_srai_h((v8i16)src2, 6);
- src3 = (v8u16)__msa_srai_h((v8i16)src3, 6);
- vec4 = src0 & const_0x1F;
- vec5 = src1 & const_0x1F;
- vec4 += src2 & const_0x1F;
- vec5 += src3 & const_0x1F;
- vec2 = (v8u16)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- vec0 = __msa_hadd_u_h((v16u8)vec0, (v16u8)vec0);
- vec1 = __msa_hadd_u_h((v16u8)vec1, (v16u8)vec1);
- vec2 = __msa_hadd_u_h((v16u8)vec2, (v16u8)vec2);
- vec3 = (v8u16)__msa_slli_h((v8i16)vec0, 1);
- vec3 |= (v8u16)__msa_srai_h((v8i16)vec0, 6);
- vec4 = (v8u16)__msa_slli_h((v8i16)vec2, 1);
- vec4 |= (v8u16)__msa_srai_h((v8i16)vec2, 6);
- reg0 = vec3 * const_0x70;
- reg1 = vec1 * const_0x4A;
- reg2 = vec4 * const_0x70;
- reg3 = vec1 * const_0x5E;
- reg0 += const_32896;
- reg1 += vec4 * const_0x26;
- reg2 += const_32896;
- reg3 += vec3 * const_0x12;
- reg0 -= reg1;
- reg2 -= reg3;
- reg0 = (v8u16)__msa_srai_h((v8i16)reg0, 8);
- reg2 = (v8u16)__msa_srai_h((v8i16)reg2, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg2, (v16i8)reg0);
- res0 = __msa_copy_u_d((v2i64)dst0, 0);
- res1 = __msa_copy_u_d((v2i64)dst0, 1);
- SD(res0, dst_u);
- SD(res1, dst_v);
- s += 16;
- t += 16;
- dst_u += 8;
- dst_v += 8;
- }
- }
- void RGB24ToUVRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- int64_t res0, res1;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v16u8 inp0, inp1, inp2, inp3, inp4, inp5;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v8i16 reg0, reg1, reg2, reg3;
- v16u8 dst0;
- v8u16 const_0x70 = (v8u16)__msa_fill_h(0x70);
- v8u16 const_0x4A = (v8u16)__msa_fill_h(0x4A);
- v8u16 const_0x26 = (v8u16)__msa_fill_h(0x26);
- v8u16 const_0x5E = (v8u16)__msa_fill_h(0x5E);
- v8u16 const_0x12 = (v8u16)__msa_fill_h(0x12);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- v16i8 mask = {0, 1, 2, 16, 3, 4, 5, 17, 6, 7, 8, 18, 9, 10, 11, 19};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 16) {
- inp0 = (v16u8)__msa_ld_b((const v16i8*)s, 0);
- inp1 = (v16u8)__msa_ld_b((const v16i8*)s, 16);
- inp2 = (v16u8)__msa_ld_b((const v16i8*)s, 32);
- inp3 = (v16u8)__msa_ld_b((const v16i8*)t, 0);
- inp4 = (v16u8)__msa_ld_b((const v16i8*)t, 16);
- inp5 = (v16u8)__msa_ld_b((const v16i8*)t, 32);
- src1 = (v16u8)__msa_sldi_b((v16i8)inp1, (v16i8)inp0, 12);
- src5 = (v16u8)__msa_sldi_b((v16i8)inp4, (v16i8)inp3, 12);
- src2 = (v16u8)__msa_sldi_b((v16i8)inp2, (v16i8)inp1, 8);
- src6 = (v16u8)__msa_sldi_b((v16i8)inp5, (v16i8)inp4, 8);
- src3 = (v16u8)__msa_sldi_b((v16i8)inp2, (v16i8)inp2, 4);
- src7 = (v16u8)__msa_sldi_b((v16i8)inp5, (v16i8)inp5, 4);
- src0 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)inp0);
- src1 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src1);
- src2 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src2);
- src3 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src3);
- src4 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)inp3);
- src5 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src5);
- src6 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src6);
- src7 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src7);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src4, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src4, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b((v16i8)src5, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b((v16i8)src5, (v16i8)src1);
- vec4 = (v8u16)__msa_ilvr_b((v16i8)src6, (v16i8)src2);
- vec5 = (v8u16)__msa_ilvl_b((v16i8)src6, (v16i8)src2);
- vec6 = (v8u16)__msa_ilvr_b((v16i8)src7, (v16i8)src3);
- vec7 = (v8u16)__msa_ilvl_b((v16i8)src7, (v16i8)src3);
- vec0 = (v8u16)__msa_hadd_u_h((v16u8)vec0, (v16u8)vec0);
- vec1 = (v8u16)__msa_hadd_u_h((v16u8)vec1, (v16u8)vec1);
- vec2 = (v8u16)__msa_hadd_u_h((v16u8)vec2, (v16u8)vec2);
- vec3 = (v8u16)__msa_hadd_u_h((v16u8)vec3, (v16u8)vec3);
- vec4 = (v8u16)__msa_hadd_u_h((v16u8)vec4, (v16u8)vec4);
- vec5 = (v8u16)__msa_hadd_u_h((v16u8)vec5, (v16u8)vec5);
- vec6 = (v8u16)__msa_hadd_u_h((v16u8)vec6, (v16u8)vec6);
- vec7 = (v8u16)__msa_hadd_u_h((v16u8)vec7, (v16u8)vec7);
- reg0 = (v8i16)__msa_pckev_d((v2i64)vec1, (v2i64)vec0);
- reg1 = (v8i16)__msa_pckev_d((v2i64)vec3, (v2i64)vec2);
- reg2 = (v8i16)__msa_pckev_d((v2i64)vec5, (v2i64)vec4);
- reg3 = (v8i16)__msa_pckev_d((v2i64)vec7, (v2i64)vec6);
- reg0 += (v8i16)__msa_pckod_d((v2i64)vec1, (v2i64)vec0);
- reg1 += (v8i16)__msa_pckod_d((v2i64)vec3, (v2i64)vec2);
- reg2 += (v8i16)__msa_pckod_d((v2i64)vec5, (v2i64)vec4);
- reg3 += (v8i16)__msa_pckod_d((v2i64)vec7, (v2i64)vec6);
- reg0 = __msa_srai_h((v8i16)reg0, 2);
- reg1 = __msa_srai_h((v8i16)reg1, 2);
- reg2 = __msa_srai_h((v8i16)reg2, 2);
- reg3 = __msa_srai_h((v8i16)reg3, 2);
- vec4 = (v8u16)__msa_pckev_h(reg1, reg0);
- vec5 = (v8u16)__msa_pckev_h(reg3, reg2);
- vec6 = (v8u16)__msa_pckod_h(reg1, reg0);
- vec7 = (v8u16)__msa_pckod_h(reg3, reg2);
- vec0 = (v8u16)__msa_pckev_h((v8i16)vec5, (v8i16)vec4);
- vec1 = (v8u16)__msa_pckev_h((v8i16)vec7, (v8i16)vec6);
- vec2 = (v8u16)__msa_pckod_h((v8i16)vec5, (v8i16)vec4);
- vec3 = vec0 * const_0x70;
- vec4 = vec1 * const_0x4A;
- vec5 = vec2 * const_0x26;
- vec2 *= const_0x70;
- vec1 *= const_0x5E;
- vec0 *= const_0x12;
- reg0 = __msa_subv_h((v8i16)vec3, (v8i16)vec4);
- reg1 = __msa_subv_h((v8i16)const_0x8080, (v8i16)vec5);
- reg2 = __msa_subv_h((v8i16)vec2, (v8i16)vec1);
- reg3 = __msa_subv_h((v8i16)const_0x8080, (v8i16)vec0);
- reg0 += reg1;
- reg2 += reg3;
- reg0 = __msa_srai_h(reg0, 8);
- reg2 = __msa_srai_h(reg2, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg2, (v16i8)reg0);
- res0 = __msa_copy_u_d((v2i64)dst0, 0);
- res1 = __msa_copy_u_d((v2i64)dst0, 1);
- SD(res0, dst_u);
- SD(res1, dst_v);
- t += 48;
- s += 48;
- dst_u += 8;
- dst_v += 8;
- }
- }
- void RAWToUVRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- int64_t res0, res1;
- v16u8 inp0, inp1, inp2, inp3, inp4, inp5;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v8i16 reg0, reg1, reg2, reg3;
- v16u8 dst0;
- v8u16 const_0x70 = (v8u16)__msa_fill_h(0x70);
- v8u16 const_0x4A = (v8u16)__msa_fill_h(0x4A);
- v8u16 const_0x26 = (v8u16)__msa_fill_h(0x26);
- v8u16 const_0x5E = (v8u16)__msa_fill_h(0x5E);
- v8u16 const_0x12 = (v8u16)__msa_fill_h(0x12);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- v16i8 mask = {0, 1, 2, 16, 3, 4, 5, 17, 6, 7, 8, 18, 9, 10, 11, 19};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 16) {
- inp0 = (v16u8)__msa_ld_b((const v16i8*)s, 0);
- inp1 = (v16u8)__msa_ld_b((const v16i8*)s, 16);
- inp2 = (v16u8)__msa_ld_b((const v16i8*)s, 32);
- inp3 = (v16u8)__msa_ld_b((const v16i8*)t, 0);
- inp4 = (v16u8)__msa_ld_b((const v16i8*)t, 16);
- inp5 = (v16u8)__msa_ld_b((const v16i8*)t, 32);
- src1 = (v16u8)__msa_sldi_b((v16i8)inp1, (v16i8)inp0, 12);
- src5 = (v16u8)__msa_sldi_b((v16i8)inp4, (v16i8)inp3, 12);
- src2 = (v16u8)__msa_sldi_b((v16i8)inp2, (v16i8)inp1, 8);
- src6 = (v16u8)__msa_sldi_b((v16i8)inp5, (v16i8)inp4, 8);
- src3 = (v16u8)__msa_sldi_b((v16i8)inp2, (v16i8)inp2, 4);
- src7 = (v16u8)__msa_sldi_b((v16i8)inp5, (v16i8)inp5, 4);
- src0 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)inp0);
- src1 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src1);
- src2 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src2);
- src3 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src3);
- src4 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)inp3);
- src5 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src5);
- src6 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src6);
- src7 = (v16u8)__msa_vshf_b(mask, (v16i8)zero, (v16i8)src7);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src4, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src4, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b((v16i8)src5, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b((v16i8)src5, (v16i8)src1);
- vec4 = (v8u16)__msa_ilvr_b((v16i8)src6, (v16i8)src2);
- vec5 = (v8u16)__msa_ilvl_b((v16i8)src6, (v16i8)src2);
- vec6 = (v8u16)__msa_ilvr_b((v16i8)src7, (v16i8)src3);
- vec7 = (v8u16)__msa_ilvl_b((v16i8)src7, (v16i8)src3);
- vec0 = (v8u16)__msa_hadd_u_h((v16u8)vec0, (v16u8)vec0);
- vec1 = (v8u16)__msa_hadd_u_h((v16u8)vec1, (v16u8)vec1);
- vec2 = (v8u16)__msa_hadd_u_h((v16u8)vec2, (v16u8)vec2);
- vec3 = (v8u16)__msa_hadd_u_h((v16u8)vec3, (v16u8)vec3);
- vec4 = (v8u16)__msa_hadd_u_h((v16u8)vec4, (v16u8)vec4);
- vec5 = (v8u16)__msa_hadd_u_h((v16u8)vec5, (v16u8)vec5);
- vec6 = (v8u16)__msa_hadd_u_h((v16u8)vec6, (v16u8)vec6);
- vec7 = (v8u16)__msa_hadd_u_h((v16u8)vec7, (v16u8)vec7);
- reg0 = (v8i16)__msa_pckev_d((v2i64)vec1, (v2i64)vec0);
- reg1 = (v8i16)__msa_pckev_d((v2i64)vec3, (v2i64)vec2);
- reg2 = (v8i16)__msa_pckev_d((v2i64)vec5, (v2i64)vec4);
- reg3 = (v8i16)__msa_pckev_d((v2i64)vec7, (v2i64)vec6);
- reg0 += (v8i16)__msa_pckod_d((v2i64)vec1, (v2i64)vec0);
- reg1 += (v8i16)__msa_pckod_d((v2i64)vec3, (v2i64)vec2);
- reg2 += (v8i16)__msa_pckod_d((v2i64)vec5, (v2i64)vec4);
- reg3 += (v8i16)__msa_pckod_d((v2i64)vec7, (v2i64)vec6);
- reg0 = __msa_srai_h(reg0, 2);
- reg1 = __msa_srai_h(reg1, 2);
- reg2 = __msa_srai_h(reg2, 2);
- reg3 = __msa_srai_h(reg3, 2);
- vec4 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec5 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec6 = (v8u16)__msa_pckod_h((v8i16)reg1, (v8i16)reg0);
- vec7 = (v8u16)__msa_pckod_h((v8i16)reg3, (v8i16)reg2);
- vec0 = (v8u16)__msa_pckod_h((v8i16)vec5, (v8i16)vec4);
- vec1 = (v8u16)__msa_pckev_h((v8i16)vec7, (v8i16)vec6);
- vec2 = (v8u16)__msa_pckev_h((v8i16)vec5, (v8i16)vec4);
- vec3 = vec0 * const_0x70;
- vec4 = vec1 * const_0x4A;
- vec5 = vec2 * const_0x26;
- vec2 *= const_0x70;
- vec1 *= const_0x5E;
- vec0 *= const_0x12;
- reg0 = __msa_subv_h((v8i16)vec3, (v8i16)vec4);
- reg1 = __msa_subv_h((v8i16)const_0x8080, (v8i16)vec5);
- reg2 = __msa_subv_h((v8i16)vec2, (v8i16)vec1);
- reg3 = __msa_subv_h((v8i16)const_0x8080, (v8i16)vec0);
- reg0 += reg1;
- reg2 += reg3;
- reg0 = __msa_srai_h(reg0, 8);
- reg2 = __msa_srai_h(reg2, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)reg2, (v16i8)reg0);
- res0 = __msa_copy_u_d((v2i64)dst0, 0);
- res1 = __msa_copy_u_d((v2i64)dst0, 1);
- SD(res0, dst_u);
- SD(res1, dst_v);
- t += 48;
- s += 48;
- dst_u += 8;
- dst_v += 8;
- }
- }
- void NV12ToARGBRow_MSA(const uint8_t* src_y,
- const uint8_t* src_uv,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- uint64_t val0, val1;
- v16u8 src0, src1, res0, res1, dst0, dst1;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 zero = {0};
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- val0 = LD(src_y);
- val1 = LD(src_uv);
- src0 = (v16u8)__msa_insert_d((v2i64)zero, 0, val0);
- src1 = (v16u8)__msa_insert_d((v2i64)zero, 0, val1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- res0 = (v16u8)__msa_ilvev_b((v16i8)vec2, (v16i8)vec0);
- res1 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)vec1);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)res1, (v16i8)res0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)res1, (v16i8)res0);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_y += 8;
- src_uv += 8;
- dst_argb += 32;
- }
- }
- void NV12ToRGB565Row_MSA(const uint8_t* src_y,
- const uint8_t* src_uv,
- uint8_t* dst_rgb565,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- uint64_t val0, val1;
- v16u8 src0, src1, dst0;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 zero = {0};
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- val0 = LD(src_y);
- val1 = LD(src_uv);
- src0 = (v16u8)__msa_insert_d((v2i64)zero, 0, val0);
- src1 = (v16u8)__msa_insert_d((v2i64)zero, 0, val1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- vec0 = vec0 >> 3;
- vec1 = (vec1 >> 2) << 5;
- vec2 = (vec2 >> 3) << 11;
- dst0 = (v16u8)(vec0 | vec1 | vec2);
- ST_UB(dst0, dst_rgb565);
- src_y += 8;
- src_uv += 8;
- dst_rgb565 += 16;
- }
- }
- void NV21ToARGBRow_MSA(const uint8_t* src_y,
- const uint8_t* src_vu,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- uint64_t val0, val1;
- v16u8 src0, src1, res0, res1, dst0, dst1;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v16u8 zero = {0};
- v16i8 shuffler = {1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14};
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- val0 = LD(src_y);
- val1 = LD(src_vu);
- src0 = (v16u8)__msa_insert_d((v2i64)zero, 0, val0);
- src1 = (v16u8)__msa_insert_d((v2i64)zero, 0, val1);
- src1 = (v16u8)__msa_vshf_b(shuffler, (v16i8)src1, (v16i8)src1);
- YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- res0 = (v16u8)__msa_ilvev_b((v16i8)vec2, (v16i8)vec0);
- res1 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)vec1);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)res1, (v16i8)res0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)res1, (v16i8)res0);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_y += 8;
- src_vu += 8;
- dst_argb += 32;
- }
- }
- void SobelRow_MSA(const uint8_t* src_sobelx,
- const uint8_t* src_sobely,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, vec0, dst0, dst1, dst2, dst3;
- v16i8 mask0 = {0, 0, 0, 16, 1, 1, 1, 16, 2, 2, 2, 16, 3, 3, 3, 16};
- v16i8 const_0x4 = __msa_ldi_b(0x4);
- v16i8 mask1 = mask0 + const_0x4;
- v16i8 mask2 = mask1 + const_0x4;
- v16i8 mask3 = mask2 + const_0x4;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_sobelx, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_sobely, 0);
- vec0 = __msa_adds_u_b(src0, src1);
- dst0 = (v16u8)__msa_vshf_b(mask0, (v16i8)alpha, (v16i8)vec0);
- dst1 = (v16u8)__msa_vshf_b(mask1, (v16i8)alpha, (v16i8)vec0);
- dst2 = (v16u8)__msa_vshf_b(mask2, (v16i8)alpha, (v16i8)vec0);
- dst3 = (v16u8)__msa_vshf_b(mask3, (v16i8)alpha, (v16i8)vec0);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_sobelx += 16;
- src_sobely += 16;
- dst_argb += 64;
- }
- }
- void SobelToPlaneRow_MSA(const uint8_t* src_sobelx,
- const uint8_t* src_sobely,
- uint8_t* dst_y,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_sobelx, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_sobelx, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_sobely, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_sobely, 16);
- dst0 = __msa_adds_u_b(src0, src2);
- dst1 = __msa_adds_u_b(src1, src3);
- ST_UB2(dst0, dst1, dst_y, 16);
- src_sobelx += 32;
- src_sobely += 32;
- dst_y += 32;
- }
- }
- void SobelXYRow_MSA(const uint8_t* src_sobelx,
- const uint8_t* src_sobely,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, vec0, vec1, vec2;
- v16u8 reg0, reg1, dst0, dst1, dst2, dst3;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_sobelx, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_sobely, 0);
- vec0 = __msa_adds_u_b(src0, src1);
- vec1 = (v16u8)__msa_ilvr_b((v16i8)src0, (v16i8)src1);
- vec2 = (v16u8)__msa_ilvl_b((v16i8)src0, (v16i8)src1);
- reg0 = (v16u8)__msa_ilvr_b((v16i8)alpha, (v16i8)vec0);
- reg1 = (v16u8)__msa_ilvl_b((v16i8)alpha, (v16i8)vec0);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)reg0, (v16i8)vec1);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)reg0, (v16i8)vec1);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)reg1, (v16i8)vec2);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)reg1, (v16i8)vec2);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_sobelx += 16;
- src_sobely += 16;
- dst_argb += 64;
- }
- }
- void ARGBToYJRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0;
- v16u8 const_0x4B0F = (v16u8)__msa_fill_h(0x4B0F);
- v16u8 const_0x26 = (v16u8)__msa_fill_h(0x26);
- v8u16 const_0x40 = (v8u16)__msa_fill_h(0x40);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 48);
- ARGBTOY(src0, src1, src2, src3, const_0x4B0F, const_0x26, const_0x40, 7,
- dst0);
- ST_UB(dst0, dst_y);
- src_argb0 += 64;
- dst_y += 16;
- }
- }
- void BGRAToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0;
- v16u8 const_0x4200 = (v16u8)__msa_fill_h(0x4200);
- v16u8 const_0x1981 = (v16u8)__msa_fill_h(0x1981);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 48);
- ARGBTOY(src0, src1, src2, src3, const_0x4200, const_0x1981, const_0x1080, 8,
- dst0);
- ST_UB(dst0, dst_y);
- src_argb0 += 64;
- dst_y += 16;
- }
- }
- void ABGRToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0;
- v16u8 const_0x8142 = (v16u8)__msa_fill_h(0x8142);
- v16u8 const_0x19 = (v16u8)__msa_fill_h(0x19);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 48);
- ARGBTOY(src0, src1, src2, src3, const_0x8142, const_0x19, const_0x1080, 8,
- dst0);
- ST_UB(dst0, dst_y);
- src_argb0 += 64;
- dst_y += 16;
- }
- }
- void RGBAToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0;
- v16u8 const_0x1900 = (v16u8)__msa_fill_h(0x1900);
- v16u8 const_0x4281 = (v16u8)__msa_fill_h(0x4281);
- v8u16 const_0x1080 = (v8u16)__msa_fill_h(0x1080);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 48);
- ARGBTOY(src0, src1, src2, src3, const_0x1900, const_0x4281, const_0x1080, 8,
- dst0);
- ST_UB(dst0, dst_y);
- src_argb0 += 64;
- dst_y += 16;
- }
- }
- void ARGBToUVJRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v16u8 vec0, vec1, vec2, vec3;
- v16u8 dst0, dst1;
- v16i8 shuffler0 = {0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29};
- v16i8 shuffler1 = {2, 3, 6, 7, 10, 11, 14, 15,
- 18, 19, 22, 23, 26, 27, 30, 31};
- v16i8 shuffler2 = {0, 3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31};
- v16i8 shuffler3 = {1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30};
- v16u8 const_0x7F = (v16u8)__msa_fill_h(0x7F);
- v16u8 const_0x6B14 = (v16u8)__msa_fill_h(0x6B14);
- v16u8 const_0x2B54 = (v16u8)__msa_fill_h(0x2B54);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)s, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)s, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)s, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)s, 48);
- src4 = (v16u8)__msa_ld_b((const v16i8*)t, 0);
- src5 = (v16u8)__msa_ld_b((const v16i8*)t, 16);
- src6 = (v16u8)__msa_ld_b((const v16i8*)t, 32);
- src7 = (v16u8)__msa_ld_b((const v16i8*)t, 48);
- src0 = __msa_aver_u_b(src0, src4);
- src1 = __msa_aver_u_b(src1, src5);
- src2 = __msa_aver_u_b(src2, src6);
- src3 = __msa_aver_u_b(src3, src7);
- src4 = (v16u8)__msa_pckev_w((v4i32)src1, (v4i32)src0);
- src5 = (v16u8)__msa_pckev_w((v4i32)src3, (v4i32)src2);
- src6 = (v16u8)__msa_pckod_w((v4i32)src1, (v4i32)src0);
- src7 = (v16u8)__msa_pckod_w((v4i32)src3, (v4i32)src2);
- vec0 = __msa_aver_u_b(src4, src6);
- vec1 = __msa_aver_u_b(src5, src7);
- src0 = (v16u8)__msa_ld_b((v16i8*)s, 64);
- src1 = (v16u8)__msa_ld_b((v16i8*)s, 80);
- src2 = (v16u8)__msa_ld_b((v16i8*)s, 96);
- src3 = (v16u8)__msa_ld_b((v16i8*)s, 112);
- src4 = (v16u8)__msa_ld_b((v16i8*)t, 64);
- src5 = (v16u8)__msa_ld_b((v16i8*)t, 80);
- src6 = (v16u8)__msa_ld_b((v16i8*)t, 96);
- src7 = (v16u8)__msa_ld_b((v16i8*)t, 112);
- src0 = __msa_aver_u_b(src0, src4);
- src1 = __msa_aver_u_b(src1, src5);
- src2 = __msa_aver_u_b(src2, src6);
- src3 = __msa_aver_u_b(src3, src7);
- src4 = (v16u8)__msa_pckev_w((v4i32)src1, (v4i32)src0);
- src5 = (v16u8)__msa_pckev_w((v4i32)src3, (v4i32)src2);
- src6 = (v16u8)__msa_pckod_w((v4i32)src1, (v4i32)src0);
- src7 = (v16u8)__msa_pckod_w((v4i32)src3, (v4i32)src2);
- vec2 = __msa_aver_u_b(src4, src6);
- vec3 = __msa_aver_u_b(src5, src7);
- ARGBTOUV(vec0, vec1, vec2, vec3, const_0x6B14, const_0x7F, const_0x2B54,
- const_0x8080, shuffler1, shuffler0, shuffler2, shuffler3, dst0,
- dst1);
- ST_UB(dst0, dst_v);
- ST_UB(dst1, dst_u);
- s += 128;
- t += 128;
- dst_v += 16;
- dst_u += 16;
- }
- }
- void BGRAToUVRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- v16u8 dst0, dst1, vec0, vec1, vec2, vec3;
- v16i8 shuffler0 = {0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29};
- v16i8 shuffler1 = {2, 3, 6, 7, 10, 11, 14, 15,
- 18, 19, 22, 23, 26, 27, 30, 31};
- v16i8 shuffler2 = {0, 3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31};
- v16i8 shuffler3 = {2, 1, 6, 5, 10, 9, 14, 13, 18, 17, 22, 21, 26, 25, 30, 29};
- v16u8 const_0x125E = (v16u8)__msa_fill_h(0x125E);
- v16u8 const_0x7000 = (v16u8)__msa_fill_h(0x7000);
- v16u8 const_0x264A = (v16u8)__msa_fill_h(0x264A);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- for (x = 0; x < width; x += 32) {
- READ_ARGB(s, t, vec0, vec1, vec2, vec3);
- ARGBTOUV(vec0, vec1, vec2, vec3, const_0x125E, const_0x7000, const_0x264A,
- const_0x8080, shuffler0, shuffler1, shuffler2, shuffler3, dst0,
- dst1);
- ST_UB(dst0, dst_v);
- ST_UB(dst1, dst_u);
- s += 128;
- t += 128;
- dst_v += 16;
- dst_u += 16;
- }
- }
- void ABGRToUVRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- v16u8 src0, src1, src2, src3;
- v16u8 dst0, dst1;
- v16i8 shuffler0 = {0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29};
- v16i8 shuffler1 = {2, 3, 6, 7, 10, 11, 14, 15,
- 18, 19, 22, 23, 26, 27, 30, 31};
- v16i8 shuffler2 = {0, 3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31};
- v16i8 shuffler3 = {1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30};
- v16u8 const_0x4A26 = (v16u8)__msa_fill_h(0x4A26);
- v16u8 const_0x0070 = (v16u8)__msa_fill_h(0x0070);
- v16u8 const_0x125E = (v16u8)__msa_fill_h(0x125E);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- for (x = 0; x < width; x += 32) {
- READ_ARGB(s, t, src0, src1, src2, src3);
- ARGBTOUV(src0, src1, src2, src3, const_0x4A26, const_0x0070, const_0x125E,
- const_0x8080, shuffler1, shuffler0, shuffler2, shuffler3, dst0,
- dst1);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- s += 128;
- t += 128;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void RGBAToUVRow_MSA(const uint8_t* src_rgb0,
- int src_stride_rgb,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- const uint8_t* s = src_rgb0;
- const uint8_t* t = src_rgb0 + src_stride_rgb;
- v16u8 dst0, dst1, vec0, vec1, vec2, vec3;
- v16i8 shuffler0 = {0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29};
- v16i8 shuffler1 = {2, 3, 6, 7, 10, 11, 14, 15,
- 18, 19, 22, 23, 26, 27, 30, 31};
- v16i8 shuffler2 = {0, 3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31};
- v16i8 shuffler3 = {2, 1, 6, 5, 10, 9, 14, 13, 18, 17, 22, 21, 26, 25, 30, 29};
- v16u8 const_0x125E = (v16u8)__msa_fill_h(0x264A);
- v16u8 const_0x7000 = (v16u8)__msa_fill_h(0x7000);
- v16u8 const_0x264A = (v16u8)__msa_fill_h(0x125E);
- v8u16 const_0x8080 = (v8u16)__msa_fill_h(0x8080);
- for (x = 0; x < width; x += 32) {
- READ_ARGB(s, t, vec0, vec1, vec2, vec3);
- ARGBTOUV(vec0, vec1, vec2, vec3, const_0x125E, const_0x7000, const_0x264A,
- const_0x8080, shuffler0, shuffler1, shuffler2, shuffler3, dst0,
- dst1);
- ST_UB(dst0, dst_u);
- ST_UB(dst1, dst_v);
- s += 128;
- t += 128;
- dst_u += 16;
- dst_v += 16;
- }
- }
- void I444ToARGBRow_MSA(const uint8_t* src_y,
- const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2, dst0, dst1;
- v8u16 vec0, vec1, vec2;
- v4i32 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg8, reg9;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v8i16 zero = {0};
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- for (x = 0; x < width; x += 8) {
- READI444(src_y, src_u, src_v, src0, src1, src2);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- reg0 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec0);
- reg1 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec0);
- reg0 *= vec_yg;
- reg1 *= vec_yg;
- reg0 = __msa_srai_w(reg0, 16);
- reg1 = __msa_srai_w(reg1, 16);
- reg4 = reg0 + vec_br;
- reg5 = reg1 + vec_br;
- reg2 = reg0 + vec_bg;
- reg3 = reg1 + vec_bg;
- reg0 += vec_bb;
- reg1 += vec_bb;
- vec0 = (v8u16)__msa_ilvr_b((v16i8)zero, (v16i8)src1);
- vec1 = (v8u16)__msa_ilvr_b((v16i8)zero, (v16i8)src2);
- reg6 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec0);
- reg7 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec0);
- reg8 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec1);
- reg9 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec1);
- reg0 -= reg6 * vec_ub;
- reg1 -= reg7 * vec_ub;
- reg2 -= reg6 * vec_ug;
- reg3 -= reg7 * vec_ug;
- reg4 -= reg8 * vec_vr;
- reg5 -= reg9 * vec_vr;
- reg2 -= reg8 * vec_vg;
- reg3 -= reg9 * vec_vg;
- reg0 = __msa_srai_w(reg0, 6);
- reg1 = __msa_srai_w(reg1, 6);
- reg2 = __msa_srai_w(reg2, 6);
- reg3 = __msa_srai_w(reg3, 6);
- reg4 = __msa_srai_w(reg4, 6);
- reg5 = __msa_srai_w(reg5, 6);
- CLIP_0TO255(reg0, reg1, reg2, reg3, reg4, reg5);
- vec0 = (v8u16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8u16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec2 = (v8u16)__msa_pckev_h((v8i16)reg5, (v8i16)reg4);
- vec0 = (v8u16)__msa_ilvev_b((v16i8)vec1, (v16i8)vec0);
- vec1 = (v8u16)__msa_ilvev_b((v16i8)alpha, (v16i8)vec2);
- dst0 = (v16u8)__msa_ilvr_h((v8i16)vec1, (v8i16)vec0);
- dst1 = (v16u8)__msa_ilvl_h((v8i16)vec1, (v8i16)vec0);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_y += 8;
- src_u += 8;
- src_v += 8;
- dst_argb += 32;
- }
- }
- void I400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* dst_argb, int width) {
- int x;
- v16u8 src0, res0, res1, res2, res3, res4, dst0, dst1, dst2, dst3;
- v8i16 vec0, vec1;
- v4i32 reg0, reg1, reg2, reg3;
- v4i32 vec_yg = __msa_fill_w(0x4A35);
- v8i16 vec_ygb = __msa_fill_h(0xFB78);
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- v8i16 max = __msa_ldi_h(0xFF);
- v8i16 zero = {0};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_y, 0);
- vec0 = (v8i16)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- vec1 = (v8i16)__msa_ilvl_b((v16i8)src0, (v16i8)src0);
- reg0 = (v4i32)__msa_ilvr_h(zero, vec0);
- reg1 = (v4i32)__msa_ilvl_h(zero, vec0);
- reg2 = (v4i32)__msa_ilvr_h(zero, vec1);
- reg3 = (v4i32)__msa_ilvl_h(zero, vec1);
- reg0 *= vec_yg;
- reg1 *= vec_yg;
- reg2 *= vec_yg;
- reg3 *= vec_yg;
- reg0 = __msa_srai_w(reg0, 16);
- reg1 = __msa_srai_w(reg1, 16);
- reg2 = __msa_srai_w(reg2, 16);
- reg3 = __msa_srai_w(reg3, 16);
- vec0 = (v8i16)__msa_pckev_h((v8i16)reg1, (v8i16)reg0);
- vec1 = (v8i16)__msa_pckev_h((v8i16)reg3, (v8i16)reg2);
- vec0 += vec_ygb;
- vec1 += vec_ygb;
- vec0 = __msa_srai_h(vec0, 6);
- vec1 = __msa_srai_h(vec1, 6);
- vec0 = __msa_maxi_s_h(vec0, 0);
- vec1 = __msa_maxi_s_h(vec1, 0);
- vec0 = __msa_min_s_h(max, vec0);
- vec1 = __msa_min_s_h(max, vec1);
- res0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- res1 = (v16u8)__msa_ilvr_b((v16i8)res0, (v16i8)res0);
- res2 = (v16u8)__msa_ilvl_b((v16i8)res0, (v16i8)res0);
- res3 = (v16u8)__msa_ilvr_b((v16i8)alpha, (v16i8)res0);
- res4 = (v16u8)__msa_ilvl_b((v16i8)alpha, (v16i8)res0);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)res3, (v16i8)res1);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)res3, (v16i8)res1);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)res4, (v16i8)res2);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)res4, (v16i8)res2);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_y += 16;
- dst_argb += 64;
- }
- }
- void J400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* dst_argb, int width) {
- int x;
- v16u8 src0, vec0, vec1, vec2, vec3, dst0, dst1, dst2, dst3;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_y, 0);
- vec0 = (v16u8)__msa_ilvr_b((v16i8)src0, (v16i8)src0);
- vec1 = (v16u8)__msa_ilvl_b((v16i8)src0, (v16i8)src0);
- vec2 = (v16u8)__msa_ilvr_b((v16i8)alpha, (v16i8)src0);
- vec3 = (v16u8)__msa_ilvl_b((v16i8)alpha, (v16i8)src0);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)vec2, (v16i8)vec0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)vec2, (v16i8)vec0);
- dst2 = (v16u8)__msa_ilvr_b((v16i8)vec3, (v16i8)vec1);
- dst3 = (v16u8)__msa_ilvl_b((v16i8)vec3, (v16i8)vec1);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- src_y += 16;
- dst_argb += 64;
- }
- }
- void YUY2ToARGBRow_MSA(const uint8_t* src_yuy2,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_yuy2, 0);
- src1 = (v16u8)__msa_pckev_b((v16i8)src0, (v16i8)src0);
- src2 = (v16u8)__msa_pckod_b((v16i8)src0, (v16i8)src0);
- YUVTORGB(src1, src2, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
- src_yuy2 += 16;
- dst_argb += 32;
- }
- }
- void UYVYToARGBRow_MSA(const uint8_t* src_uyvy,
- uint8_t* dst_argb,
- const struct YuvConstants* yuvconstants,
- int width) {
- int x;
- v16u8 src0, src1, src2;
- v8i16 vec0, vec1, vec2;
- v4i32 vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg, vec_br, vec_yg;
- v4i32 vec_ubvr, vec_ugvg;
- v16u8 alpha = (v16u8)__msa_ldi_b(ALPHA_VAL);
- YUVTORGB_SETUP(yuvconstants, vec_ub, vec_vr, vec_ug, vec_vg, vec_bb, vec_bg,
- vec_br, vec_yg);
- vec_ubvr = __msa_ilvr_w(vec_vr, vec_ub);
- vec_ugvg = (v4i32)__msa_ilvev_h((v8i16)vec_vg, (v8i16)vec_ug);
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_uyvy, 0);
- src1 = (v16u8)__msa_pckod_b((v16i8)src0, (v16i8)src0);
- src2 = (v16u8)__msa_pckev_b((v16i8)src0, (v16i8)src0);
- YUVTORGB(src1, src2, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
- vec0, vec1, vec2);
- STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
- src_uyvy += 16;
- dst_argb += 32;
- }
- }
- void InterpolateRow_MSA(uint8_t* dst_ptr,
- const uint8_t* src_ptr,
- ptrdiff_t src_stride,
- int width,
- int32_t source_y_fraction) {
- int32_t y1_fraction = source_y_fraction;
- int32_t y0_fraction = 256 - y1_fraction;
- uint16_t y_fractions;
- const uint8_t* s = src_ptr;
- const uint8_t* t = src_ptr + src_stride;
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- v8u16 vec0, vec1, vec2, vec3, y_frac;
- if (0 == y1_fraction) {
- memcpy(dst_ptr, src_ptr, width);
- return;
- }
- if (128 == y1_fraction) {
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)s, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)s, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)t, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)t, 16);
- dst0 = __msa_aver_u_b(src0, src2);
- dst1 = __msa_aver_u_b(src1, src3);
- ST_UB2(dst0, dst1, dst_ptr, 16);
- s += 32;
- t += 32;
- dst_ptr += 32;
- }
- return;
- }
- y_fractions = (uint16_t)(y0_fraction + (y1_fraction << 8));
- y_frac = (v8u16)__msa_fill_h(y_fractions);
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)s, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)s, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)t, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)t, 16);
- vec0 = (v8u16)__msa_ilvr_b((v16i8)src2, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b((v16i8)src2, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b((v16i8)src3, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b((v16i8)src3, (v16i8)src1);
- vec0 = (v8u16)__msa_dotp_u_h((v16u8)vec0, (v16u8)y_frac);
- vec1 = (v8u16)__msa_dotp_u_h((v16u8)vec1, (v16u8)y_frac);
- vec2 = (v8u16)__msa_dotp_u_h((v16u8)vec2, (v16u8)y_frac);
- vec3 = (v8u16)__msa_dotp_u_h((v16u8)vec3, (v16u8)y_frac);
- vec0 = (v8u16)__msa_srari_h((v8i16)vec0, 8);
- vec1 = (v8u16)__msa_srari_h((v8i16)vec1, 8);
- vec2 = (v8u16)__msa_srari_h((v8i16)vec2, 8);
- vec3 = (v8u16)__msa_srari_h((v8i16)vec3, 8);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- ST_UB2(dst0, dst1, dst_ptr, 16);
- s += 32;
- t += 32;
- dst_ptr += 32;
- }
- }
- void ARGBSetRow_MSA(uint8_t* dst_argb, uint32_t v32, int width) {
- int x;
- v4i32 dst0 = __builtin_msa_fill_w(v32);
- for (x = 0; x < width; x += 4) {
- ST_UB(dst0, dst_argb);
- dst_argb += 16;
- }
- }
- void RAWToRGB24Row_MSA(const uint8_t* src_raw, uint8_t* dst_rgb24, int width) {
- int x;
- v16u8 src0, src1, src2, src3, src4, dst0, dst1, dst2;
- v16i8 shuffler0 = {2, 1, 0, 5, 4, 3, 8, 7, 6, 11, 10, 9, 14, 13, 12, 17};
- v16i8 shuffler1 = {8, 7, 12, 11, 10, 15, 14, 13,
- 18, 17, 16, 21, 20, 19, 24, 23};
- v16i8 shuffler2 = {14, 19, 18, 17, 22, 21, 20, 25,
- 24, 23, 28, 27, 26, 31, 30, 29};
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_raw, 32);
- src3 = (v16u8)__msa_sldi_b((v16i8)src1, (v16i8)src0, 8);
- src4 = (v16u8)__msa_sldi_b((v16i8)src2, (v16i8)src1, 8);
- dst0 = (v16u8)__msa_vshf_b(shuffler0, (v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(shuffler1, (v16i8)src4, (v16i8)src3);
- dst2 = (v16u8)__msa_vshf_b(shuffler2, (v16i8)src2, (v16i8)src1);
- ST_UB2(dst0, dst1, dst_rgb24, 16);
- ST_UB(dst2, (dst_rgb24 + 32));
- src_raw += 48;
- dst_rgb24 += 48;
- }
- }
- void MergeUVRow_MSA(const uint8_t* src_u,
- const uint8_t* src_v,
- uint8_t* dst_uv,
- int width) {
- int x;
- v16u8 src0, src1, dst0, dst1;
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_u, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_v, 0);
- dst0 = (v16u8)__msa_ilvr_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_ilvl_b((v16i8)src1, (v16i8)src0);
- ST_UB2(dst0, dst1, dst_uv, 16);
- src_u += 16;
- src_v += 16;
- dst_uv += 32;
- }
- }
- void ARGBExtractAlphaRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_a,
- int width) {
- int i;
- v16u8 src0, src1, src2, src3, vec0, vec1, dst0;
- for (i = 0; i < width; i += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 48);
- vec0 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- vec1 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- dst0 = (v16u8)__msa_pckod_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_a);
- src_argb += 64;
- dst_a += 16;
- }
- }
- void ARGBBlendRow_MSA(const uint8_t* src_argb0,
- const uint8_t* src_argb1,
- uint8_t* dst_argb,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1;
- v8u16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v8u16 vec8, vec9, vec10, vec11, vec12, vec13;
- v8u16 const_256 = (v8u16)__msa_ldi_h(256);
- v16u8 const_255 = (v16u8)__msa_ldi_b(255);
- v16u8 mask = {0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_argb1, 16);
- vec0 = (v8u16)__msa_ilvr_b(zero, (v16i8)src0);
- vec1 = (v8u16)__msa_ilvl_b(zero, (v16i8)src0);
- vec2 = (v8u16)__msa_ilvr_b(zero, (v16i8)src1);
- vec3 = (v8u16)__msa_ilvl_b(zero, (v16i8)src1);
- vec4 = (v8u16)__msa_ilvr_b(zero, (v16i8)src2);
- vec5 = (v8u16)__msa_ilvl_b(zero, (v16i8)src2);
- vec6 = (v8u16)__msa_ilvr_b(zero, (v16i8)src3);
- vec7 = (v8u16)__msa_ilvl_b(zero, (v16i8)src3);
- vec8 = (v8u16)__msa_fill_h(vec0[3]);
- vec9 = (v8u16)__msa_fill_h(vec0[7]);
- vec10 = (v8u16)__msa_fill_h(vec1[3]);
- vec11 = (v8u16)__msa_fill_h(vec1[7]);
- vec8 = (v8u16)__msa_pckev_d((v2i64)vec9, (v2i64)vec8);
- vec9 = (v8u16)__msa_pckev_d((v2i64)vec11, (v2i64)vec10);
- vec10 = (v8u16)__msa_fill_h(vec2[3]);
- vec11 = (v8u16)__msa_fill_h(vec2[7]);
- vec12 = (v8u16)__msa_fill_h(vec3[3]);
- vec13 = (v8u16)__msa_fill_h(vec3[7]);
- vec10 = (v8u16)__msa_pckev_d((v2i64)vec11, (v2i64)vec10);
- vec11 = (v8u16)__msa_pckev_d((v2i64)vec13, (v2i64)vec12);
- vec8 = const_256 - vec8;
- vec9 = const_256 - vec9;
- vec10 = const_256 - vec10;
- vec11 = const_256 - vec11;
- vec8 *= vec4;
- vec9 *= vec5;
- vec10 *= vec6;
- vec11 *= vec7;
- vec8 = (v8u16)__msa_srai_h((v8i16)vec8, 8);
- vec9 = (v8u16)__msa_srai_h((v8i16)vec9, 8);
- vec10 = (v8u16)__msa_srai_h((v8i16)vec10, 8);
- vec11 = (v8u16)__msa_srai_h((v8i16)vec11, 8);
- vec0 += vec8;
- vec1 += vec9;
- vec2 += vec10;
- vec3 += vec11;
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- dst0 = __msa_bmnz_v(dst0, const_255, mask);
- dst1 = __msa_bmnz_v(dst1, const_255, mask);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb0 += 32;
- src_argb1 += 32;
- dst_argb += 32;
- }
- }
- void ARGBQuantizeRow_MSA(uint8_t* dst_argb,
- int scale,
- int interval_size,
- int interval_offset,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1, dst2, dst3;
- v8i16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v4i32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- v4i32 tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
- v4i32 vec_scale = __msa_fill_w(scale);
- v16u8 vec_int_sz = (v16u8)__msa_fill_b(interval_size);
- v16u8 vec_int_ofst = (v16u8)__msa_fill_b(interval_offset);
- v16i8 mask = {0, 1, 2, 19, 4, 5, 6, 23, 8, 9, 10, 27, 12, 13, 14, 31};
- v16i8 zero = {0};
- for (x = 0; x < width; x += 8) {
- src0 = (v16u8)__msa_ld_b((v16i8*)dst_argb, 0);
- src1 = (v16u8)__msa_ld_b((v16i8*)dst_argb, 16);
- src2 = (v16u8)__msa_ld_b((v16i8*)dst_argb, 32);
- src3 = (v16u8)__msa_ld_b((v16i8*)dst_argb, 48);
- vec0 = (v8i16)__msa_ilvr_b(zero, (v16i8)src0);
- vec1 = (v8i16)__msa_ilvl_b(zero, (v16i8)src0);
- vec2 = (v8i16)__msa_ilvr_b(zero, (v16i8)src1);
- vec3 = (v8i16)__msa_ilvl_b(zero, (v16i8)src1);
- vec4 = (v8i16)__msa_ilvr_b(zero, (v16i8)src2);
- vec5 = (v8i16)__msa_ilvl_b(zero, (v16i8)src2);
- vec6 = (v8i16)__msa_ilvr_b(zero, (v16i8)src3);
- vec7 = (v8i16)__msa_ilvl_b(zero, (v16i8)src3);
- tmp0 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec0);
- tmp1 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec0);
- tmp2 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec1);
- tmp3 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec1);
- tmp4 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec2);
- tmp5 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec2);
- tmp6 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec3);
- tmp7 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec3);
- tmp8 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec4);
- tmp9 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec4);
- tmp10 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec5);
- tmp11 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec5);
- tmp12 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec6);
- tmp13 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec6);
- tmp14 = (v4i32)__msa_ilvr_h((v8i16)zero, (v8i16)vec7);
- tmp15 = (v4i32)__msa_ilvl_h((v8i16)zero, (v8i16)vec7);
- tmp0 *= vec_scale;
- tmp1 *= vec_scale;
- tmp2 *= vec_scale;
- tmp3 *= vec_scale;
- tmp4 *= vec_scale;
- tmp5 *= vec_scale;
- tmp6 *= vec_scale;
- tmp7 *= vec_scale;
- tmp8 *= vec_scale;
- tmp9 *= vec_scale;
- tmp10 *= vec_scale;
- tmp11 *= vec_scale;
- tmp12 *= vec_scale;
- tmp13 *= vec_scale;
- tmp14 *= vec_scale;
- tmp15 *= vec_scale;
- tmp0 >>= 16;
- tmp1 >>= 16;
- tmp2 >>= 16;
- tmp3 >>= 16;
- tmp4 >>= 16;
- tmp5 >>= 16;
- tmp6 >>= 16;
- tmp7 >>= 16;
- tmp8 >>= 16;
- tmp9 >>= 16;
- tmp10 >>= 16;
- tmp11 >>= 16;
- tmp12 >>= 16;
- tmp13 >>= 16;
- tmp14 >>= 16;
- tmp15 >>= 16;
- vec0 = (v8i16)__msa_pckev_h((v8i16)tmp1, (v8i16)tmp0);
- vec1 = (v8i16)__msa_pckev_h((v8i16)tmp3, (v8i16)tmp2);
- vec2 = (v8i16)__msa_pckev_h((v8i16)tmp5, (v8i16)tmp4);
- vec3 = (v8i16)__msa_pckev_h((v8i16)tmp7, (v8i16)tmp6);
- vec4 = (v8i16)__msa_pckev_h((v8i16)tmp9, (v8i16)tmp8);
- vec5 = (v8i16)__msa_pckev_h((v8i16)tmp11, (v8i16)tmp10);
- vec6 = (v8i16)__msa_pckev_h((v8i16)tmp13, (v8i16)tmp12);
- vec7 = (v8i16)__msa_pckev_h((v8i16)tmp15, (v8i16)tmp14);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
- dst2 = (v16u8)__msa_pckev_b((v16i8)vec5, (v16i8)vec4);
- dst3 = (v16u8)__msa_pckev_b((v16i8)vec7, (v16i8)vec6);
- dst0 *= vec_int_sz;
- dst1 *= vec_int_sz;
- dst2 *= vec_int_sz;
- dst3 *= vec_int_sz;
- dst0 += vec_int_ofst;
- dst1 += vec_int_ofst;
- dst2 += vec_int_ofst;
- dst3 += vec_int_ofst;
- dst0 = (v16u8)__msa_vshf_b(mask, (v16i8)src0, (v16i8)dst0);
- dst1 = (v16u8)__msa_vshf_b(mask, (v16i8)src1, (v16i8)dst1);
- dst2 = (v16u8)__msa_vshf_b(mask, (v16i8)src2, (v16i8)dst2);
- dst3 = (v16u8)__msa_vshf_b(mask, (v16i8)src3, (v16i8)dst3);
- ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
- dst_argb += 64;
- }
- }
- void ARGBColorMatrixRow_MSA(const uint8_t* src_argb,
- uint8_t* dst_argb,
- const int8_t* matrix_argb,
- int width) {
- int32_t x;
- v16i8 src0;
- v16u8 src1, src2, dst0, dst1;
- v8i16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9;
- v8i16 vec10, vec11, vec12, vec13, vec14, vec15, vec16, vec17;
- v4i32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- v4i32 tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
- v16i8 zero = {0};
- v8i16 max = __msa_ldi_h(255);
- src0 = __msa_ld_b((v16i8*)matrix_argb, 0);
- vec0 = (v8i16)__msa_ilvr_b(zero, src0);
- vec1 = (v8i16)__msa_ilvl_b(zero, src0);
- for (x = 0; x < width; x += 8) {
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 0);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_argb, 16);
- vec2 = (v8i16)__msa_ilvr_b(zero, (v16i8)src1);
- vec3 = (v8i16)__msa_ilvl_b(zero, (v16i8)src1);
- vec4 = (v8i16)__msa_ilvr_b(zero, (v16i8)src2);
- vec5 = (v8i16)__msa_ilvl_b(zero, (v16i8)src2);
- vec6 = (v8i16)__msa_pckod_d((v2i64)vec2, (v2i64)vec2);
- vec7 = (v8i16)__msa_pckod_d((v2i64)vec3, (v2i64)vec3);
- vec8 = (v8i16)__msa_pckod_d((v2i64)vec4, (v2i64)vec4);
- vec9 = (v8i16)__msa_pckod_d((v2i64)vec5, (v2i64)vec5);
- vec2 = (v8i16)__msa_pckev_d((v2i64)vec2, (v2i64)vec2);
- vec3 = (v8i16)__msa_pckev_d((v2i64)vec3, (v2i64)vec3);
- vec4 = (v8i16)__msa_pckev_d((v2i64)vec4, (v2i64)vec4);
- vec5 = (v8i16)__msa_pckev_d((v2i64)vec5, (v2i64)vec5);
- vec10 = vec2 * vec0;
- vec11 = vec2 * vec1;
- vec12 = vec6 * vec0;
- vec13 = vec6 * vec1;
- tmp0 = __msa_hadd_s_w(vec10, vec10);
- tmp1 = __msa_hadd_s_w(vec11, vec11);
- tmp2 = __msa_hadd_s_w(vec12, vec12);
- tmp3 = __msa_hadd_s_w(vec13, vec13);
- vec14 = vec3 * vec0;
- vec15 = vec3 * vec1;
- vec16 = vec7 * vec0;
- vec17 = vec7 * vec1;
- tmp4 = __msa_hadd_s_w(vec14, vec14);
- tmp5 = __msa_hadd_s_w(vec15, vec15);
- tmp6 = __msa_hadd_s_w(vec16, vec16);
- tmp7 = __msa_hadd_s_w(vec17, vec17);
- vec10 = __msa_pckev_h((v8i16)tmp1, (v8i16)tmp0);
- vec11 = __msa_pckev_h((v8i16)tmp3, (v8i16)tmp2);
- vec12 = __msa_pckev_h((v8i16)tmp5, (v8i16)tmp4);
- vec13 = __msa_pckev_h((v8i16)tmp7, (v8i16)tmp6);
- tmp0 = __msa_hadd_s_w(vec10, vec10);
- tmp1 = __msa_hadd_s_w(vec11, vec11);
- tmp2 = __msa_hadd_s_w(vec12, vec12);
- tmp3 = __msa_hadd_s_w(vec13, vec13);
- tmp0 = __msa_srai_w(tmp0, 6);
- tmp1 = __msa_srai_w(tmp1, 6);
- tmp2 = __msa_srai_w(tmp2, 6);
- tmp3 = __msa_srai_w(tmp3, 6);
- vec2 = vec4 * vec0;
- vec6 = vec4 * vec1;
- vec3 = vec8 * vec0;
- vec7 = vec8 * vec1;
- tmp8 = __msa_hadd_s_w(vec2, vec2);
- tmp9 = __msa_hadd_s_w(vec6, vec6);
- tmp10 = __msa_hadd_s_w(vec3, vec3);
- tmp11 = __msa_hadd_s_w(vec7, vec7);
- vec4 = vec5 * vec0;
- vec8 = vec5 * vec1;
- vec5 = vec9 * vec0;
- vec9 = vec9 * vec1;
- tmp12 = __msa_hadd_s_w(vec4, vec4);
- tmp13 = __msa_hadd_s_w(vec8, vec8);
- tmp14 = __msa_hadd_s_w(vec5, vec5);
- tmp15 = __msa_hadd_s_w(vec9, vec9);
- vec14 = __msa_pckev_h((v8i16)tmp9, (v8i16)tmp8);
- vec15 = __msa_pckev_h((v8i16)tmp11, (v8i16)tmp10);
- vec16 = __msa_pckev_h((v8i16)tmp13, (v8i16)tmp12);
- vec17 = __msa_pckev_h((v8i16)tmp15, (v8i16)tmp14);
- tmp4 = __msa_hadd_s_w(vec14, vec14);
- tmp5 = __msa_hadd_s_w(vec15, vec15);
- tmp6 = __msa_hadd_s_w(vec16, vec16);
- tmp7 = __msa_hadd_s_w(vec17, vec17);
- tmp4 = __msa_srai_w(tmp4, 6);
- tmp5 = __msa_srai_w(tmp5, 6);
- tmp6 = __msa_srai_w(tmp6, 6);
- tmp7 = __msa_srai_w(tmp7, 6);
- vec10 = __msa_pckev_h((v8i16)tmp1, (v8i16)tmp0);
- vec11 = __msa_pckev_h((v8i16)tmp3, (v8i16)tmp2);
- vec12 = __msa_pckev_h((v8i16)tmp5, (v8i16)tmp4);
- vec13 = __msa_pckev_h((v8i16)tmp7, (v8i16)tmp6);
- vec10 = __msa_maxi_s_h(vec10, 0);
- vec11 = __msa_maxi_s_h(vec11, 0);
- vec12 = __msa_maxi_s_h(vec12, 0);
- vec13 = __msa_maxi_s_h(vec13, 0);
- vec10 = __msa_min_s_h(vec10, max);
- vec11 = __msa_min_s_h(vec11, max);
- vec12 = __msa_min_s_h(vec12, max);
- vec13 = __msa_min_s_h(vec13, max);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec11, (v16i8)vec10);
- dst1 = (v16u8)__msa_pckev_b((v16i8)vec13, (v16i8)vec12);
- ST_UB2(dst0, dst1, dst_argb, 16);
- src_argb += 32;
- dst_argb += 32;
- }
- }
- void SplitUVRow_MSA(const uint8_t* src_uv,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3, dst0, dst1, dst2, dst3;
- for (x = 0; x < width; x += 32) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 32);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 48);
- dst0 = (v16u8)__msa_pckev_b((v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_pckev_b((v16i8)src3, (v16i8)src2);
- dst2 = (v16u8)__msa_pckod_b((v16i8)src1, (v16i8)src0);
- dst3 = (v16u8)__msa_pckod_b((v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_u, 16);
- ST_UB2(dst2, dst3, dst_v, 16);
- src_uv += 64;
- dst_u += 32;
- dst_v += 32;
- }
- }
- void SetRow_MSA(uint8_t* dst, uint8_t v8, int width) {
- int x;
- v16u8 dst0 = (v16u8)__msa_fill_b(v8);
- for (x = 0; x < width; x += 16) {
- ST_UB(dst0, dst);
- dst += 16;
- }
- }
- void MirrorUVRow_MSA(const uint8_t* src_uv,
- uint8_t* dst_u,
- uint8_t* dst_v,
- int width) {
- int x;
- v16u8 src0, src1, src2, src3;
- v16u8 dst0, dst1, dst2, dst3;
- v16i8 mask0 = {30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0};
- v16i8 mask1 = {31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1};
- src_uv += (2 * width);
- for (x = 0; x < width; x += 32) {
- src_uv -= 64;
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 16);
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 32);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_uv, 48);
- dst0 = (v16u8)__msa_vshf_b(mask1, (v16i8)src1, (v16i8)src0);
- dst1 = (v16u8)__msa_vshf_b(mask1, (v16i8)src3, (v16i8)src2);
- dst2 = (v16u8)__msa_vshf_b(mask0, (v16i8)src1, (v16i8)src0);
- dst3 = (v16u8)__msa_vshf_b(mask0, (v16i8)src3, (v16i8)src2);
- ST_UB2(dst0, dst1, dst_v, 16);
- ST_UB2(dst2, dst3, dst_u, 16);
- dst_u += 32;
- dst_v += 32;
- }
- }
- void SobelXRow_MSA(const uint8_t* src_y0,
- const uint8_t* src_y1,
- const uint8_t* src_y2,
- uint8_t* dst_sobelx,
- int32_t width) {
- int x;
- v16u8 src0, src1, src2, src3, src4, src5, dst0;
- v8i16 vec0, vec1, vec2, vec3, vec4, vec5;
- v16i8 mask0 = {0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9};
- v16i8 tmp = __msa_ldi_b(8);
- v16i8 mask1 = mask0 + tmp;
- v8i16 zero = {0};
- v8i16 max = __msa_ldi_h(255);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_y0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_y0, 16);
- src2 = (v16u8)__msa_ld_b((const v16i8*)src_y1, 0);
- src3 = (v16u8)__msa_ld_b((const v16i8*)src_y1, 16);
- src4 = (v16u8)__msa_ld_b((const v16i8*)src_y2, 0);
- src5 = (v16u8)__msa_ld_b((const v16i8*)src_y2, 16);
- vec0 = (v8i16)__msa_vshf_b(mask0, (v16i8)src1, (v16i8)src0);
- vec1 = (v8i16)__msa_vshf_b(mask1, (v16i8)src1, (v16i8)src0);
- vec2 = (v8i16)__msa_vshf_b(mask0, (v16i8)src3, (v16i8)src2);
- vec3 = (v8i16)__msa_vshf_b(mask1, (v16i8)src3, (v16i8)src2);
- vec4 = (v8i16)__msa_vshf_b(mask0, (v16i8)src5, (v16i8)src4);
- vec5 = (v8i16)__msa_vshf_b(mask1, (v16i8)src5, (v16i8)src4);
- vec0 = (v8i16)__msa_hsub_u_h((v16u8)vec0, (v16u8)vec0);
- vec1 = (v8i16)__msa_hsub_u_h((v16u8)vec1, (v16u8)vec1);
- vec2 = (v8i16)__msa_hsub_u_h((v16u8)vec2, (v16u8)vec2);
- vec3 = (v8i16)__msa_hsub_u_h((v16u8)vec3, (v16u8)vec3);
- vec4 = (v8i16)__msa_hsub_u_h((v16u8)vec4, (v16u8)vec4);
- vec5 = (v8i16)__msa_hsub_u_h((v16u8)vec5, (v16u8)vec5);
- vec0 += vec2;
- vec1 += vec3;
- vec4 += vec2;
- vec5 += vec3;
- vec0 += vec4;
- vec1 += vec5;
- vec0 = __msa_add_a_h(zero, vec0);
- vec1 = __msa_add_a_h(zero, vec1);
- vec0 = __msa_maxi_s_h(vec0, 0);
- vec1 = __msa_maxi_s_h(vec1, 0);
- vec0 = __msa_min_s_h(max, vec0);
- vec1 = __msa_min_s_h(max, vec1);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_sobelx);
- src_y0 += 16;
- src_y1 += 16;
- src_y2 += 16;
- dst_sobelx += 16;
- }
- }
- void SobelYRow_MSA(const uint8_t* src_y0,
- const uint8_t* src_y1,
- uint8_t* dst_sobely,
- int32_t width) {
- int x;
- v16u8 src0, src1, dst0;
- v8i16 vec0, vec1, vec2, vec3, vec4, vec5, vec6;
- v8i16 zero = {0};
- v8i16 max = __msa_ldi_h(255);
- for (x = 0; x < width; x += 16) {
- src0 = (v16u8)__msa_ld_b((const v16i8*)src_y0, 0);
- src1 = (v16u8)__msa_ld_b((const v16i8*)src_y1, 0);
- vec0 = (v8i16)__msa_ilvr_b((v16i8)zero, (v16i8)src0);
- vec1 = (v8i16)__msa_ilvl_b((v16i8)zero, (v16i8)src0);
- vec2 = (v8i16)__msa_ilvr_b((v16i8)zero, (v16i8)src1);
- vec3 = (v8i16)__msa_ilvl_b((v16i8)zero, (v16i8)src1);
- vec0 -= vec2;
- vec1 -= vec3;
- vec6[0] = src_y0[16] - src_y1[16];
- vec6[1] = src_y0[17] - src_y1[17];
- vec2 = (v8i16)__msa_sldi_b((v16i8)vec1, (v16i8)vec0, 2);
- vec3 = (v8i16)__msa_sldi_b((v16i8)vec6, (v16i8)vec1, 2);
- vec4 = (v8i16)__msa_sldi_b((v16i8)vec1, (v16i8)vec0, 4);
- vec5 = (v8i16)__msa_sldi_b((v16i8)vec6, (v16i8)vec1, 4);
- vec0 += vec2;
- vec1 += vec3;
- vec4 += vec2;
- vec5 += vec3;
- vec0 += vec4;
- vec1 += vec5;
- vec0 = __msa_add_a_h(zero, vec0);
- vec1 = __msa_add_a_h(zero, vec1);
- vec0 = __msa_maxi_s_h(vec0, 0);
- vec1 = __msa_maxi_s_h(vec1, 0);
- vec0 = __msa_min_s_h(max, vec0);
- vec1 = __msa_min_s_h(max, vec1);
- dst0 = (v16u8)__msa_pckev_b((v16i8)vec1, (v16i8)vec0);
- ST_UB(dst0, dst_sobely);
- src_y0 += 16;
- src_y1 += 16;
- dst_sobely += 16;
- }
- }
- void HalfFloatRow_MSA(const uint16_t* src,
- uint16_t* dst,
- float scale,
- int width) {
- int i;
- v8u16 src0, src1, src2, src3, dst0, dst1, dst2, dst3;
- v4u32 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
- v4f32 fvec0, fvec1, fvec2, fvec3, fvec4, fvec5, fvec6, fvec7;
- v4f32 mult_vec;
- v8i16 zero = {0};
- mult_vec[0] = 1.9259299444e-34f * scale;
- mult_vec = (v4f32)__msa_splati_w((v4i32)mult_vec, 0);
- for (i = 0; i < width; i += 32) {
- src0 = (v8u16)__msa_ld_h((v8i16*)src, 0);
- src1 = (v8u16)__msa_ld_h((v8i16*)src, 16);
- src2 = (v8u16)__msa_ld_h((v8i16*)src, 32);
- src3 = (v8u16)__msa_ld_h((v8i16*)src, 48);
- vec0 = (v4u32)__msa_ilvr_h(zero, (v8i16)src0);
- vec1 = (v4u32)__msa_ilvl_h(zero, (v8i16)src0);
- vec2 = (v4u32)__msa_ilvr_h(zero, (v8i16)src1);
- vec3 = (v4u32)__msa_ilvl_h(zero, (v8i16)src1);
- vec4 = (v4u32)__msa_ilvr_h(zero, (v8i16)src2);
- vec5 = (v4u32)__msa_ilvl_h(zero, (v8i16)src2);
- vec6 = (v4u32)__msa_ilvr_h(zero, (v8i16)src3);
- vec7 = (v4u32)__msa_ilvl_h(zero, (v8i16)src3);
- fvec0 = __msa_ffint_u_w(vec0);
- fvec1 = __msa_ffint_u_w(vec1);
- fvec2 = __msa_ffint_u_w(vec2);
- fvec3 = __msa_ffint_u_w(vec3);
- fvec4 = __msa_ffint_u_w(vec4);
- fvec5 = __msa_ffint_u_w(vec5);
- fvec6 = __msa_ffint_u_w(vec6);
- fvec7 = __msa_ffint_u_w(vec7);
- fvec0 *= mult_vec;
- fvec1 *= mult_vec;
- fvec2 *= mult_vec;
- fvec3 *= mult_vec;
- fvec4 *= mult_vec;
- fvec5 *= mult_vec;
- fvec6 *= mult_vec;
- fvec7 *= mult_vec;
- vec0 = ((v4u32)fvec0) >> 13;
- vec1 = ((v4u32)fvec1) >> 13;
- vec2 = ((v4u32)fvec2) >> 13;
- vec3 = ((v4u32)fvec3) >> 13;
- vec4 = ((v4u32)fvec4) >> 13;
- vec5 = ((v4u32)fvec5) >> 13;
- vec6 = ((v4u32)fvec6) >> 13;
- vec7 = ((v4u32)fvec7) >> 13;
- dst0 = (v8u16)__msa_pckev_h((v8i16)vec1, (v8i16)vec0);
- dst1 = (v8u16)__msa_pckev_h((v8i16)vec3, (v8i16)vec2);
- dst2 = (v8u16)__msa_pckev_h((v8i16)vec5, (v8i16)vec4);
- dst3 = (v8u16)__msa_pckev_h((v8i16)vec7, (v8i16)vec6);
- ST_UH2(dst0, dst1, dst, 8);
- ST_UH2(dst2, dst3, dst + 16, 8);
- src += 32;
- dst += 32;
- }
- }
- #ifdef __cplusplus
- } // extern "C"
- } // namespace libyuv
- #endif
- #endif // !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
|