1. 11 Jan, 2020 3 commits
  2. 10 Jan, 2020 11 commits
  3. 09 Jan, 2020 1 commit
  4. 08 Jan, 2020 13 commits
  5. 07 Jan, 2020 12 commits
    • Marton Balint's avatar
      avformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT) · 3414115c
      Marton Balint authored
      Converting explicit avio_flush() calls helps us to buffer more data and avoid
      flushing the IO context too often which causes reduced IO throughput for
      non-streamed file output.
      
      The user can control FLUSH_POINT flushing behaviour using the -flush_packets
      option, the default typically means to flush unless a non-streamed file output
      is used, so this change should have no adverse effect on streaming even if it
      is assumed that after an avio_flush() the output buffer is clean so small
      seekbacks within the output buffer will work even when the IO context is not
      seekable.
      Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
      3414115c
    • Marton Balint's avatar
      avformat: remove more unneeded avio_flush() calls · f4a8ea7f
      Marton Balint authored
      These instances are simply redundant or present because avio_flush() used to be
      required before doing a seekback. That is no longer the case, aviobuf code does
      the flush automatically on seek.
      
      This only affects code which is either disabled for streaming IO contexts or
      does no seekbacks after the flush, so this change should have no adverse effect
      on streaming.
      Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
      f4a8ea7f
    • Marton Balint's avatar
      avformat: remove avio_flush() calls from the end of write_packet functions · c3714639
      Marton Balint authored
      Removing explicit avio_flush() calls helps us to buffer more data and avoid
      flushing the IO context too often which causes reduced IO throughput for
      non-streamed file output.
      
      The user can control flushing behaviour at the end of every packet using the
      -flush_packets option, the default typically means to flush unless a
      non-streamed file output is used.
      
      Therefore this change should have no adverse effect on streaming, even if it is
      assumed that a new packet has a clean buffer so small seekbacks within the
      output buffer work even when the IO context is not seekable.
      Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
      c3714639
    • Marton Balint's avatar
      avformat: remove unneeded avio_flush() calls from the end of write_trailer functions · c05d82fa
      Marton Balint authored
      The IO context is always flushed by libavformat/mux.c after write_trailer is
      called, so this change should have no effect at all.
      c05d82fa
    • Marton Balint's avatar
      avformat: remove avio_flush() calls from the end of write_header functions · 4bf90e09
      Marton Balint authored
      To make it consistent with other muxers.
      
      The user can still control the generic flushing behaviour after write_header
      (same way as after packets) using the -flush_packets option, the default
      typically means to flush unless a non-streamed file output is used.
      
      Therefore this change should have no adverse effect on streaming, even if it is
      assumed that the first packet has a clean buffer, so small seekbacks within the
      output buffer work even when the IO context is not seekable.
      Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
      4bf90e09
    • Marton Balint's avatar
      avformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf() · 4d7f8254
      Marton Balint authored
      avio_close_dyn_buf() also does avio_flush().
      Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
      4d7f8254
    • Guo, Yejun's avatar
      vf_dnn_processing: add support for more formats gray8 and grayf32 · 37d24a6c
      Guo, Yejun authored
      The following is a python script to halve the value of the gray
      image. It demos how to setup and execute dnn model with python+tensorflow.
      It also generates .pb file which will be used by ffmpeg.
      
      import tensorflow as tf
      import numpy as np
      from skimage import color
      from skimage import io
      in_img = io.imread('input.jpg')
      in_img = color.rgb2gray(in_img)
      io.imsave('ori_gray.jpg', np.squeeze(in_img))
      in_data = np.expand_dims(in_img, axis=0)
      in_data = np.expand_dims(in_data, axis=3)
      filter_data = np.array([0.5]).reshape(1,1,1,1).astype(np.float32)
      filter = tf.Variable(filter_data)
      x = tf.placeholder(tf.float32, shape=[1, None, None, 1], name='dnn_in')
      y = tf.nn.conv2d(x, filter, strides=[1, 1, 1, 1], padding='VALID', name='dnn_out')
      sess=tf.Session()
      sess.run(tf.global_variables_initializer())
      graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
      tf.train.write_graph(graph_def, '.', 'halve_gray_float.pb', as_text=False)
      print("halve_gray_float.pb generated, please use \
      path_to_ffmpeg/tools/python/convert.py to generate halve_gray_float.model\n")
      output = sess.run(y, feed_dict={x: in_data})
      output = output * 255.0
      output = output.astype(np.uint8)
      io.imsave("out.jpg", np.squeeze(output))
      
      To do the same thing with ffmpeg:
      - generate halve_gray_float.pb with the above script
      - generate halve_gray_float.model with tools/python/convert.py
      - try with following commands
        ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native out.native.png
        ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow out.tf.png
      Signed-off-by: 's avatarGuo, Yejun <yejun.guo@intel.com>
      Signed-off-by: 's avatarPedro Arthur <bygrandao@gmail.com>
      37d24a6c
    • Guo, Yejun's avatar
      vf_dnn_processing: remove parameter 'fmt' · 04e6f8a1
      Guo, Yejun authored
      do not request AVFrame's format in vf_ddn_processing with 'fmt',
      but to add another filter for the format.
      
      command examples:
      ./ffmpeg -i input.jpg -vf format=bgr24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
      ./ffmpeg -i input.jpg -vf format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
      Signed-off-by: 's avatarGuo, Yejun <yejun.guo@intel.com>
      Signed-off-by: 's avatarPedro Arthur <bygrandao@gmail.com>
      04e6f8a1
    • James Zern's avatar
      742221d3
    • Michael Niedermayer's avatar
      avcodec/vmdaudio: Check block_align more · 06f6857b
      Michael Niedermayer authored
      Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
      Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344
      
      Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
      Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
      06f6857b
    • Limin Wang's avatar
      avfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8 · d31a1266
      Limin Wang authored
      Have tested with be and le pixel format on be and le system for >8bit.
      System:
      lmwang@ubuntu:~/ffmpeg.git.mips$ grep HAVE_BIGENDIAN config.h
      ffmpeg.git git:(showinfo) ✗ grep HAVE_BIGENDIAN config.h
      
      Test result:
      1, yuv420p
      ./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p,showinfo
      Master:
      mean:[16 128 128] stdev:[0.0 0.0 0.0]
      After applied the patch:
       mean:[16 128 128] stdev:[0.0 0.0 0.0]
      
      2, yuv420p10le
      ./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10le,showinfo
      Master:
      mean:[32 1 1] stdev:[32.0 1.0 1.0]
      After applied the patch:
      mean:[64 512 512] stdev:[0.0 0.0 0.0]
      
      3, yuv420p10be
      ./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10be,showinfo
      Master:
      mean:[32 1 1] stdev:[32.0 1.0 1.0]
      After applied the patch:
      mean:[64 512 512] stdev:[0.0 0.0 0.0]
      Signed-off-by: 's avatarLimin Wang <lance.lmwang@gmail.com>
      Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
      d31a1266
    • Andreas Rheinhardt's avatar
      avformat/aviobuf: Honor avio_open[2] documentation · 220846f7
      Andreas Rheinhardt authored
      The documentation of both avio_open() as well as avio_open2() states
      that on failure, the pointer to an AVIOContext given to this function
      (via a pointer to a pointer to an AVIOContext) will be set to NULL. Yet
      it didn't happen upon failure of ffurl_open_whitelist() or when allocating
      the internal buffer failed. This commit changes this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
      220846f7