On Wed, Jan 24, 2024 at 1:58 AM Andrew Randrianasulu
<randrianas...@gmail.com> wrote:
>
> So, I was having a blast hacking old en/decoder.
>
> My own hacks do not work on 64-bit yet (they run, just sounds wrongs
> :) ) but this one  was tested on aarch64 Termux install, so should be
> better
>
> https://github.com/Randrianasulu/iso-dist10
>
> note: pcm2aiff too was not working for me, but mc (multichannel) and
> lsf (low sampling frequency) mpeg de/encoders were good ..
>
> I wonder if mplex already can mux those streams? In man I see

Even if svn log says nothing will ever be done for SVCD multichannel I
think it was working at some point?

https://encode2mpeg.sourceforge.net/html/multichannel.html
uses mplex? First time I saw bash script in 100s kb size range ...

and for Windows

https://web.archive.org/web/20051230022557/http://hypercubemx.free.fr/html/how_to_make_5_1__svcd.html

I tried their software under wine - um, something was eating cpu time
- so 3 min of 6 ch. audio was encoding at 1/10
of realtime - for 30+ minutes!

mctoolame on the other hand encodes same file in 190-75 seconds depend
on -ffast-math usage.
I was surprized  that 'threshold" calculations in psycho_1.c
(psychoacoustical model  one) eat up to half of cpu time!
So adding supposedly faster fftw from twolame not changed speed as
radically as I hoped.

==== opreport log ====

samples  cum. samples  %        cum. %     image name               symbol name
579112   579112        50.5768  50.5768    mctoolame                threshold
115666   694778        10.1017  60.6785    mctoolame                psycho_1
101489   796267         8.8636  69.5421    mctoolame
II_a_bit_allocation
53317    849584         4.6564  74.1985    mctoolame                noise_label
43665    893249         3.8135  78.0120    mctoolame
window_subband
33099    926348         2.8907  80.9027    mctoolame
filter_subband
28008    954356         2.4461  83.3488    mctoolame                fht
24048    978404         2.1002  85.4490    mctoolame
transmission_channel
20451    998855         1.7861  87.2351    mctoolame
II_subband_quantization_mc
15968    1014823        1.3946  88.6297    mctoolame
matricing_fft
15814    1030637        1.3811  90.0108    mctoolame
II_scale_factor_calc
14554    1045191        1.2711  91.2819    mctoolame                tc_alloc
14359    1059550        1.2540  92.5359    mctoolame                lfe_filter
13910    1073460        1.2148  93.7507    mctoolame
II_tonal_label
12842    1086302        1.1216  94.8723    mctoolame
II_subband_quantization
6381     1092683        0.5573  95.4296    mctoolame                putbits
6330     1099013        0.5528  95.9824    libc-2.33.so             fwrite
5476     1104489        0.4782  96.4607    mctoolame                II_smr
4562     1109051        0.3984  96.8591    mctoolame                get_audio
3760     1112811        0.3284  97.1875    mctoolame
II_sample_encoding_mc
3261     1116072        0.2848  97.4723    libc-2.33.so
_IO_file_xsputn@@GLIBC_2.1
2587     1118659        0.2259  97.6982    mctoolame
II_sample_encoding
2053     1120712        0.1793  97.8775    mctoolame                normalizing
1906     1122618        0.1665  98.0440    mctoolame                matricing
1723     1124341        0.1505  98.1944    mctoolame
II_transmission_pattern
1628     1125969        0.1422  98.3366    mctoolame                psycho_1_fft
1491     1127460        0.1302  98.4668    mctoolame
II_minimum_mask
1273     1128733        0.1112  98.5780    mctoolame
II_CRC_calc_mc
1234     1129967        0.1078  98.6858    mctoolame
create_dct_matrix
964      1130931        0.0842  98.7700    mctoolame
II_encode_scale
880      1131811        0.0769  98.8468    mctoolame                main
821      1132632        0.0717  98.9185    mctoolame
II_main_bit_allocation
781      1133413        0.0682  98.9867    kallsyms
tick_do_update_jiffies64
742      1134155        0.0648  99.0515    mctoolame                update_CRC
689      1134844        0.0602  99.1117    kallsyms
copy_user_generic_string

