Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-31 Thread Cristian Adam

On 31-Dec-15 09:00, Erik de Castro Lopo wrote:

Brian Willoughby wrote:


What's wrong with something incredible simple, like:

#define FLAC__BYTES_PER_WORD (sizeof(int))

The fact that it actually is not correct. We want to determine
the size in bits of the CPU registers.

Here's what I know:

   sizeof(int) sizeof (long)
---++-
32 bit Linux   |   4|   4
64 bit Linux   |   4|   8
32 bit windows |   4|   4
64 bit windows |   4|   4

Note that sizeof(long) on 64 bit windows is 4!

Most other unixen follow the LP64 scheme used by Linux.

Erik


On Windows x64 sizeof(long) is 4, but sizeof(ptrdiff_t) is 8.

Any reasons for not using sizeof(ptrdiff_t)?

Cheers,
Cristian.
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-31 Thread Erik de Castro Lopo
Cristian Adam wrote:

> 
> On Windows x64 sizeof(long) is 4, but sizeof(ptrdiff_t) is 8.
> 
> Any reasons for not using sizeof(ptrdiff_t)?

Because of x32 Linux which is the x86_64 registers but with 32
bit pointers. 32 bit pointers means sizeof(ptrdiff_t) is probably
4.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-31 Thread Erik de Castro Lopo
Brian Willoughby wrote:

> What's wrong with something incredible simple, like:
> 
> #define FLAC__BYTES_PER_WORD (sizeof(int))

The fact that it actually is not correct. We want to determine
the size in bits of the CPU registers.

Here's what I know:

  sizeof(int) sizeof (long)
   ---++-
   32 bit Linux   |   4|   4
   64 bit Linux   |   4|   8
   32 bit windows |   4|   4
   64 bit windows |   4|   4

Note that sizeof(long) on 64 bit windows is 4!

Most other unixen follow the LP64 scheme used by Linux.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-30 Thread Brian Willoughby

On Dec 30, 2015, at 3:09 AM, Thomas Zander  
wrote:
> On 29 December 2015 at 21:50, lvqcl  wrote:
>> So, does it make sense to #define FLAC__BYTES_PER_WORD (in bitreader.c)
>> as 4 for 32-bit and as 8 for 64-bit targets?
> 
> Your tests so far imply this is a sensible default.
> I'd say go ahead. We can always change it if it turns out there is a
> better option.
> 
> Riggs

What's wrong with something incredible simple, like:

#define FLAC__BYTES_PER_WORD (sizeof(int))

?

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-30 Thread Thomas Zander
On 29 December 2015 at 21:50, lvqcl  wrote:

> So, does it make sense to #define FLAC__BYTES_PER_WORD (in bitreader.c)
> as 4 for 32-bit and as 8 for 64-bit targets?

Your tests so far imply this is a sensible default.
I'd say go ahead. We can always change it if it turns out there is a
better option.

Riggs
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-29 Thread Thomas Zander
On 29 December 2015 at 17:10, lvqcl  wrote:
> I wrote a patch that enables FLAC__BYTES_PER_WORD==8 in
> libFLAC/bitreader.c and libFLAC\bitwriter.c.
> The tests were done on an Intel Nehalem CPU, and flac was compiled
> with CGG 4.9.x.

If you want to share the patch, I am happy to repeat some testing on
Sandy Bridge and Core2 with clang.

> Average speed increase for FLAC__BYTES_PER_WORD change from 4 to 8:
> [...]

The slower decoding speed for 24 bit content on x86_64 seems
surprising, but minor.
However losing 15% decoding speed on i386 would be very bad.

Riggs
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] FLAC__BYTES_PER_WORD==8 test results

2015-12-29 Thread lvqcl
Thomas Zander wrote:

> If you want to share the patch, I am happy to repeat some testing on
> Sandy Bridge and Core2 with clang.

The patch changes many files, libFLAC/bitwriter.c and
test_libFLAC/bitwriter.c among them. So now I wait for the decision
for patches #3 and #4 that I posted yesterday.


> The slower decoding speed for 24 bit content on x86_64 seems
> surprising, but minor.
> However losing 15% decoding speed on i386 would be very bad.

So, does it make sense to #define FLAC__BYTES_PER_WORD (in bitreader.c)
as 4 for 32-bit and as 8 for 64-bit targets?
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev