[libdvdnav-devel] [PATCH] [RFC] Read in advance all the IFO file, in order to reduce number of read access
Diego Biurrun
diego at biurrun.de
Fri Sep 26 23:52:14 CEST 2014
On Fri, Aug 29, 2014 at 01:51:27AM +0200, Jean-Baptiste Kempf wrote:
> --- a/src/ifo_read.c
> +++ b/src/ifo_read.c
> @@ -304,6 +304,15 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
>
> + // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> + ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> + void* null_buffer = malloc(s);
> + if (null_buffer)
> + {
> + DVDReadBytes(ifofile->file, null_buffer, s);
> + free(null_buffer);
> + }
> +
> @@ -440,6 +449,15 @@ ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) {
>
> + // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> + ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> + void* null_buffer = malloc(s);
> + if (null_buffer)
> + {
> + DVDReadBytes(ifofile->file, null_buffer, s);
> + free(null_buffer);
> + }
> +
> @@ -473,6 +491,15 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) {
>
> + // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> + ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> + void* null_buffer = malloc(s);
> + if (null_buffer)
> + {
> + DVDReadBytes(ifofile->file, null_buffer, s);
> + free(null_buffer);
> + }
The code duplication calls for some refactoring.
Do we have an idea how much of a performance difference this makes?
Diego
More information about the libdvdnav-devel
mailing list