Re: greedy2frame 32bit build fix
Roland Scheidegger <[email protected]> Wed, 13 Jun 2012 01:23:27 +0200
| Newsgroups | gmane.comp.video.xine.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 12.06.2012 21:54, schrieb Torsten Jager: > Hi again. > > I knew this migration thing was a bad idea. > No, honestly. > > 1.2.2 does not compile on my box. I guess this is because > I run a 32 bit system, and asm () runs out of general > registers. I think you're using a slightly broken compiler version or some unusual compile options - the code should only use 5 regs which is "typically" possible (it is 5 and not 6 regs because GreedyTwoFrameThreshold128 should only use a constant offset not a reg unless you're trying something silly like 32bit PIC code maybe or some other circumstances could cause gcc to need an additional reg). I know that Petri tested this. Unfortunately it is difficult to tell how many regs gcc will manage to handle for inline asm. To avoid such problems in general one solution might be to use small inline asm test programs in configure to just configure out the code which needs more (ffmpeg is doing something like that though but interestingly enough only for 6 or 7 regs they assume 5 is always available) - at least personally I wouldn't really care if some optimized code just isn't available in such broken setups. > > This patch fixes comilation. Still untested, though, > since I dont know how to activate the plugin at runtime. I think it looks ok but I'd prefer a simpler solution. I hate those multiple passing of the same arguments, these certainly should be no-ops in sane setups but it still makes the code just harder to read. So instead of splitting the code up I just moved the M1 fetch a bit down - while it was up there for a reason I never really managed to measure a performance difference anyway. That should need only 4 general regs just like your version which should REALLY be doable. (Tested on 64bit - not that you'd run into these register allocation problems there...) ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ xine-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xine-devel
greedy2framesse2_4regs.diff
(text/x-patch, 2.2 KB)
diff -r 38b7a12cc141 src/post/deinterlace/plugins/greedy2frame_template_sse2.c
--- a/src/post/deinterlace/plugins/greedy2frame_template_sse2.c Mon Jun 11 12:59:44 2012 +0300
+++ b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c Wed Jun 13 01:07:05 2012 +0200
@@ -171,10 +171,10 @@
* See above for a description of the algorithm.
* weave if (weave(M) AND (weave(T) OR weave(B)))
*/
- "movdqa (%3), %%xmm1 \n\t" /* xmm1 = T1 */
- "movdqa (%4), %%xmm0 \n\t" /* xmm0 = T0 */
- "movdqa (%q5,%3), %%xmm3 \n\t" /* xmm3 = B1 */
- "movdqa (%q5,%4), %%xmm2 \n\t" /* xmm2 = B0 */
+ "movdqa (%2), %%xmm1 \n\t" /* xmm1 = T1 */
+ "movdqa (%3), %%xmm0 \n\t" /* xmm0 = T0 */
+ "movdqa (%q4,%2), %%xmm3 \n\t" /* xmm3 = B1 */
+ "movdqa (%q4,%3), %%xmm2 \n\t" /* xmm2 = B0 */
/* calculate |T1-T0| keep T1 put result in xmm5 */
"movdqa %%xmm1, %%xmm5 \n\t"
@@ -182,20 +182,19 @@
"psubusb %%xmm1, %%xmm0 \n\t"
"por %%xmm0, %%xmm5 \n\t"
- "movdqa (%0), %%xmm0 \n\t" /* xmm0 = M1 */
/* T1 is data for line to copy */
- "movntdq %%xmm1, %2 \n\t"
+ "movntdq %%xmm1, %1 \n\t"
/* if |T1-T0| > Threshold we want 0 else dword minus one */
"psrlw $1, %%xmm5 \n\t"
"pand %%xmm6, %%xmm5 \n\t"
- "pcmpgtb %1, %%xmm5 \n\t"
+ "pcmpgtb %0, %%xmm5 \n\t"
"pcmpeqd %%xmm7, %%xmm5 \n\t"
- "prefetcht0 64(%q5,%3) \n\t"
- "prefetcht0 64(%q5,%4) \n\t"
+ "prefetcht0 64(%q4,%2) \n\t"
+ "prefetcht0 64(%q4,%3) \n\t"
:
- : "r" (M1), "m" (GreedyTwoFrameThreshold128),
+ : "m" (GreedyTwoFrameThreshold128),
"m" (*Destc), "r" (T1), "r" (T0), "r" (Pitch) );
asm volatile (
@@ -205,6 +204,7 @@
"psubusb %%xmm3, %%xmm2 \n\t"
"por %%xmm2, %%xmm4 \n\t"
+ "movdqa (%0), %%xmm0 \n\t" /* xmm0 = M1 */
"movdqa (%1), %%xmm2 \n\t" /* xmm2 = M0 */
/* if |B1-B0| > Threshold we want 0 else dword minus one */