Commit 3383a53e authored by Mans Rullgard's avatar Mans Rullgard
Browse files

lavu: replace int/float punning functions



The existing functions defined in intfloat_readwrite.[ch] are
both slow and incorrect (infinities are not handled).

This introduces a new header with fast, inline conversion
functions using direct union punning assuming an IEEE-754
system, an assumption already made throughout the code.

The one use of Intel/Motorola extended 80-bit format is
replaced by simpler code sufficient under the present
constraints (positive normal values).

The old functions are marked deprecated and retained for
compatibility.
Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
parent 5b3265a7
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "dct.h" #include "dct.h"
#include "rdft.h" #include "rdft.h"
#include "fmtconvert.h" #include "fmtconvert.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
extern const uint16_t ff_wma_critical_freqs[25]; extern const uint16_t ff_wma_critical_freqs[25];
...@@ -193,8 +193,8 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct) ...@@ -193,8 +193,8 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
if (s->version_b) { if (s->version_b) {
if (get_bits_left(gb) < 64) if (get_bits_left(gb) < 64)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
coeffs[0] = av_int2flt(get_bits(gb, 32)) * s->root; coeffs[0] = av_int2float(get_bits_long(gb, 32)) * s->root;
coeffs[1] = av_int2flt(get_bits(gb, 32)) * s->root; coeffs[1] = av_int2float(get_bits_long(gb, 32)) * s->root;
} else { } else {
if (get_bits_left(gb) < 58) if (get_bits_left(gb) < 58)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
...@@ -131,7 +131,7 @@ static int fourxm_read_header(AVFormatContext *s, ...@@ -131,7 +131,7 @@ static int fourxm_read_header(AVFormatContext *s,
size = AV_RL32(&header[i + 4]); size = AV_RL32(&header[i + 4]);
if (fourcc_tag == std__TAG) { if (fourcc_tag == std__TAG) {
fourxm->fps = av_int2flt(AV_RL32(&header[i + 12])); fourxm->fps = av_int2float(AV_RL32(&header[i + 12]));
} else if (fourcc_tag == vtrk_TAG) { } else if (fourcc_tag == vtrk_TAG) {
/* check that there is enough data */ /* check that there is enough data */
if (size != vtrk_SIZE) { if (size != vtrk_SIZE) {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intfloat_readwrite.h" #include "libavutil/mathematics.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
...@@ -88,7 +88,8 @@ static void get_meta(AVFormatContext *s, const char *key, int size) ...@@ -88,7 +88,8 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
int size, unsigned version) int size, unsigned version)
{ {
AVExtFloat ext; int exp;
uint64_t val;
double sample_rate; double sample_rate;
unsigned int num_frames; unsigned int num_frames;
...@@ -99,8 +100,9 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, ...@@ -99,8 +100,9 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
num_frames = avio_rb32(pb); num_frames = avio_rb32(pb);
codec->bits_per_coded_sample = avio_rb16(pb); codec->bits_per_coded_sample = avio_rb16(pb);
avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ exp = avio_rb16(pb);
sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */ val = avio_rb64(pb);
sample_rate = ldexp(val, exp - 16383 - 63);
codec->sample_rate = sample_rate; codec->sample_rate = sample_rate;
size -= 18; size -= 18;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "aiff.h" #include "aiff.h"
...@@ -36,7 +36,7 @@ static int aiff_write_header(AVFormatContext *s) ...@@ -36,7 +36,7 @@ static int aiff_write_header(AVFormatContext *s)
AIFFOutputContext *aiff = s->priv_data; AIFFOutputContext *aiff = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate; uint64_t sample_rate;
int aifc = 0; int aifc = 0;
/* First verify if format is ok */ /* First verify if format is ok */
...@@ -82,8 +82,9 @@ static int aiff_write_header(AVFormatContext *s) ...@@ -82,8 +82,9 @@ static int aiff_write_header(AVFormatContext *s)
avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */ avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */
sample_rate = av_dbl2ext((double)enc->sample_rate); sample_rate = av_double2int(enc->sample_rate);
avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); avio_wb16(pb, (sample_rate >> 52) + (16383 - 1023));
avio_wb64(pb, UINT64_C(1) << 63 | sample_rate << 11);
if (aifc) { if (aifc) {
avio_wl32(pb, enc->codec_tag); avio_wl32(pb, enc->codec_tag);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "riff.h" #include "riff.h"
#include "isom.h" #include "isom.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "caf.h" #include "caf.h"
...@@ -68,7 +68,7 @@ static int read_desc_chunk(AVFormatContext *s) ...@@ -68,7 +68,7 @@ static int read_desc_chunk(AVFormatContext *s)
/* parse format description */ /* parse format description */
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); st->codec->sample_rate = av_int2double(avio_rb64(pb));
st->codec->codec_tag = avio_rb32(pb); st->codec->codec_tag = avio_rb32(pb);
flags = avio_rb32(pb); flags = avio_rb32(pb);
caf->bytes_per_packet = avio_rb32(pb); caf->bytes_per_packet = avio_rb32(pb);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "ffm.h" #include "ffm.h"
...@@ -325,10 +325,10 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -325,10 +325,10 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->rc_max_rate = avio_rb32(pb); codec->rc_max_rate = avio_rb32(pb);
codec->rc_min_rate = avio_rb32(pb); codec->rc_min_rate = avio_rb32(pb);
codec->rc_buffer_size = avio_rb32(pb); codec->rc_buffer_size = avio_rb32(pb);
codec->i_quant_factor = av_int2dbl(avio_rb64(pb)); codec->i_quant_factor = av_int2double(avio_rb64(pb));
codec->b_quant_factor = av_int2dbl(avio_rb64(pb)); codec->b_quant_factor = av_int2double(avio_rb64(pb));
codec->i_quant_offset = av_int2dbl(avio_rb64(pb)); codec->i_quant_offset = av_int2double(avio_rb64(pb));
codec->b_quant_offset = av_int2dbl(avio_rb64(pb)); codec->b_quant_offset = av_int2double(avio_rb64(pb));
codec->dct_algo = avio_rb32(pb); codec->dct_algo = avio_rb32(pb);
codec->strict_std_compliance = avio_rb32(pb); codec->strict_std_compliance = avio_rb32(pb);
codec->max_b_frames = avio_rb32(pb); codec->max_b_frames = avio_rb32(pb);
...@@ -340,7 +340,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -340,7 +340,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->mb_decision = avio_rb32(pb); codec->mb_decision = avio_rb32(pb);
codec->nsse_weight = avio_rb32(pb); codec->nsse_weight = avio_rb32(pb);
codec->frame_skip_cmp = avio_rb32(pb); codec->frame_skip_cmp = avio_rb32(pb);
codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb)); codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb));
codec->codec_tag = avio_rb32(pb); codec->codec_tag = avio_rb32(pb);
codec->thread_count = avio_r8(pb); codec->thread_count = avio_r8(pb);
codec->coder_type = avio_rb32(pb); codec->coder_type = avio_rb32(pb);
...@@ -350,8 +350,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -350,8 +350,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->keyint_min = avio_rb32(pb); codec->keyint_min = avio_rb32(pb);
codec->scenechange_threshold = avio_rb32(pb); codec->scenechange_threshold = avio_rb32(pb);
codec->b_frame_strategy = avio_rb32(pb); codec->b_frame_strategy = avio_rb32(pb);
codec->qcompress = av_int2dbl(avio_rb64(pb)); codec->qcompress = av_int2double(avio_rb64(pb));
codec->qblur = av_int2dbl(avio_rb64(pb)); codec->qblur = av_int2double(avio_rb64(pb));
codec->max_qdiff = avio_rb32(pb); codec->max_qdiff = avio_rb32(pb);
codec->refs = avio_rb32(pb); codec->refs = avio_rb32(pb);
break; break;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "ffm.h" #include "ffm.h"
...@@ -137,10 +137,10 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -137,10 +137,10 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->rc_max_rate); avio_wb32(pb, codec->rc_max_rate);
avio_wb32(pb, codec->rc_min_rate); avio_wb32(pb, codec->rc_min_rate);
avio_wb32(pb, codec->rc_buffer_size); avio_wb32(pb, codec->rc_buffer_size);
avio_wb64(pb, av_dbl2int(codec->i_quant_factor)); avio_wb64(pb, av_double2int(codec->i_quant_factor));
avio_wb64(pb, av_dbl2int(codec->b_quant_factor)); avio_wb64(pb, av_double2int(codec->b_quant_factor));
avio_wb64(pb, av_dbl2int(codec->i_quant_offset)); avio_wb64(pb, av_double2int(codec->i_quant_offset));
avio_wb64(pb, av_dbl2int(codec->b_quant_offset)); avio_wb64(pb, av_double2int(codec->b_quant_offset));
avio_wb32(pb, codec->dct_algo); avio_wb32(pb, codec->dct_algo);
avio_wb32(pb, codec->strict_std_compliance); avio_wb32(pb, codec->strict_std_compliance);
avio_wb32(pb, codec->max_b_frames); avio_wb32(pb, codec->max_b_frames);
...@@ -152,7 +152,7 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -152,7 +152,7 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->mb_decision); avio_wb32(pb, codec->mb_decision);
avio_wb32(pb, codec->nsse_weight); avio_wb32(pb, codec->nsse_weight);
avio_wb32(pb, codec->frame_skip_cmp); avio_wb32(pb, codec->frame_skip_cmp);
avio_wb64(pb, av_dbl2int(codec->rc_buffer_aggressivity)); avio_wb64(pb, av_double2int(codec->rc_buffer_aggressivity));
avio_wb32(pb, codec->codec_tag); avio_wb32(pb, codec->codec_tag);
avio_w8(pb, codec->thread_count); avio_w8(pb, codec->thread_count);
avio_wb32(pb, codec->coder_type); avio_wb32(pb, codec->coder_type);
...@@ -162,8 +162,8 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -162,8 +162,8 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->keyint_min); avio_wb32(pb, codec->keyint_min);
avio_wb32(pb, codec->scenechange_threshold); avio_wb32(pb, codec->scenechange_threshold);
avio_wb32(pb, codec->b_frame_strategy); avio_wb32(pb, codec->b_frame_strategy);
avio_wb64(pb, av_dbl2int(codec->qcompress)); avio_wb64(pb, av_double2int(codec->qcompress));
avio_wb64(pb, av_dbl2int(codec->qblur)); avio_wb64(pb, av_double2int(codec->qblur));
avio_wb32(pb, codec->max_qdiff); avio_wb32(pb, codec->max_qdiff);
avio_wb32(pb, codec->refs); avio_wb32(pb, codec->refs);
break; break;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h" #include "libavcodec/mpeg4audio.h"
...@@ -189,7 +189,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream ...@@ -189,7 +189,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) { for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER) if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
goto finish; goto finish;
num_val = av_int2dbl(avio_rb64(ioc)); num_val = av_int2double(avio_rb64(ioc));
current_array[i] = num_val; current_array[i] = num_val;
} }
if (times && filepositions) { if (times && filepositions) {
...@@ -230,7 +230,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -230,7 +230,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
switch(amf_type) { switch(amf_type) {
case AMF_DATA_TYPE_NUMBER: case AMF_DATA_TYPE_NUMBER:
num_val = av_int2dbl(avio_rb64(ioc)); break; num_val = av_int2double(avio_rb64(ioc)); break;
case AMF_DATA_TYPE_BOOL: case AMF_DATA_TYPE_BOOL:
num_val = avio_r8(ioc); break; num_val = avio_r8(ioc); break;
case AMF_DATA_TYPE_STRING: case AMF_DATA_TYPE_STRING:
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "flv.h" #include "flv.h"
#include "internal.h" #include "internal.h"
...@@ -162,7 +162,7 @@ static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) { ...@@ -162,7 +162,7 @@ static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) {
static void put_amf_double(AVIOContext *pb, double d) static void put_amf_double(AVIOContext *pb, double d)
{ {
avio_w8(pb, AMF_DATA_TYPE_NUMBER); avio_w8(pb, AMF_DATA_TYPE_NUMBER);
avio_wb64(pb, av_dbl2int(d)); avio_wb64(pb, av_double2int(d));
} }
static void put_amf_bool(AVIOContext *pb, int b) { static void put_amf_bool(AVIOContext *pb, int b) {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
...@@ -520,8 +520,8 @@ static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc) ...@@ -520,8 +520,8 @@ static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc)
static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
{ {
avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ avio_wl64(pb, av_double2int(1)); /* sound level to begin to */
avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ avio_wl64(pb, av_double2int(1)); /* sound level to begin to */
avio_wl32(pb, 0); /* number of fields over which to ramp up sound level */ avio_wl32(pb, 0); /* number of fields over which to ramp up sound level */
avio_wl32(pb, 0); /* number of fields over which to ramp down sound level */ avio_wl32(pb, 0); /* number of fields over which to ramp down sound level */
avio_wl32(pb, 0); /* reserved */ avio_wl32(pb, 0); /* reserved */
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "rm.h" #include "rm.h"
#include "matroska.h" #include "matroska.h"
#include "libavcodec/mpeg4audio.h" #include "libavcodec/mpeg4audio.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/lzo.h" #include "libavutil/lzo.h"
...@@ -624,9 +624,9 @@ static int ebml_read_float(AVIOContext *pb, int size, double *num) ...@@ -624,9 +624,9 @@ static int ebml_read_float(AVIOContext *pb, int size, double *num)
if (size == 0) { if (size == 0) {
*num = 0; *num = 0;
} else if (size == 4) { } else if (size == 4) {
*num= av_int2flt(avio_rb32(pb)); *num = av_int2float(avio_rb32(pb));
} else if(size==8){ } else if (size == 8){
*num= av_int2dbl(avio_rb64(pb)); *num = av_int2double(avio_rb64(pb));
} else } else
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "avlanguage.h" #include "avlanguage.h"
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/random_seed.h" #include "libavutil/random_seed.h"
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
...@@ -185,7 +185,7 @@ static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val) ...@@ -185,7 +185,7 @@ static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
{ {
put_ebml_id(pb, elementid); put_ebml_id(pb, elementid);
put_ebml_num(pb, 8, 0); put_ebml_num(pb, 8, 0);
avio_wb64(pb, av_dbl2int(val)); avio_wb64(pb, av_double2int(val));
} }
static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
//#define MOV_EXPORT_ALL_METADATA //#define MOV_EXPORT_ALL_METADATA
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
...@@ -1218,7 +1218,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -1218,7 +1218,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
avio_rb32(pb); /* bytes per sample */ avio_rb32(pb); /* bytes per sample */
} else if (version==2) { } else if (version==2) {
avio_rb32(pb); /* sizeof struct only */ avio_rb32(pb); /* sizeof struct only */
st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); /* float 64 */ st->codec->sample_rate = av_int2double(avio_rb64(pb)); /* float 64 */
st->codec->channels = avio_rb32(pb); st->codec->channels = avio_rb32(pb);
avio_rb32(pb); /* always 0x7F000000 */ avio_rb32(pb); /* always 0x7F000000 */
st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */ st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "libavcodec/put_bits.h" #include "libavcodec/put_bits.h"
#include "internal.h" #include "internal.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
...@@ -468,7 +468,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) ...@@ -468,7 +468,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 0); avio_wb16(pb, 0);
avio_wb32(pb, 0x00010000); avio_wb32(pb, 0x00010000);
avio_wb32(pb, 72); avio_wb32(pb, 72);
avio_wb64(pb, av_dbl2int(track->timescale)); avio_wb64(pb, av_double2int(track->timescale));
avio_wb32(pb, track->enc->channels); avio_wb32(pb, track->enc->channels);
avio_wb32(pb, 0x7F000000); avio_wb32(pb, 0x7F000000);
avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id)); avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "riff.h" #include "riff.h"
...@@ -140,10 +140,10 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -140,10 +140,10 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
avio_rl32(pb); // unused, "desiredheight" avio_rl32(pb); // unused, "desiredheight"
avio_r8(pb); // 'P' == progressive, 'I' == interlaced avio_r8(pb); // 'P' == progressive, 'I' == interlaced
avio_skip(pb, 3); // padding avio_skip(pb, 3); // padding
aspect = av_int2dbl(avio_rl64(pb)); aspect = av_int2double(avio_rl64(pb));
if (aspect > 0.9999 && aspect < 1.0001) if (aspect > 0.9999 && aspect < 1.0001)
aspect = 4.0 / 3.0; aspect = 4.0 / 3.0;
fps = av_int2dbl(avio_rl64(pb)); fps = av_int2double(avio_rl64(pb));
// number of packets per stream type, -1 means unknown, e.g. streaming // number of packets per stream type, -1 means unknown, e.g. streaming
v_packs = avio_rl32(pb); v_packs = avio_rl32(pb);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "avformat.h" #include "avformat.h"
#include "rtmppkt.h" #include "rtmppkt.h"
...@@ -37,7 +37,7 @@ void ff_amf_write_bool(uint8_t **dst, int val) ...@@ -37,7 +37,7 @@ void ff_amf_write_bool(uint8_t **dst, int val)
void ff_amf_write_number(uint8_t **dst, double val) void ff_amf_write_number(uint8_t **dst, double val)
{ {
bytestream_put_byte(dst, AMF_DATA_TYPE_NUMBER); bytestream_put_byte(dst, AMF_DATA_TYPE_NUMBER);
bytestream_put_be64(dst, av_dbl2int(val)); bytestream_put_be64(dst, av_double2int(val));
} }
void ff_amf_write_string(uint8_t **dst, const char *str) void ff_amf_write_string(uint8_t **dst, const char *str)
...@@ -318,7 +318,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end, ...@@ -318,7 +318,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
if (size == namelen && !memcmp(data-size, name, namelen)) { if (size == namelen && !memcmp(data-size, name, namelen)) {
switch (*data++) { switch (*data++) {
case AMF_DATA_TYPE_NUMBER: case AMF_DATA_TYPE_NUMBER:
snprintf(dst, dst_size, "%g", av_int2dbl(AV_RB64(data))); snprintf(dst, dst_size, "%g", av_int2double(AV_RB64(data)));
break; break;
case AMF_DATA_TYPE_BOOL: case AMF_DATA_TYPE_BOOL:
snprintf(dst, dst_size, "%s", *data ? "true" : "false"); snprintf(dst, dst_size, "%s", *data ? "true" : "false");
...@@ -370,7 +370,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d ...@@ -370,7 +370,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
return; return;
switch (*data++) { switch (*data++) {
case AMF_DATA_TYPE_NUMBER: case AMF_DATA_TYPE_NUMBER:
av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2dbl(AV_RB64(data))); av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2double(AV_RB64(data)));
return; return;
case AMF_DATA_TYPE_BOOL: case AMF_DATA_TYPE_BOOL:
av_log(ctx, AV_LOG_DEBUG, " bool %d\n", *data); av_log(ctx, AV_LOG_DEBUG, " bool %d\n", *data);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat.h"
#include "libavutil/lfg.h" #include "libavutil/lfg.h"