From: bruceperens Date: Wed, 12 Mar 2014 23:01:38 +0000 (+0000) Subject: Run no longer makes decisions about the data size of frames, only about their X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=bb213bfb3357f75cb5ebfb4724c841b23ef7128a;p=freetel-svn-tracking.git Run no longer makes decisions about the data size of frames, only about their minimum duration. git-svn-id: https://svn.code.sf.net/p/freetel/code@1433 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-server/source/codec_noop.cpp b/freedv-server/source/codec_noop.cpp index f7a39b51..2a429495 100644 --- a/freedv-server/source/codec_noop.cpp +++ b/freedv-server/source/codec_noop.cpp @@ -12,13 +12,6 @@ namespace FreeDV { CodecNoOp(const char *); ~CodecNoOp(); - /// Return the number of data bytes that store a single codec frame. - /// Data Bytes provided to decode16 and encode16 must be a multiple - /// of this value. The result is invariant. - /// \return The number of data bytes necessary to store a codec frame. - virtual std::size_t - bytes_per_frame() const; - /// Decode from data bytes to audio samples. /// \param i The encoded data, in an array of unsigned 8-bit integers. /// \param o The array of audio samples after decoding, in an array @@ -44,19 +37,10 @@ namespace FreeDV { encode16(const std::int16_t * i, std::uint8_t * o, \ std::size_t length); - /// Return the duration of a frame in milliseconds. - /// \return The duration of a frame in milliseconds. + /// Return the minimum duration of a frame in milliseconds. + /// \return The minimum duration of a frame in milliseconds. virtual int - frame_duration() const; - - /// Return the number of audio samples expected to create a codec - /// frame at SampleRate. Samples provided to encode16 and decode16 - /// must be a multiple of this value. The result is invariant for - /// a given SampleRate. - /// \return The number of audio samples expected to create a codec - /// frame. - virtual std::size_t - samples_per_frame() const; + min_frame_duration() const; }; CodecNoOp::CodecNoOp(const char * parameters) @@ -68,12 +52,6 @@ namespace FreeDV { { } - std::size_t - CodecNoOp::bytes_per_frame() const - { - return sizeof(std::int16_t); - } - std::size_t CodecNoOp::decode16(const std::uint8_t * i, std::int16_t * o, std::size_t * data_length, std::size_t sample_length) { @@ -91,13 +69,7 @@ namespace FreeDV { } int - CodecNoOp::frame_duration() const - { - return 1; - } - - std::size_t - CodecNoOp::samples_per_frame() const + CodecNoOp::min_frame_duration() const { return 1; } diff --git a/freedv-server/source/drivers.h b/freedv-server/source/drivers.h index f5fa2393..e6aa2e5d 100644 --- a/freedv-server/source/drivers.h +++ b/freedv-server/source/drivers.h @@ -285,13 +285,6 @@ namespace FreeDV { /// Destroy a codec instance. virtual ~Codec() = 0; - /// Return the number of data bytes that store a single codec frame. - /// Data Bytes provided to decode16 and encode16 must be a multiple - /// of this value. The result is invariant for a particular configuration. - /// \return The number of data bytes necessary to store a codec frame. - virtual std::size_t - bytes_per_frame() const = 0; - /// Decode from data bytes to audio samples. /// \param i The encoded data, in an array of unsigned 8-bit integers. /// \param o The array of audio samples after decoding, in an array @@ -318,19 +311,10 @@ namespace FreeDV { encode16(const std::int16_t * i, std::uint8_t * o, std::size_t length) = 0; - /// Return the duration of a frame in milliseconds. + /// Return the minimum duration of a frame in milliseconds. /// \return The duration of a frame in milliseconds. virtual int - frame_duration() const = 0; - - /// Return the number of audio samples expected to create a codec - /// frame at SampleRate. The result is invariant for a given SampleRate. - /// This number will be accurate for transmitted data, but not for received - /// data because of the potential for clock skew between stations. - /// \return The number of audio samples expected to create a codec - /// frame. - virtual std::size_t - samples_per_frame() const = 0; + min_frame_duration() const = 0; }; /// Event handler class, indirects the event handler of the particular GUI @@ -431,6 +415,11 @@ namespace FreeDV { /// Destroy a framer instance. virtual ~Framer() = 0; + /// Return the minimum duration of a frame in milliseconds. + /// \return The minimum duration of a frame in milliseconds. + virtual int + min_frame_duration() const = 0; + /// Decode from modem data to codec frames, removing the wrapping protocol. /// \param i The encoded data, in an array of unsigned 8-bit integers. /// \param o The array of codec data after decoding, in an array @@ -447,22 +436,6 @@ namespace FreeDV { std::size_t * input_length, std::size_t output_length) = 0; - /// Return the maximum number of data bytes expected to store the unwrapped - /// codec data. The result is invariant for a particular configuration. - /// \return The maximum number of data bytes expected to store the unwrapped - /// codec data. - /// frame. - virtual std::size_t - max_unwrapped_bytes_per_frame() const = 0; - - /// Return the minimum number of data bytes expected to store the unwrapped - /// codec data. The result is invariant for a particular configuration. - /// \return The minimum number of data bytes expected to store the unwrapped - /// codec data. - /// frame. - virtual std::size_t - min_unwrapped_bytes_per_frame() const = 0; - /// Wrap codec data bytes in a protocol for transmission through the modem. /// \param i The array of data bytes to be encoded, in an array /// of unsigned 8-bit integers. @@ -477,26 +450,6 @@ namespace FreeDV { std::uint8_t * o, std::size_t * input_length, std::size_t output_length) = 0; - - /// Return the maximum number of data bytes expected to store a wrapped - /// protocol frame. The result is invariant for a particular configuration - /// which may include such things as length of addresses and protocol - /// options. - /// \return The maximum number of data bytes expected to store a wrapped - /// protocol frame. - /// frame. - virtual std::size_t - max_wrapped_bytes_per_frame() const = 0; - - /// Return the minimum number of data bytes expected to store a wrapped - /// protocol frame. The result is invariant for a particular configuration - /// which may include such things as length of addresses and protocol - /// options. - /// \return The minimum number of data bytes expected to store a wrapped - /// protocol frame. - /// frame. - virtual std::size_t - min_wrapped_bytes_per_frame() const = 0; }; /// Radio device keying driver. @@ -532,13 +485,6 @@ namespace FreeDV { public: virtual ~Modem() = 0; - /// Return the number of data bytes output in a single modem frame. - /// The data buffer provided to demodulate16 must be a multiple of - /// this value. The result is invariant. - /// \return The number of data bytes necessary to store a modem frame. - virtual std::size_t - bytes_per_frame() const = 0; - /// Demodulate from audio samples to data. /// \param i The array of audio samples to be demodulated, in an array /// of signed 16-bit integers. @@ -564,19 +510,10 @@ namespace FreeDV { modulate16(const std::uint8_t * i, std::int16_t * o, std::size_t length) = 0; - /// Return the duration of a frame in milliseconds. - /// \return The duration of a frame in milliseconds. + /// Return the minimum duration of a frame in milliseconds. + /// \return The minimum duration of a frame in milliseconds. virtual int - frame_duration() const = 0; - - /// Return the number of audio samples expected to create a modem - /// frame at SampleRate. The result is invariant for a given SampleRate. - /// The result will be accurate for transmitted data, but not for received - /// data due to the potential for clock skew between stations. - /// \return The number of audio samples expected to create a codec - /// frame. - virtual std::size_t - samples_per_frame() const = 0; + min_frame_duration() const = 0; }; /// Push-to-talk input driver. diff --git a/freedv-server/source/framer_noop.cpp b/freedv-server/source/framer_noop.cpp index bbaa18d4..fc7a75ed 100644 --- a/freedv-server/source/framer_noop.cpp +++ b/freedv-server/source/framer_noop.cpp @@ -17,41 +17,10 @@ namespace FreeDV { /// Destroy a framer instance. virtual ~FramerNoOp(); - /// Return the maximum number of data bytes expected to store a wrapped - /// protocol frame. The result is invariant for a particular configuration - /// which may include such things as length of addresses and protocol - /// options. - /// \return The maximum number of data bytes expected to store a wrapped - /// protocol frame. - /// frame. - virtual std::size_t - max_wrapped_bytes_per_frame() const; - - /// Return the maximum number of data bytes expected to store the unwrapped - /// codec data. The result is invariant for a particular configuration. - /// \return The maximum number of data bytes expected to store the unwrapped - /// codec data. - /// frame. - virtual std::size_t - max_unwrapped_bytes_per_frame() const; - - /// Return the minimum number of data bytes expected to store the unwrapped - /// codec data. The result is invariant for a particular configuration. - /// \return The minimum number of data bytes expected to store the unwrapped - /// codec data. - /// frame. - virtual std::size_t - min_unwrapped_bytes_per_frame() const; - - /// Return the minimum number of data bytes expected to store a wrapped - /// protocol frame. The result is invariant for a particular configuration - /// which may include such things as length of addresses and protocol - /// options. - /// \return The minimum number of data bytes expected to store a wrapped - /// protocol frame. - /// frame. - virtual std::size_t - min_wrapped_bytes_per_frame() const; + /// Return the minimum duration of a frame in milliseconds. + /// \return The minimum duration of a frame in milliseconds. + virtual int + min_frame_duration() const; /// Decode from modem data to codec frames, removing the wrapping protocol. /// \param i The encoded data, in an array of unsigned 8-bit integers. @@ -94,26 +63,8 @@ namespace FreeDV { { } - std::size_t - FramerNoOp::max_wrapped_bytes_per_frame() const - { - return 1; - } - - std::size_t - FramerNoOp::max_unwrapped_bytes_per_frame() const - { - return 1; - } - - std::size_t - FramerNoOp::min_unwrapped_bytes_per_frame() const - { - return 1; - } - - std::size_t - FramerNoOp::min_wrapped_bytes_per_frame() const + int + FramerNoOp::min_frame_duration() const { return 1; } diff --git a/freedv-server/source/modem_noop.cpp b/freedv-server/source/modem_noop.cpp index 42c4e907..3c85a7f6 100644 --- a/freedv-server/source/modem_noop.cpp +++ b/freedv-server/source/modem_noop.cpp @@ -46,19 +46,10 @@ namespace FreeDV { modulate16(const std::uint8_t * i, std::int16_t * o, \ std::size_t length); - /// Return the duration of a frame in milliseconds. - /// \return The duration of a frame in milliseconds. + /// Return the minimum duration of a frame in milliseconds. + /// \return The minimum duration of a frame in milliseconds. virtual int - frame_duration() const; - - /// Return the number of audio samples expected to create a codec - /// frame at SampleRate. Samples provided to modulate16 and - /// demodulate16 must be a multiple of this value. The result is - /// invariant for a given SampleRate. - /// \return The number of audio samples expected to create a codec - /// frame. - virtual std::size_t - samples_per_frame() const; + min_frame_duration() const; }; ModemNoOp::ModemNoOp(const char * parameters) @@ -100,13 +91,7 @@ namespace FreeDV { } int - ModemNoOp::frame_duration() const - { - return 1; - } - - std::size_t - ModemNoOp::samples_per_frame() const + ModemNoOp::min_frame_duration() const { return 1; }