[MPlayer-dev-eng] [PATCH] Remove use of "long double".
Alexander Strasser
eclipse7 at gmx.net
Sat May 18 23:19:20 EEST 2019
Hi Reimar!
On 2019-05-18 10:51 +0200, Reimar Döffinger wrote:
> The values are only "double", and "long double"
> on x86 forces the use of x87 instructions which
> are less efficient.
> Also "long double" is not available on other
> architectures.
> ---
> libmpdemux/demux_mkv.c | 10 +++++-----
> libmpdemux/ebml.c | 4 ++--
> libmpdemux/ebml.h | 2 +-
> 3 files changed, 8 insertions(+), 8 deletions(-)
LGTM. Fine to commit if tested.
No idea why long double was used in the first place, but I just
checked and it was in there since the mkv demuxer was added in
2004.
Alexander
> diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
> index e6d90985d..a50c7a612 100644
> --- a/libmpdemux/demux_mkv.c
> +++ b/libmpdemux/demux_mkv.c
> @@ -402,7 +402,7 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
> uint64_t length, l;
> int il;
> uint64_t tc_scale = 1000000;
> - long double duration = 0.;
> + double duration = 0.;
>
> length = ebml_read_length(s, NULL);
> while (length > 0) {
> @@ -420,11 +420,11 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
>
> case MATROSKA_ID_DURATION:
> {
> - long double num = ebml_read_float(s, &l);
> + double num = ebml_read_float(s, &l);
> if (num == EBML_FLOAT_INVALID)
> return 1;
> duration = num;
> - mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3Lfs\n",
> + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3fs\n",
> duration * tc_scale / 1000000000.0);
> break;
> }
> @@ -615,7 +615,7 @@ static int demux_mkv_read_trackaudio(demuxer_t *demuxer, mkv_track_t *track)
> switch (ebml_read_id(s, &il)) {
> case MATROSKA_ID_AUDIOSAMPLINGFREQ:
> {
> - long double num = ebml_read_float(s, &l);
> + double num = ebml_read_float(s, &l);
> if (num == EBML_FLOAT_INVALID)
> return 0;
> track->a_sfreq = num;
> @@ -667,7 +667,7 @@ static int demux_mkv_read_trackvideo(demuxer_t *demuxer, mkv_track_t *track)
> switch (ebml_read_id(s, &il)) {
> case MATROSKA_ID_VIDEOFRAMERATE:
> {
> - long double num = ebml_read_float(s, &l);
> + double num = ebml_read_float(s, &l);
> if (num == EBML_FLOAT_INVALID)
> return 0;
> track->v_frate = num;
> diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c
> index e35ded948..858811d37 100644
> --- a/libmpdemux/ebml.c
> +++ b/libmpdemux/ebml.c
> @@ -176,9 +176,9 @@ int64_t ebml_read_int(stream_t *s, uint64_t *length)
> /*
> * Read the next element as a float.
> */
> -long double ebml_read_float(stream_t *s, uint64_t *length)
> +double ebml_read_float(stream_t *s, uint64_t *length)
> {
> - long double value;
> + double value;
> uint64_t len;
> int l;
>
> diff --git a/libmpdemux/ebml.h b/libmpdemux/ebml.h
> index fb44faa43..6ecbd1be9 100644
> --- a/libmpdemux/ebml.h
> +++ b/libmpdemux/ebml.h
> @@ -200,7 +200,7 @@ int64_t ebml_read_vlen_int (uint8_t *buffer, int *length);
> uint64_t ebml_read_length (stream_t *s, int *length);
> uint64_t ebml_read_uint (stream_t *s, uint64_t *length);
> int64_t ebml_read_int (stream_t *s, uint64_t *length);
> -long double ebml_read_float (stream_t *s, uint64_t *length);
> +double ebml_read_float (stream_t *s, uint64_t *length);
> char *ebml_read_ascii (stream_t *s, uint64_t *length);
> char *ebml_read_utf8 (stream_t *s, uint64_t *length);
> int ebml_read_skip (stream_t *s, uint64_t *length);
> --
More information about the MPlayer-dev-eng
mailing list