Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number
@ 2023-07-14 18:03 Michael Niedermayer
  2023-07-14 18:03 ` [FFmpeg-devel] [PATCH 2/2] avradio/sdrdemux: Some corrections to the FM stereo side channel Michael Niedermayer
  2023-07-15 16:59 ` [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-07-14 18:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/sdrdemux.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index d40b92dd24..041775730e 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -57,6 +57,8 @@
 #include "libavutil/lfg.h"
 #endif
 
+#define MAX_STATIONS 1000 // Maximum stations vissible at the same time
+
 #define AM_FREQ_TOLERANCE 5
 #define FM_FREQ_TOLERANCE 500
 
@@ -185,7 +187,7 @@ static int create_station(SDRContext *sdr, Station *candidate_station) {
     int conflict = INT_MAX;
     int nb_candidate_conflict = 0;
     int nb_candidate_match = 0;
-    Station *station_list[1000];
+    Station *station_list[MAX_STATIONS];
 
 
     if (candidate_station->in_station_list)
@@ -287,7 +289,7 @@ static int create_station(SDRContext *sdr, Station *candidate_station) {
 
 static void create_stations(SDRContext *sdr)
 {
-    Station *station_list[1000];
+    Station *station_list[MAX_STATIONS];
     int nb_stations;
 
     if (!sdr->block_center_freq)
@@ -330,7 +332,7 @@ static void *tree_remove(struct AVTreeNode **rootp, void *key,
  */
 static void decay_stations(SDRContext *sdr)
 {
-    Station *station_list[1000];
+    Station *station_list[MAX_STATIONS];
     int nb_stations = ff_sdr_find_stations(sdr, sdr->block_center_freq, sdr->bandwidth*0.5, station_list, FF_ARRAY_ELEMS(station_list));
 
     for (int i=0; i<nb_stations; i++) {
@@ -381,7 +383,7 @@ static int create_candidate_station(SDRContext *sdr, enum Modulation modulation,
     Station *station;
     void *tmp;
     struct AVTreeNode *next = NULL;
-    Station *station_list[1000];
+    Station *station_list[MAX_STATIONS];
     double snapdistance = modulation == AM ? AM_FREQ_TOLERANCE : FM_FREQ_TOLERANCE;
     int nb_stations = ff_sdr_find_stations(sdr, freq, snapdistance, station_list, FF_ARRAY_ELEMS(station_list));
     int update_freq = 1;
@@ -1274,7 +1276,7 @@ static int snap2station(SDRContext *sdr, int *seek_direction) {
     double current_freq;
     double best_distance = INT64_MAX;
     Station *best_station = NULL;
-    Station *station_list[1000];
+    Station *station_list[MAX_STATIONS];
     int nb_stations = ff_sdr_find_stations(sdr, sdr->block_center_freq, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list));
 
     if (sst->station) {
@@ -1740,7 +1742,7 @@ process_next_block:
     }
 
     if (sdr->demodulate_all_fm) {
-        Station *station_list[1000];
+        Station *station_list[MAX_STATIONS];
         int nb_stations = ff_sdr_find_stations(sdr, sdr->block_center_freq, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list));
         for (int i= 0; i<nb_stations; i++) {
             Station *station = station_list[i];
@@ -1900,7 +1902,7 @@ process_next_block:
     // windowed_block is unused now, we can fill it with the next blocks data
 
     if (sdr->block_center_freq) {
-        Station *station_list[1000];
+        Station *station_list[MAX_STATIONS];
         int nb_stations;
         if (sdr->skip_probe-- <= 0) {
             //Probing takes a bit of time, lets not do it every time
-- 
2.31.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

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

* [FFmpeg-devel] [PATCH 2/2] avradio/sdrdemux: Some corrections to the FM stereo side channel
  2023-07-14 18:03 [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer
@ 2023-07-14 18:03 ` Michael Niedermayer
  2023-07-15 16:59 ` [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-07-14 18:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/sdrdemux.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 041775730e..5a6a9b8894 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -656,7 +656,7 @@ static av_always_inline void synchronous_am_demodulationN(AVComplexFloat *iblock
     for (int i = 0; i<len; i++) {
         AVComplexFloat c = icarrier[i];
         AVComplexFloat s = iblock[i];
-        float          w = window[i];
+        float          w = N == 2 ? 1.0 : window[i];
         AVComplexFloat c2= {c.re*c.re, c.im*c.im};
         float den        = w/(c2.re + c2.im);
 
@@ -1080,8 +1080,9 @@ static int demodulate_fm(SDRContext *sdr, Station *station, AVStream *st, AVPack
         newbuf[2*i+0]           = (sdr->fm_iblock[i + sdr->fm_block_size_p2].re) * sdr->fm_window_p2[i + sdr->fm_block_size_p2] * scale;
 
         if (carrier19_i >= 0) {
-            q = sst->out_buf[2*i+1] +  sdr->fm_iside[i                        ].im * sdr->fm_window_p2[i                        ] * scale;
-            newbuf[2*i+1]           =  sdr->fm_iside[i + sdr->fm_block_size_p2].im * sdr->fm_window_p2[i + sdr->fm_block_size_p2] * scale;
+            //the 0.5 is because we have both sides of the spectrum for iside
+            q = sst->out_buf[2*i+1] +  sdr->fm_iside[i                        ].im * sdr->fm_window_p2[i                        ] * (scale * 0.5);
+            newbuf[2*i+1]           =  sdr->fm_iside[i + sdr->fm_block_size_p2].im * sdr->fm_window_p2[i + sdr->fm_block_size_p2] * (scale * 0.5);
 
             sst->out_buf[2*i+0] = m + q;
             sst->out_buf[2*i+1] = m - q;
-- 
2.31.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

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

* Re: [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number
  2023-07-14 18:03 [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer
  2023-07-14 18:03 ` [FFmpeg-devel] [PATCH 2/2] avradio/sdrdemux: Some corrections to the FM stereo side channel Michael Niedermayer
@ 2023-07-15 16:59 ` Michael Niedermayer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-07-15 16:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 515 bytes --]

On Fri, Jul 14, 2023 at 08:03:40PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavradio/sdrdemux.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)

will apply patchset


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

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

end of thread, other threads:[~2023-07-15 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 18:03 [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer
2023-07-14 18:03 ` [FFmpeg-devel] [PATCH 2/2] avradio/sdrdemux: Some corrections to the FM stereo side channel Michael Niedermayer
2023-07-15 16:59 ` [FFmpeg-devel] [PATCH 1/2] avradio/sdrdemux: avoid repeated litteral number Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git