Em ter 11 fev 2014, às 14:32:10, Jason H escreveu: > constuchar*bits=frame.bits(); > for(inty=0;y<frame.height();y++) > { > QRgb*scanLine=(QRgb*)converted.scanLine(y); > for(intx=0;x<frame.width();x++) > { > intc=bits[y*frame.width()+x]; > scanLine[x]=qRgba(c,c,c,255); > } > }
You should add spaces, otherwise your code won't compile. You can also try this as the inner loop (assumes the width is a multiple of 4). It requires SSSE3: _m128i control = _mm_set_epi32(0xff030303, 0xff020202, 0xff010101, 0xff000000); for (int x = 0; x < frame.width(); x += 4) { // load 4 Y bytes uint yyyy = *(uint *)&bits[y*frame.width() + x]; // transfer to SSE register __m128i data = _mm_cvtsi32_si128(yyyy); // spread it out to the right lanes and fill in the alpha channel __m128i rgba = _mm_shuffle_epi8(data, control); // store _mm_storeu_si128((__m128i*)&scanLine[x], rgba); } -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest