[FFmpeg-devel] [PATCH] h264: assembly version of get_cabac for x86_64 with PIC

Michael Niedermayer michaelni at gmx.at
Fri Apr 13 12:48:55 CEST 2012


On Fri, Apr 13, 2012 at 09:35:40AM +0000, Loren Merritt wrote:
> On Fri, 13 Apr 2012, Michael Niedermayer wrote:
> > On Fri, Apr 13, 2012 at 05:13:46AM +0000, Loren Merritt wrote:
> >
> >> @GOTPCREL isn't actually necessary unless you want the application to be
> >> able to override those symbols (which we don't).
> >>
> >> lea    ff_h264_lps_range(%%rip), "tmp2q"
> >> movzbl ("tmp2q", %%rcx), "range"
> >> movzbl ff_h264_norm_shift-ff_h264_lps_range("tmp2q", "rangeq"), %%ecx
> >> movzbl ff_h264_mlps_state-ff_h264_lps_range+128("tmp2q", "retq"), "tmp"
> >>
> >> ...Which fails to compile. Well, you can do something like that in yasm,
> >> but I don't know how to subtract one symbol from another in inline asm.
> >
> > If the symbols are defined in a single yasm file/object then it can
> > get the difference, otherwise i dont see how but i might be missing
> > something.
> 
> You're right about two extern symbols, but it's possible to take the
> difference between one extern symbol and one static .text symbol. And
> there's one degree of freedom in the offsets, so the static symbol can
> be anything and is unrelated to where the actual data is stored.
> 
> Ah, I used "$$" in yasm and was slightly set back by the lack of any
> equivalent in inline asm, but making an actual label for it works too.
> 
> 1:
> lea    1b(%%rip), "tmp2q"
> movzbl ff_h264_lps_range-1b("tmp2q", %%rcx), "range"
> movzbl ff_h264_norm_shift-1b("tmp2q", "rangeq"), %%ecx
> movzbl ff_h264_mlps_state-1b+128("tmp2q", "retq"), "tmp"

loren, you are brilliant

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120413/14262b59/attachment.asc>


More information about the ffmpeg-devel mailing list