Re: C API: How to get a seektable for very long files?
Alistair Buxton <[email protected]> Tue, 15 Oct 2024 20:26:56 +0100
| Newsgroups | gmane.comp.audio.compression.flac.devel |
|---|---|
| Message-ID | <CAO-Op+EH-afjvNwMK7+okb7FqME6c3+TuEinLck=1LhCbjTNng@mail.gmail.com> |
--===============5204539809576699129== Content-Type: multipart/alternative; boundary="000000000000652064062488f0d5" --000000000000652064062488f0d5 Content-Type: text/plain; charset="UTF-8" Another SDR user here. It was me who reported the bug where total samples wraps around on overflow. FLAC performs extremely well on SDR samples, both speed and compression ratio. In my testing it outperforms any other free lossless codec by a large margin, being 20% smaller and 10% faster than the next best (which was ffv1). The problem is the metadata, and not just total samples. We also can't put true values in the sample rate field because it doesn't have enough bits (I have files with 35468950MHz nominal sample rate for example), and there is no way to record that samples have been padded eg from 10 bits to 16 bits, which seems to be very common in SDR applications. These are just two examples off the top of my head - there are probably more. The problems around total samples and seek table allocation could be alleviated by using multiple files as mentioned previously, but that introduces a new problem: how do you know if you have the full set of files? How do you know which file contains the nth sample? This would still require extra metadata somewhere. I would like to see this kind of thing put into a secondary metadata block aimed specifically at SDR. This could be completely ignored by regular audio players - these files are not meant to be listened to anyway. I could probably figure out how to implement that, I even started looking into it once, but I realised that 1. nobody would adopt it if it is just me behind it and 2. I don't know enough to make it suitable for all use cases. So I cannot and should not do this alone, as it would just be yet another half-baked adhoc "standard" that causes more problems than it solves. For example I had not even considered the idea of using multiple files. On the topic of seeking, it is also a problem for my specific use case. I am interested in digital signals (teletext) hidden in analog video (CVBS samples), and they just aren't sequential in the same way that audio and video usually are. I need to seek to an arbitrary video line as fast as possible, preferably in constant time. A line is usually 2048 samples but can vary between 1000 and 3000 samples long (always fixed size within a given file, but can vary depending on the hardware used to record). A typical recording will have 32 lines per frame (because the picture has already been discarded), 25 frames per second, and be up to 12 hours long = 35 million lines and 70 billion samples. That would result in a ~700MB seek table. And making the block size = 1 line also has a negative effect on compression ratio. Finally since the files are huge I am storing them on cheap USB HDDs which have terrible seek and read times to begin with. Note though that very high resolution seeking is not really necessary for most SDR uses and is mainly a quirk of the fact that teletext was one of the earliest attempts at digital data transmission and has very small and fixed size data packets that map directly to video lines. As such this would probably be best handled with a custom, app-specific seek table in a separate file, built on-demand and possibly stored on a faster disk. -- Alistair Buxton [email protected] --000000000000652064062488f0d5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_quote"><br></div><div class=3D"gmail_q= uote">Another SDR user here. It was me who reported the bug where total sam= ples wraps around on overflow.</div><div class=3D"gmail_quote"><br></div><d= iv class=3D"gmail_quote">FLAC performs extremely well on SDR samples, both = speed and compression ratio. In my testing it outperforms any other free lo= ssless codec by a large margin, being 20% smaller and 10% faster than the n= ext best (which was ffv1). The problem is the metadata, and not just total = samples. We also can't put true values in the sample rate field because= it doesn't have enough bits (I have files with 35468950MHz nominal sam= ple rate for example), and there is no way to record that samples have been= padded eg from 10 bits to 16 bits, which seems to be very common in SDR ap= plications. These are just two examples off the top of my head - there are = probably more.<br></div><div class=3D"gmail_quote"><br></div><div class=3D"= gmail_quote">The problems around total samples and seek table allocation co= uld be=20 alleviated by using multiple files as mentioned previously, but that=20 introduces a new problem: how do you know if you have the full set of=20 files? How do you know which file contains the nth sample? This would=20 still require extra metadata somewhere.<br></div><div class=3D"gmail_quote"= ><br></div><div class=3D"gmail_quote">I would like to see this kind of thin= g put into a secondary metadata=20 block aimed specifically at SDR. This could be completely=20 ignored by regular audio players - these files are not meant to be=20 listened to anyway. I could probably figure out how to=20 implement that, I even started looking into it once, but I realised that 1. nobody would adopt it if it is=20 just me behind it and 2. I don't know enough to make it suitable for al= l use cases. So I cannot and should not do this alone, as it would just=20 be yet another half-baked adhoc "standard" that causes more probl= ems=20 than it solves. For example I had not even considered the idea of using mul= tiple files.<br></div><div class=3D"gmail_quote"><br></div><div>On the topi= c of seeking, it is also a problem for my specific use case. I am intereste= d in digital signals (teletext) hidden in analog video (CVBS samples), and = they just aren't sequential in the same way that audio and video usuall= y are. I need to seek to an arbitrary video line as fast as possible, prefe= rably in constant time. A line is usually 2048 samples but can vary between= 1000 and 3000 samples long (always fixed size within a given file, but can= vary depending on the hardware used to record). A typical recording will h= ave 32 lines per frame (because the picture has already been discarded), 25= frames per second, and be up to 12 hours long =3D 35 million lines and 70 = billion samples. That would result in a ~700MB seek table. And making the b= lock size =3D 1 line also has a negative effect on compression ratio. Final= ly since the files are huge I am storing them on cheap USB HDDs which have = terrible seek and read times to begin with. Note though that very high reso= lution seeking is not really necessary for most SDR uses and is mainly a qu= irk of the fact that teletext was one of the earliest attempts at digital d= ata transmission and has very small and fixed size data packets that map di= rectly to video lines. As such this would probably be best handled with a c= ustom, app-specific seek table in a separate file, built on-demand and poss= ibly stored on a faster disk.<br></div><div><span class=3D"gmail_signature_= prefix"><br></span></div><div><span class=3D"gmail_signature_prefix">-- </s= pan><br></div><div dir=3D"ltr" class=3D"gmail_signature">Alistair Buxton<br= ><a href=3D"mailto:[email protected]" target=3D"_blank">a.j.buxton@gmail= .com</a></div> </div> --000000000000652064062488f0d5-- --===============5204539809576699129== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ flac-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/flac-dev --===============5204539809576699129==--