[rest is skipped]


from 13818-3.pdf I currently read:

==== quote ===

The ISO/MPEG-Audio Multichannel system provides full compatibility
with the ISO Standard 11172-3. This
compatibility is realised by coding the basic stereo information in
conformance with ISO/IEC 11172-3 and exploiting
the ancillary data field of the ISO/IEC 11172-3 audio frame and an
optional extension bit stream for the multichannel
extension.

The complete ISO/IEC 11172-3 frame incorporates four different types
of information:
-   Header information within the first 32 bits of the ISO/IEC 11172-3
audio frame.
-   Cyclic Redundancy Check (CRC), consisting of 16 bits, just after
the header information (optional).
-   Audio data, for Layer II consisting of bit allocation (BAL),
scalefactor select information (SCFSI), scalefactors
    (SCF), and the subband samples.
-   Ancillary data. Due to the large number of different applications
which will use the ISO/IEC 11172-3 Standard,
    the length and usage of this field are not specified.

The variable length of the ancillary data field enables packing the
complete extension information of the channels
T2/T3/T4 into the first part of the ancillary data field. If the MC
encoder does not use all of the ancillary data field for
the multichannel extension information, the remaining part of the
field can be used for other ancillary data.

The bit rate required for the multichannel extension information may
vary on a frame by frame basis, depending on
the sound signals. The overall bit rate may be increased above that
provided for in ISO/IEC 11172-3 by the use of an
optional extension bit stream. The maximum bit rate, including the
extension bit stream, is given by the following
table:
 Sampling Frequency       Layer    Maximum Total Bit Rate
        32 kHz                I             903 kbit/s
        32 kHz                II            839 kbit/s
        32 kHz               III            775 kbit/s
    44.1 kHz              I             1075 kbit/s
    44.1 kHz              II            1011 kbit/s
    44.1 kHz              III           947 kbit/s
    48 kHz               I               1130 kbit/s
    48 kHz               II              1066 kbit/s
    48 kHz              III             1002 kbit/s

huh, quite big - for all those channels ...


=====

thing is, this extension bitstream just dumped by encoder as file, and
I have currently no idea how to incorporate it back into mpeg stream
:)

Anyway, if specified bitrate not above 384 Kbit/s  older standart
used, so current mplex IMO muxes it correctly - I can extract mp2
audio with
ffmpeg and decode it back in 5.1 sound ...

additionally, I found two typos in man and comments :) patch attached





>
> BUGS
>        The multiplexer should handle MPEG(5.1) audio.
>
> but date on man page from 2001 ...
Index: docs/mp2enc.1
===================================================================
--- docs/mp2enc.1	(revision 3509)
+++ docs/mp2enc.1	(working copy)
@@ -31,7 +31,7 @@
 Mp2enc is a simple MPEG-1 layer-I/II audio encoder.  It is actually a very
 mildly warmed over version of the MPEG Software Simulation Group's
 reference encoder.  It accepts a WAV file or stream on stdin and
-ouputs an a layer-I/II elementary audio stream.  It is included in the
+outputs an a layer-I/II elementary audio stream.  It is included in the
 \fBmjpegtools\fP(1) primarily for reasons of completeness and because it
 is able to perform sampling rate conversion.
 .PP
Index: mplex/systems.cpp
===================================================================
--- mplex/systems.cpp	(revision 3509)
+++ mplex/systems.cpp	(working copy)
@@ -261,9 +261,9 @@
 /************************
  *
  * Is this a stream where for the MPEG-2
- * header extensionsappear?
+ * header extensions appear?
  *
- * The version below is correct at least forDVD
+ * The version below is correct at least for DVD
  * authoring.   The function is virtual in case sometime
  * someplace a different format where PRIVATE_STR_2 is used
  * differently is encountered.
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to