All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] What endian type is supported by audio device ?
@ 2005-05-01 12:22 Mayank Batra
  2005-05-01 12:49 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Mayank Batra @ 2005-05-01 12:22 UTC (permalink / raw)
  To: BLUEZ DEVELOPERS LIST

Marcel,

Don't you think that we should first find out which
endian type the user's audio device supports ?

I mean, in the file sbc.c in the following lines

for (i = 0; i < samples; i++) {
	for (ch = 0; ch < priv->frame.channels; ch++) {
		int16_t s =
(int16_t)(priv->frame.pcm_sample[ch][i]);
		*ptr++ = (s & 0xff00) >> 8;
		*ptr++ = (s & 0x00ff);
	}
}

Shouldn't we first check out whether the user's audio
device supports little endian or big endian type ?

It should be something like below...

for (i = 0; i < samples; i++) {
	for (ch = 0; ch < priv->frame.channels; ch++) {
		int16_t s =
(int16_t)(priv->frame.pcm_sample[ch][i]);
		if(BIG_ENDIAN) {
			*ptr++ = (s & 0xff00) >> 8;
			*ptr++ = (s & 0x00ff);
		}
		else {
			*ptr++ = (s & 0x00ff);
			*ptr++ = (s & 0xff00) >> 8;
		}
	}
}

Ofcourse BIG_ENDIAN will be replaced by a function or
macro which returns the endian type.

Do you have knowledge of such a function or macro ?
If yes, please patch sbc.c file for us.

It will be great for people like me who have spent
weeks in figuring out why the sound quality is so poor
while using sbcdec.c

I use an Intel based machine, which follows
little-endian format.
But sbc.c was using big endian format.

Thanks and Regards

Mayank

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bluez-devel] What endian type is supported by audio device ?
  2005-05-01 12:22 Mayank Batra
@ 2005-05-01 12:49 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-05-01 12:49 UTC (permalink / raw)
  To: bluez-devel

Hi Mayank,

> Don't you think that we should first find out which
> endian type the user's audio device supports ?
> 
> I mean, in the file sbc.c in the following lines
> 
> for (i = 0; i < samples; i++) {
> 	for (ch = 0; ch < priv->frame.channels; ch++) {
> 		int16_t s =
> (int16_t)(priv->frame.pcm_sample[ch][i]);
> 		*ptr++ = (s & 0xff00) >> 8;
> 		*ptr++ = (s & 0x00ff);
> 	}
> }
> 
> Shouldn't we first check out whether the user's audio
> device supports little endian or big endian type ?
> 
> It should be something like below...
> 
> for (i = 0; i < samples; i++) {
> 	for (ch = 0; ch < priv->frame.channels; ch++) {
> 		int16_t s =
> (int16_t)(priv->frame.pcm_sample[ch][i]);
> 		if(BIG_ENDIAN) {
> 			*ptr++ = (s & 0xff00) >> 8;
> 			*ptr++ = (s & 0x00ff);
> 		}
> 		else {
> 			*ptr++ = (s & 0x00ff);
> 			*ptr++ = (s & 0xff00) >> 8;
> 		}
> 	}
> }
> 
> Ofcourse BIG_ENDIAN will be replaced by a function or
> macro which returns the endian type.
> 
> Do you have knowledge of such a function or macro ?
> If yes, please patch sbc.c file for us.
> 
> It will be great for people like me who have spent
> weeks in figuring out why the sound quality is so poor
> while using sbcdec.c
> 
> I use an Intel based machine, which follows
> little-endian format.
> But sbc.c was using big endian format.

actually this has nothing to do with the machine type. It depends on the
endian format of the input PCM stream. So we should add a flags that
tells us about the endian format of the input.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bluez-devel] What endian type is supported by audio device ?
@ 2005-05-03 13:28 Mayank Batra
  2005-05-03 15:33 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Mayank Batra @ 2005-05-03 13:28 UTC (permalink / raw)
  To: bluez-devel

