[FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder
Clément Bœsch
u at pkh.me
Wed Dec 3 17:49:56 CET 2014
On Wed, Dec 03, 2014 at 05:58:58PM +0530, anshul.ffmpeg at gmail.com wrote:
[...]
> +static unsigned int av_always_inline is_oddparity1p7(unsigned int val)
> +{
> +//#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
> +#if 0
> + asm goto (
> + "and $0x7F, %0\n\t"
> + "jnp %l1 \/n\t"
> + :/* no output */
> + :"r"(val)
> + :"cc"
> + :odd
> + );
> + val = !(val&0x8);
> +odd:
> + val = !!(val&0x80);
> +#else
> + int ones = 0;
> + int i = 0;
> +
> + for (i = 0; i < 7; i++) {
> + if (val & (1 << i))
> + ones++;
> + }
> + val = ones & 1;
> +#endif
> + return val;
> +}
unless i'm mistaken, i think you just want:
return av_popcount(val & 0x7f) & 1;
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/199865e8/attachment.asc>
More information about the ffmpeg-devel
mailing list