Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FFmpeg/FFmpeg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a8cb21fd62a1
Choose a base ref
...
head repository: FFmpeg/FFmpeg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 59003fe7c064
Choose a head ref
  • 4 commits
  • 2 files changed
  • 3 contributors

Commits on Sep 30, 2012

  1. Copy the full SHA
    13d8783 View commit details
  2. qt-faststart: speedup

    qt-faststart is terribly slow when the input file and the output file
    are on a slow disk like a SD card. By increasing the copy_buffer from
    1K to 32M I decreased the processing time on a sample file from
    1600 seconds to 4 seconds. The timing difference is during 'copying
    rest of file'.
    
    S:\SD_VIDEO\PRG001>e:\utils\qt-faststart 00005.mp4 5.mp4
    ftyp          0 32
    free         32 8
    mdat         40 13744391
    moov   13744431 141848
     patching stco atom...
     patching stco atom...
     writing ftyp atom...
     writing moov atom...
     copying rest of file...
    
    Execution time: 1576.259 s
    
    S:\SD_VIDEO\PRG001>s:\utils\qt-faststart 00005.mp4 5.mp4
    ftyp          0 32
    free         32 8
    mdat         40 13744391
    moov   13744431 141848
     patching stco atom...
     patching stco atom...
     writing ftyp atom...
     writing moov atom...
     copying rest of file...
    
    Execution time: 3.846 s
    
    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    Jan Ehrhardt authored and michaelni committed Sep 30, 2012
    Copy the full SHA
    f4d9148 View commit details
  3. qt-faststart: dont allocate a bigger buffer than needed

    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    michaelni committed Sep 30, 2012
    Copy the full SHA
    610efb6 View commit details
  4. qt-faststart: simplify code by using FFMIN

    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    michaelni committed Sep 30, 2012
    Copy the full SHA
    59003fe View commit details
Showing with 15 additions and 8 deletions.
  1. +2 −2 libavfilter/af_ashowinfo.c
  2. +13 −6 tools/qt-faststart.c
4 changes: 2 additions & 2 deletions libavfilter/af_ashowinfo.c
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
if (!av_sample_fmt_is_planar(samplesref->format))
linesize *= av_get_channel_layout_nb_channels(samplesref->audio->channel_layout);

for (plane = 0; samplesref->data[plane] && plane < 8; plane++) {
for (plane = 0; plane < 8 && samplesref->data[plane]; plane++) {
uint8_t *data = samplesref->data[plane];

plane_checksum[plane] = av_adler32_update(plane_checksum[plane],
@@ -78,7 +78,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
checksum,
plane_checksum[0]);

for (plane = 1; samplesref->data[plane] && plane < 8; plane++)
for (plane = 1; plane < 8 && samplesref->data[plane]; plane++)
av_log(ctx, AV_LOG_INFO, " %08X", plane_checksum[plane]);
av_log(ctx, AV_LOG_INFO, "]\n");

19 changes: 13 additions & 6 deletions tools/qt-faststart.c
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@
#define ftello(x) _ftelli64(x)
#endif

#define FFMIN(a,b) ((a) > (b) ? (b) : (a))

#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])

#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
@@ -77,7 +79,7 @@
#define CO64_ATOM QT_ATOM('c', 'o', '6', '4')

#define ATOM_PREAMBLE_SIZE 8
#define COPY_BUFFER_SIZE 1024
#define COPY_BUFFER_SIZE 33554432

int main(int argc, char *argv[])
{
@@ -96,7 +98,7 @@ int main(int argc, char *argv[])
uint32_t offset_count;
uint64_t current_offset;
uint64_t start_offset = 0;
unsigned char copy_buffer[COPY_BUFFER_SIZE];
unsigned char *copy_buffer = NULL;
int bytes_to_copy;

if (argc != 3) {
@@ -293,12 +295,15 @@ int main(int argc, char *argv[])
}

/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
bytes_to_copy = FFMIN(COPY_BUFFER_SIZE, last_offset);
copy_buffer = malloc(bytes_to_copy);
if (!copy_buffer) {
printf("could not allocate %"PRIu64" bytes for copy_buffer\n", bytes_to_copy);
goto error_out;
}
printf(" copying rest of file...\n");
while (last_offset) {
if (last_offset > COPY_BUFFER_SIZE)
bytes_to_copy = COPY_BUFFER_SIZE;
else
bytes_to_copy = last_offset;
bytes_to_copy = FFMIN(bytes_to_copy, last_offset);

if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
perror(argv[1]);
@@ -315,6 +320,7 @@ int main(int argc, char *argv[])
fclose(outfile);
free(moov_atom);
free(ftyp_atom);
free(copy_buffer);

return 0;

@@ -325,5 +331,6 @@ int main(int argc, char *argv[])
fclose(outfile);
free(moov_atom);
free(ftyp_atom);
free(copy_buffer);
return 1;
}