Marcel,

> 
> actually this has nothing to do with the machine
> type. It depends on the
> endian format of the input PCM stream. So we should
> add a flags that
> tells us about the endian format of the input.

But what do i do if the stream was earlier on in big
endian format and my audio device does not support big
endian format?

That is why, we should check what endian type is
supported and decide accordingly.

Regards,

Mayank

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bluez-devel] What endian type is supported by audio device ?
  2005-05-03 13:28 Mayank Batra
@ 2005-05-03 15:33 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-05-03 15:33 UTC (permalink / raw)
  To: bluez-devel

Hi Mayank,

> > actually this has nothing to do with the machine
> > type. It depends on the
> > endian format of the input PCM stream. So we should
> > add a flags that
> > tells us about the endian format of the input.
> 
> But what do i do if the stream was earlier on in big
> endian format and my audio device does not support big
> endian format?
> 
> That is why, we should check what endian type is
> supported and decide accordingly.

I think that if you use ALSA it can change the endian format on demand
inside the library, but for the a2play and a2recv with OSS support we
can do that inside our own code. It is only byte swapping. And from my
understand it should be done inside the SBC codec. We simpy tell it what
input or output endian format we expect and then it should obey to it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bluez-devel] What endian type is supported by audio device ?
@ 2005-05-05 12:37 Mayank Batra
  2005-05-05 13:05 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Mayank Batra @ 2005-05-05 12:37 UTC (permalink / raw)
  To: bluez-devel

Marcel,


> I think that if you use ALSA it can change the
> endian format on demand
> inside the library, but for the a2play and a2recv
> with OSS support we
> can do that inside our own code. It is only byte
> swapping. And from my
> understand it should be done inside the SBC codec.
> We simpy tell it what
> input or output endian format we expect and then it
> should obey to it.

But this means that we will have to add a flag bit to
indicate the endian type.

This is ok between a2play and a2recv. But do you mean
that we are gonna be limited to these two applications
only?

For instance, I tested a2recv with BlueSoleil and it
was working perfectly alright, i.e. if I opened the
audio device in little-endian format, did the byte
swapping in sbc.c file.

But we can't reprogram a third party s/w to incoporate
a bit for endian type.

Mayank

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bluez-devel] What endian type is supported by audio device ?
  2005-05-05 12:37 [Bluez-devel] What endian type is supported by audio device ? Mayank Batra
@ 2005-05-05 13:05 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-05-05 13:05 UTC (permalink / raw)
  To: bluez-devel

Hi Mayank,

> > I think that if you use ALSA it can change the
> > endian format on demand
> > inside the library, but for the a2play and a2recv
> > with OSS support we
> > can do that inside our own code. It is only byte
> > swapping. And from my
> > understand it should be done inside the SBC codec.
> > We simpy tell it what
> > input or output endian format we expect and then it
> > should obey to it.
> 
> But this means that we will have to add a flag bit to
> indicate the endian type.
> 
> This is ok between a2play and a2recv. But do you mean
> that we are gonna be limited to these two applications
> only?
> 
> For instance, I tested a2recv with BlueSoleil and it
> was working perfectly alright, i.e. if I opened the
> audio device in little-endian format, did the byte
> swapping in sbc.c file.
> 
> But we can't reprogram a third party s/w to incoporate
> a bit for endian type.

actually I have no idea what problem do you see here. We have a PCM
stream in big endian or little endian and we tell our SBC encode what
this endian format is. On the decoding side we tell it what endian
format we gonna need for the PCM stream it is creating. That's it. So
why should we worry about third party software. They can choose and if
they wanna use the SBC library they have to do it our way.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-05 13:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-05 12:37 [Bluez-devel] What endian type is supported by audio device ? Mayank Batra
2005-05-05 13:05 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2005-05-03 13:28 Mayank Batra
2005-05-03 15:33 ` Marcel Holtmann
2005-05-01 12:22 Mayank Batra
2005-05-01 12:49 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.