1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-13 19:28:41 -04:00

Try setting Gain & Bandwidth.

This commit is contained in:
John Greb
2015-05-20 18:43:01 +01:00
parent 6547711c16
commit 5b475a5331
4 changed files with 22 additions and 21 deletions
+17 -17
View File
@@ -64,7 +64,6 @@ static void xioctl(int fh, unsigned long int request, void *arg)
void
V4LThread::OpenSource(const char *filename)
{
struct v4l2_format fmt;
struct v4l2_buffer buf;
struct v4l2_requestbuffers req;
enum v4l2_buf_type type;
@@ -79,16 +78,19 @@ V4LThread::OpenSource(const char *filename)
return;
}
// sampletype depends on samplerate. Set that first
set_sample_rate((double)SAMPLERATE);
set_sample_rate( (double)SAMPLERATE );
set_center_freq( (double)centerFreq );
set_bandwidth( (double)IF_BANDWIDTH );
set_tuner_gain( (double) 6.0);
#if 0
struct v4l2_format fmt;
pixelformat = V4L2_PIX_FMT_SDR_CS14LE;
CLEAR(fmt);
fmt.type = V4L2_BUF_TYPE_SDR_CAPTURE;
fmt.fmt.sdr.pixelformat = pixelformat;
xioctl(fd, VIDIOC_G_FMT, &fmt);
xioctl(fd, VIDIOC_S_FMT, &fmt);
qCritical(" Expecting format CS14LE, got : %4.4s", (char *)&fmt.fmt.sdr.pixelformat);
#endif
CLEAR(req);
req.count = 8;
req.type = V4L2_BUF_TYPE_SDR_CAPTURE;
@@ -232,30 +234,28 @@ V4LThread::work(int noutput_items)
unsigned int pos = 0;
// MSI format is 252 sample pairs :( 63 * 4) * 4bytes
it = m_convertBuffer.begin();
if (recebuf_len >= 8) { // in bytes
if (recebuf_len >= 16) { // in bytes
b = (uint16_t *) recebuf_ptr;
unsigned int len = 8 * noutput_items; // decimation (i+q * 4 : cmplx)
if (len * 2 > recebuf_len)
len = recebuf_len / 2;
// Decimate by four for lower cpu usage
// ??? seems to have gone a bit wrong.
for (pos = 0; pos < len - 3; pos += 4) {
xreal = CASTUP(b[pos+0]<<2) + CASTUP(b[pos+1]<<2)
+ CASTUP(b[pos+2]<<2) + CASTUP(b[pos+3]<<2);
yimag = 0;
//CASTUP(b[pos+1]<<2) + CASTUP(b[pos+3]<<2)
//+ CASTUP(b[pos+5]<<2) + CASTUP(b[pos+7]<<2);
for (pos = 0; pos < len - 7; pos += 8) {
xreal = CASTUP(b[pos+0]<<2) + CASTUP(b[pos+2]<<2)
+ CASTUP(b[pos+4]<<2) + CASTUP(b[pos+6]<<2);
yimag = CASTUP(b[pos+1]<<2) + CASTUP(b[pos+3]<<2)
+ CASTUP(b[pos+5]<<2) + CASTUP(b[pos+7]<<2);
Sample s( (qint16)(xreal >> 2) , (qint16)(yimag >> 2) );
*it = s;
it++;
}
m_sampleFifo->write(m_convertBuffer.begin(), it);
recebuf_len -= pos * 2; // size of int16
recebuf_ptr = (void*)(b + pos);
recebuf_ptr = &b[pos];
}
// return now if there is still data in buffer, else free buffer and get another.
if (recebuf_len >= 8)
return pos / 4;
if (recebuf_len >= 16)
return pos / 8;
{ // free buffer, if there was one.
if (pos > 0) {
CLEAR(buf);
@@ -292,5 +292,5 @@ V4LThread::work(int noutput_items)
recebuf_len = buf.bytesused;
recebuf_mmap_index = buf.index;
}
return pos / 4;
return pos / 8;
}