Commit Graph

255 Commits

Author SHA1 Message Date
openvela-robot 5569e7353a hwcontext_vulkan: improve queue family init code
When users zero-init'd the struct, or left it as-is, the encode
queue family matched the graphics queue family, which led it to be
incorrectly logged as being used for encode.

This just improves the logging so this isn't printed anymore.
2026-04-20 20:39:40 +08:00
openvela-robot ea73ba2131 ffmpeg: fix coverity warning
fix resource leaks and self assignment

Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:39:27 +08:00
openvela-robot 4c3136857b avcodec/jpegxl_parser: fix OOB read regression
In f7ac3512f5b5cb8eb149f37300b43461d8e93af3 the size of the dynamically
allocated buffer was shrunk, but it was made too small for very small
alphabet sizes. This patch restores the size to prevent an OOB read.

Reported-by: Cole Dilorenzo <coolkingcole@gmail.com>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2026-04-20 20:39:20 +08:00
openvela-robot 24a9c5e480 FFMPEG: add strict condition to underflow.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:39:16 +08:00
openvela-robot 5a8c3218d2 avcodec/pthread_frame: Remove FF_API_SLICE_OFFSET
Since 432adca5fedcb277b9a715a723cfd40735ec58f8 no decoder
looks at the slice_count and slice_offset fields at all,
so there is no reason to synchronize them between the worker
and the user thread.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-20 20:38:41 +08:00
openvela-robot 2337dcdff9 ffmpeg:reduce query times in ff_nuttx_capbility_query_ranges
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2026-04-20 20:38:37 +08:00
openvela-robot a24195dcbf avcodec/error_resilience: Make applying decode_error_flags optional
Add a pointer parameter that if supplied will be used to return
the updated decode_error_flags. This will allow to fix several
races when using frame-threading; these resulted from AVFrame
that the earlier code updated concurrently being used as source
in an av_frame_ref() call in the decoder's update_thread_context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-20 20:38:31 +08:00
openvela-robot e5f93889b0 ffmpeg: correct function name in vsrc_devsrc and asrc_adevsrc filter
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2026-04-20 20:38:28 +08:00
openvela-robot 8168a75c47 avcodec/smcenc: remove useless cast 2026-04-20 20:38:00 +08:00
openvela-robot 24b75f6a39 ffmpeg:add le audio and a2dp audio option
Signed-off-by: chengkai <chengkai@xiaomi.com>
2026-04-20 20:37:56 +08:00
openvela-robot f6d2b5c056 avformat/matroskaenc: Fix writing of markers
When the marker writing code was merged from libav to FFmpeg
in dc62016c, it failed to take into account that the meaning of
cluster_pos had changed in bda5b662; in particular, the special
value for “I'm not currently working on a cluster” had changed
from 0 to -1. This makes the avio_write_marker() call never
be called. Update the if statement to fix it.

Fixes: Ticket9843
Signed-off-by: Steinar H. Gunderson <steinar+ffmpeg@gunderson.no>
Signed-off-by: Martin Storsjö <martin@martin.st>
2026-04-20 20:37:41 +08:00
openvela-robot d45dcff4a8 ffmpeg : member access within null pointer of type 'struct AVCodecContext'
get sample_rate from inlink in place of enc_ctx.

Signed-off-by: libei1 <libei1@xiaomi.com>
2026-04-20 20:37:37 +08:00
openvela-robot b247d70780 fate/matroska: Stop using unicode in command line paramters
The fate-run.sh shell script exports LC_ALL=C before invoking the
test executables; this is probably done for consistency.

When executing Windows binaries with Wine, it normally handles
UTF-8 command line parameters just fine - but with LC_ALL set to
C, it treats them as plain ASCII.

As the unicode command line parameters wasn't the main thing
being tested here, just convert them to plain ASCII, for
portability. This fixes the test for all test configurations that
use Wine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2026-04-20 20:37:29 +08:00
openvela-robot 1685f31803 FFmpeg: Fix compilation warning about size_t format printing
ffmpeg/libavdevice/nuttx_dec.c:107:39: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
  107 |             snprintf(data, data_size, "%d|%d|%d|%d|%"PRIu64"",
      |                                       ^~~~~~~~~~~~~~~
  108 |                      priv->running, priv->flushing,
  109 |                      priv->period_bytes, priv->periods, dq_count(&priv->bufferq));
      |                                                         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         size_t {aka unsigned int}

Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2026-04-20 20:37:25 +08:00
openvela-robot 0bf5f29940 avfilter/vf_ssim: Fix x86 assembly code for SSIM calculation
This commit fixes bug #10495

The code had several bugs related to post-loop compensation code:
- test assembly instruction performs bitwise AND operation and
generate flags used by jz branch instruction. Wrong test condition
leads to incorrect branching
- Incorrect compensation code for some branches

Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
2026-04-20 20:37:23 +08:00
openvela-robot f05d9e758f FFmpeg: fix format warning in libavdevice/nuttx_dec.c
107 |             snprintf(data, data_size, "%d|%d|%d|%d|%d",
      |                                                    ~^
      |                                                     |
      |                                                     int
      |                                                    %ld
  108 |                      priv->running, priv->flushing,
  109 |                      priv->period_bytes, priv->periods, dq_count(&priv->bufferq));
      |                                                         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         size_t {aka long unsigned int}

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2026-04-20 20:37:18 +08:00
openvela-robot 664f23c83f avcodec/exr: tag gamma=1.0 output as linear light
By default the OpenEXR decoder outputs linear light pixel data by
applying a gamma=1.0 transfer (i.e. a no-op). When it does so, it
should tag the data as linear so color-managed filters or other tools
can work with it correctly.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2026-04-20 20:37:15 +08:00
openvela-robot 773d02532e ffmpeg: let bluelet devices report sample formats
Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:37:11 +08:00
openvela-robot c6e235379e avformat/flvdec: handle exheader fourcc correctly in metadata
In metadata fourcc is carried in the AMF number, not as binary.

Partially based on a patch by Steven Liu.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-04-20 20:36:59 +08:00
openvela-robot c37847a7fe FFmpeg: fix coverity warning in libavdevice/nuttx.c
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2026-04-20 20:36:55 +08:00
openvela-robot fd17e1ad7b libswresample: Prevent out of bounds.
We've been fuzzing torchvision with [sydr-fuzz](https://github.com/ispras/oss-sydr-fuzz)
and found out of bounds error in ffmpeg project at audioconvert.c:151.
To prevent error we need to fix checks for in and out fmt in swr_init.

Signed-off-by: Eli Kobrin <kobrineli@ispras.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-04-20 20:36:47 +08:00
openvela-robot 951e11666c ffmpeg : adevsink add support to get current playback timestamp
adevsink add support to get current playback timestamp.

Signed-off-by: libei1 <libei1@xiaomi.com>
2026-04-20 20:36:38 +08:00
openvela-robot 8a3ef023ab fftools/ffprobe: Fix memleak
Fixes Coverity issue #1524491.
Regression since e6126abc6997058ca49ee596b70611bbe367163e.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-20 20:36:35 +08:00
openvela-robot 2a63a6b065 ffmpeg:optimize bluelet enc control msg case
optimize bluelet enc control msg case

Signed-off-by: shipei <shipei@xiaomi.com>
2026-04-20 20:36:32 +08:00
openvela-robot 48787dc6df avcodec: move mastering display colour volume SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2026-04-20 20:36:26 +08:00
openvela-robot b6455e61f3 ffmpeg: bluelet_dec handles start/stop instead of play/pause
Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:36:23 +08:00
openvela-robot 1b66c53eef hwcontext_vulkan: hide Linux-only header after 571756bf2fe2
major/minor are in <sys/types.h> on BSDs and <sys/mkdev.h> on Solaris-like.

libavutil/hwcontext_vulkan.c:55:10: fatal error: 'sys/sysmacros.h' file not found
#include <sys/sysmacros.h>
^~~~~~~~~~~~~~~~~
2026-04-20 20:36:16 +08:00
openvela-robot 6dcc9fb36f FFMPEG: query sample_format from audio driver.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:36:12 +08:00
openvela-robot 18ce7087fe lavd/opengl: select the GL context before drawing
Since “2d924b3a63 fftools/ffmpeg: move each muxer to a separate thread”,
opengl_write_packet() is called from a different thread than
opengl_write_header() and would nothing for lack of a selected context.
2026-04-20 20:35:57 +08:00
openvela-robot a908a5723a FFMPEG: use start/stop command to control device filter.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:35:42 +08:00
openvela-robot f903ae1658 avcodec/decode: Return EAGAIN instead of discarding unused packet
Should fix #10457, a regression caused by
69516ab3e917a6e91d26e38d04183c60fd71cbab.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-20 20:35:37 +08:00
openvela-robot 434d603b18 ffmpeg:add bluelet leaudio dec/enc handler
Signed-off-by: chengkai <chengkai@xiaomi.com>
2026-04-20 20:35:33 +08:00
openvela-robot 3d4081fba4 lavc: add a header for internal generic-layer APIs
The goal is to distinguish between APIs provided by the generic layer to
individual codecs and APIs internal to the generic layer.

Start by moving ff_{decode,encode}_receive_frame() and
ff_{decode,encode}_preinit() into this new header, as those functions
are called from generic code and should not be visible to individual
codecs.
2026-04-20 20:35:28 +08:00
openvela-robot 7f66e86a15 ffmpeg: adevsrc should report accurate ch_layout
Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:35:24 +08:00
openvela-robot 0fd69129a5 amfenc: Update the min version to 1.4.29.0 for AMF SDK. 2026-04-20 20:35:15 +08:00
openvela-robot 5ed8233148 libavdevice/nuttx : nuttx enc support get_output_timestamp
JIRA-ID:VELAPLATFO-8755

nuttx_enc compute timestamp, and add get_output_timestamp

Signed-off-by: libei1 <libei1@xiaomi.com>
2026-04-20 20:35:11 +08:00
openvela-robot e1b5c84cd3 avformat/evc: use get_ue_golomb_long()
This partially reverts commit d0fc1b3507c, which reintroduced a regression
originally fixed in 5e9986fd2d.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-20 20:35:08 +08:00
openvela-robot 2a2eefee82 ffmpeg : improve libavdevice/nuttx captured definition
JIRA-ID:VELAPLATFO-9568

add bool capture for in/out device, add io_bytes for both devices

Signed-off-by: libei1 <libei1@xiaomi.com>
2026-04-20 20:35:05 +08:00
openvela-robot 73855e8f18 doc/filters: correct luma terminology
Partially fixes #10427

See https://poynton.ca/notes/colour_and_gamma/ColorFAQ.html#RTFToC11 for
ref.
2026-04-20 20:35:02 +08:00
openvela-robot 29665002de FFMPEG: code optimizing.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:34:58 +08:00
openvela-robot b0a492cdcb avfilter/af_afir: do not use ff_outlink_get_status() on inlinks 2026-04-20 20:34:11 +08:00
openvela-robot 89a65397fa FFMPEG: fix dereference pkt is null
check pkt whether is null avoid avcodec_receive_packet function call av_packet_unref dereference segmentation fault.

Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:34:08 +08:00
openvela-robot 1d98ae6c8a avcodec/av1dec: convert to receive_frame()
This removes the overhead of inserting the av1_frame_split bsf as part of the
decoding process.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-20 20:33:49 +08:00
openvela-robot 7f73494f77 FFMPEG: Fix warnings.
ffmpeg/libavdevice/nuttx.c:451:57: warning: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  451 |     av_log(NULL, AV_LOG_DEBUG, "[%s][%s] configure, sr:%u ch:%d ret:%d\n",
      |                                                        ~^
      |                                                         |
      |                                                         unsigned int
      |                                                        %lu
  452 |         __func__, priv->devname, priv->sample_rate, priv->ch_layout.nb_channels, ret);
      |                                  ~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint32_t {aka long unsigned int}

Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:33:46 +08:00
openvela-robot 035e455b52 fate/tests/ffmpeg: use -idct simple for fate-ffmpeg-input-r
Makes the test bitexact on non-x86_64.
2026-04-20 20:33:42 +08:00
openvela-robot 841a14fc5a external/ffmpeg: check ranges of channels
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2026-04-20 20:33:38 +08:00
Ting Fu 2c40002ff0 lavfi/dnn: Modified DNN native backend related tools and docs.
Will remove native backend, so change the default backend in filters,
and also remove the python scripts which generate native model file.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:32:56 +08:00
openvela-robot 9903242bf8 doc/filters/libplacebo: remove outdated example
This example being first is now misleading because round-tripping
through hwdownload/hwupload is neither required nor recommended. Also,
the comment about avoiding format conversion is unnecessary because
`libplacebo` will now inherit the input frame format by default.
2026-04-20 20:32:54 +08:00
openvela-robot ae7e7b05d9 ffmpeg: plentful debug log
N/A

1. device ioctl debug log e.g.
[   26.191100] [14] [ DEBUG] [ap] [ff_nuttx_open][/dev/audio/pcm0p] configure, sr:44100 ch:2 ret:0
[   26.191200] [14] [ DEBUG] [ap] [ff_nuttx_open][/dev/audio/pcm0p] set buffer info, n:4 size:3528
[   26.191300] [14] [ DEBUG] [ap] [ff_nuttx_open][/dev/audio/pcm0p] get buffer info, n:4 size:3528 ret:0
[   26.534200] [14] [ DEBUG] [ap] [ff_nuttx_write_data][/dev/audio/pcm0p] start ret:0

2. format negotiation debug log e.g.
[   21.142400] [14] [ DEBUG] [ap]
                 amix@MixSpeaker   chs: order:1,ch:2,0x3
                  adevsink@pcm0p   chs: order:0,ch:1,0x0 order:0,ch:2,0x0
                 amix@MixSpeaker rates: 44100
                  adevsink@pcm0p rates: 8000 11025 16000 22050 32000 44100 48000
                 amix@MixSpeaker  fmts: s16p
                  adevsink@pcm0p  fmts: s16
[   21.142500] [14] [ DEBUG] [ap]
                 amix@MixSpeaker   chs: order:1,ch:2,0x3
                  adevsink@pcm0p   chs: order:1,ch:2,0x3
                 amix@MixSpeaker rates: 44100
                  adevsink@pcm0p rates: 44100
                 amix@MixSpeaker  fmts: s16p
                  adevsink@pcm0p  fmts: s16
[   21.142700] [14] [ DEBUG] [ap] Setting 'converter' to value '4'
[   21.142800] [14] [ DEBUG] [ap] auto-inserting filter 'auto_aresample' between the filter 'amix@MixSpeaker' and the filter 'adevsink@pcm0p'

Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:32:51 +08:00
openvela-robot 9050404993 avcodec/libx264: add a flush callback
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-20 20:32:14 +08:00
openvela-robot 24478030d4 FFMPEG: fix system crash when sim boot whithout camera
Signed-off-by: lile7 <lile7@xiaomi.com>
2026-04-20 20:32:11 +08:00
openvela-robot f3b118c812 libavformat/tcp: add local_addr/local_port for network option
Signed-off-by: jackarain <jack.wgm@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2026-04-20 20:32:04 +08:00
openvela-robot d9f83b4739 FFMPEG: add offload option in adevsink.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:32:01 +08:00
openvela-robot 5ab7442253 lavc/codec_desc.c: remove AV_CODEC_PROP_TEXT_SUB property from ARIB_CAPTION
To support bitmap subtitle output, remove AV_CODEC_PROP_TEXT_SUB
property from codec descriptor for AV_CODEC_ID_ARIB_CAPTION.
This is similar to `libavcodec/libzvbi-teletextdec.c`
(AV_CODEC_ID_DVB_TELETEXT).

Instead, each subtitle decoder has to specify a subtitile format.
`libavcodec/libaribb24.c` uses same AV_CODEC_ID_ARIB_CAPTION and
expects AV_CODEC_PROP_TEXT_SUB to be set, so this adds a line to
specify a format there.

Signed-off-by: rcombs <rcombs@rcombs.me>
2026-04-20 20:31:57 +08:00
openvela-robot e22343cd0e FFMPEG: add default codec setting in query_format.
dependson:888283

1, Filters which hook query_formats, set codecs in filter_query_formats.
streamselect is exception because it hook sanitize_formats.

2, Filters which doesn't hook query_formats, set codecs in ff_default_query_formats.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:31:54 +08:00
openvela-robot 8161f26c12 avcodec/avutil: move dynamic HDR10+ metadata parsing to libavutil
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-20 20:31:47 +08:00
openvela-robot 96e3f5956c ffmpeg: fix NULL strcmp error
N/A

Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:31:43 +08:00
openvela-robot d82f9ae7d8 lavu/frame: improve AVFrame.opaque[_ref] documentation
Make them match each other, mention interaction with
AV_CODEC_FLAG_COPY_OPAQUE.
2026-04-20 20:31:34 +08:00
openvela-robot a8e85bba00 ffmpeg: nuttx_dec support temparory pause
Signed-off-by: jihandong <jihandong@xiaomi.com>
2026-04-20 20:31:30 +08:00
openvela-robot 51b3e1bb2d avfilter/af_afir: reduce output gain with default parameters
It was unreasonably high. Also change scaling to reduce
rare quantization errors.
2026-04-20 20:30:36 +08:00
openvela-robot dcac24dcec ffmpeg: fix uinit error
0  0x5672bb6e in avformat_free_context (s=0x56d21060) at ffmpeg/libavformat/avformat.c:129
1  0x567ddf8e in adevsink_uninit (ctx=0x56d228b0) at ffmpeg/libavfilter/asink_adevsink.c:169
2  0x56721835 in avfilter_free (filter=0x56d228b0) at ffmpeg/libavfilter/avfilter.c:863
3  0x5672a92e in create_filter (log_ctx=0x56d14590, args=0x56d23050 "format=nuttx:devname=/dev/audio/pcm0p", name=0x56d22f40 "adevsink@pcm0p", index=<optimized out>, ctx=0xfffffffe,
   filt_ctx=0xf6ec3e88) at ffmpeg/libavfilter/graphparser.c:158
4  parse_filter (filt_ctx=filt_ctx@entry=0xf6ec3e88, buf=buf@entry=0xf6ec3e6c, graph=graph@entry=0x56d14590, index=24, log_ctx=0x56d14590) at ffmpeg/libavfilter/graphparser.c:201
5  0x5672af22 in avfilter_graph_parse2 (graph=0x56d14590, filters=<optimized out>, inputs=0xf6ec3ed8, outputs=0xf6ec3edc) at ffmpeg/libavfilter/graphparser.c:438
6  0x5671bc90 in media_graph_load (priv=0x56d16bf0, conf=0x56a5a466 "/etc/media/graph.conf") at media_graph.c:153
7  0x5671c435 in media_graph_create (file=0x56a5a466) at media_graph.c:337
8  0x56713f0b in mediad_main (argc=1, argv=0xf6cb5040) at media_daemon.c:163
9  0x5658de28 in nxtask_startup (entrypt=0x56713e8b <mediad_main>, argc=1, argv=0xf6cb5040) at sched/task_startup.c:70
10 0x5657ff82 in nxtask_start () at task/task_start.c:134
11 0xdeadbeef in ?? ()

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 20:30:32 +08:00
openvela-robot edc934782f avcodec/pnmenc: Check av_image_get_buffer_size()
Fixes the crash in ticket #10050.
Also ensure that we don't overflow before ff_get_encode_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-20 20:30:02 +08:00
openvela-robot 1d136bd248 bluelet:fix build error if not enable CONFIG_NET_RPMSG
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 20:29:57 +08:00
openvela-robot 6d4e16b532 avfilter/af_firequalizer: switch to TX from lavu 2026-04-20 20:29:50 +08:00
openvela-robot 9299ef8b7b ffmpeg/bluelet:fix warning
libavdevice/bluelet.c:357:33: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
  357 |                 "channel_mode=%lu:blocks=%lu:subbands=%lu:alloc_method=%lu:bitpool=%lu",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %u
  358 |                 param.channel_mode, param.blocks, param.subbands, param.alloc_method, param.bitpool);
      |                 ~~~~~~~~~~~~~~~~~~
      |                      |
      |                      uint32_t {aka unsigned int}
libavdevice/bluelet.c:357:44: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
  357 |                 "channel_mode=%lu:blocks=%lu:subbands=%lu:alloc_method=%lu:bitpool=%lu",
      |                                          ~~^
      |                                            |
      |                                            long unsigned int
      |                                          %u
  358 |                 param.channel_mode, param.blocks, param.subbands, param.alloc_method, param.bitpool);
      |                                     ~~~~~~~~~~~~
      |                                          |
      |                                          uint32_t {aka unsigned int}

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 20:29:47 +08:00
openvela-robot 0e99873ffa avfilter/af_loudnorm: fix incorrect gain when audio is shorter than 3s
The input data is multiplied by `s->offset` to get normalized output.
`s->target_tp` and `true_peak` is not in dB,
so `s->offset` should be calculated by division instead of subtraction.

Signed-off-by: Rui Zhu <real.zhurui@gmail.com>
2026-04-20 20:29:37 +08:00
openvela-robot 5de2d251c8 FFmpeg/bluelet:adapt to 5.1.1 version
Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 20:29:34 +08:00
openvela-robot d4c7951080 avfilter/vf_pseudocolor: add spectral preset 2026-04-20 20:29:22 +08:00
openvela-robot 90eb42bda6 Merge branch 'origin511' into sync511 2026-04-20 20:29:19 +08:00
Limin Wang 25f51f455f avfilter/dnn/dnn_backend_tf: simplify the code with ff_hex_to_data
please use tools/python/tf_sess_config.py to get the sess_config after that.
note the byte order of session config is in normal order.
bump the MICRO version for the config change.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2026-04-20 20:19:33 +08:00
Wenlong Ding 9bf86b50ce lavfi/dnn/dnn_backend_native_layer_mathunary: add exp support
Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
2026-04-20 20:18:53 +08:00
Mingyu Yin 01d7cb6160 dnn/native: add native support for dense
Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2026-04-20 20:15:25 +08:00
Mingyu Yin e00f9d75a6 dnn_backend_native_layer_mathbinary: add floormod support
Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2026-04-20 20:14:42 +08:00
Mingyu Yin b17754d5a4 dnn_backend_native_layer_mathunary: add round support
Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:14:32 +08:00
Ting Fu fbdc2f17a0 dnn/native: add native support for avg_pool
Not support pooling strides in channel dimension yet.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:14:30 +08:00
Mingyu Yin 8d7156c45b dnn_backend_native_layer_mathunary: add floor support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'floor'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y_ = tf.math.floor(input_x*255)/255
    y = tf.identity(y_, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py {}_savemodel/model.pb --outdir={}_savemodel/ \n \nto generate model.model\n".format(name,name))

    output = sess.run(y, feed_dict={ input_x: in_data})
    imageio.imsave("out.jpg", np.squeeze(output))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 {}_savemodel/tensorflow_out.md5\n  \
    or\n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow {}_savemodel/out_tensorflow.jpg\n \nto generate output result of tensorflow model\n".format(name, name, name, name))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 {}_savemodel/native_out.md5\n  \
    or \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native {}_savemodel/out_native.jpg\n \nto generate output result of native model\n".format(name, name, name, name))

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2026-04-20 20:14:27 +08:00
Mingyu Yin 57e034adad dnn_backend_native_layer_mathunary: add ceil support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'ceil'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y = tf.math.ceil( input_x, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py ceil_savemodel/model.pb --outdir=ceil_savemodel/ \n \n \
    to generate model.model\n")

    output = sess.run(y, feed_dict={ input_x: in_data})
    imageio.imsave("out.jpg", np.squeeze(output))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 ceil_savemodel/tensorflow_out.md5\n \n \
    to generate output result of tensorflow model\n")

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 ceil_savemodel/native_out.md5\n \n \
    to generate output result of native model\n")

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:14:26 +08:00
Ting Fu 469fc45766 dnn_backend_native_layer_mathunary: add atanh support
It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')

please uncomment the part you want to test

x_sinh_1 = tf.sinh(x)
x_out = tf.divide(x_sinh_1, 1.176) # sinh(1.0)

x_cosh_1 = tf.cosh(x)
x_out = tf.divide(x_cosh_1, 1.55) # cosh(1.0)

x_tanh_1 = tf.tanh(x)
x__out = tf.divide(x_tanh_1, 0.77) # tanh(1.0)

x_asinh_1 = tf.asinh(x)
x_out = tf.divide(x_asinh_1, 0.89) # asinh(1.0/1.1)

x_acosh_1 = tf.add(x, 1.1)
x_acosh_2 = tf.acosh(x_acosh_1) # accept (1, inf)
x_out = tf.divide(x_acosh_2, 1.4) # acosh(2.1)

x_atanh_1 = tf.divide(x, 1.1)
x_atanh_2 = tf.atanh(x_atanh_1) # accept (-1, 1)
x_out = tf.divide(x_atanh_2, 1.55) # atanhh(1.0/1.1)

y = tf.identity(x_out, name='dnn_out') #please only preserve the x_out you want to test

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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu 9bb206f887 dnn_backend_native_layer_mathunary: add acosh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu a2a83a6e47 dnn_backend_native_layer_mathunary: add asinh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu 51eb6e3697 dnn_backend_native_layer_mathunary: add tanh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu 7ba2f132c8 dnn_backend_native_layer_mathunary: add cosh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu ec36314dc0 dnn_backend_native_layer_mathunary: add sinh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2026-04-20 20:14:09 +08:00
Ting Fu ebccdd69a6 dnn_backend_native_layer_mathunary: add atan support
It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.atan(x)
x2 = tf.divide(x1, 3.1416/4) # pi/4
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:14:01 +08:00
Ting Fu 7e53492439 dnn_backend_native_layer_mathunary: add acos support
It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.acos(x)
x2 = tf.divide(x1, 3.1416/2) # pi/2
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:14:01 +08:00
Ting Fu 146c9191eb dnn_backend_native_layer_mathunary: add asin support
It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.asin(x)
x2 = tf.divide(x1, 3.1416/2) # pi/2
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:14:01 +08:00
Ting Fu 6dfbc96d37 dnn_backend_native_layer_mathunary: add tan support
It can be tested with the model generated with below python scripy

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 0.78)
x2 = tf.tan(x1)
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:13:46 +08:00
Ting Fu 966133bd6a dnn_backend_native_layer_mathunary: add cos support
It can be tested with the model generated with below python scripy

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 1.5)
x2 = tf.cos(x1)
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:13:46 +08:00
Ting Fu 29e32e8e3a dnn_backend_native_layer_mathunary: add sin support
It can be tested with the model file generated with below python scripy:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 3.14)
x2 = tf.sin(x1)
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2026-04-20 20:13:46 +08:00
Ting Fu 2c62ed9150 dnn_backend_native_layer_mathunary: add abs support
more math unary operations will be added here

It can be tested with the model file generated with below python scripy:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.subtract(x, 0.5)
x2 = tf.abs(x1)
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:13:20 +08:00
Guo, Yejun fed73deee2 dnn/native: add native support for minimum
it can be tested with model file generated with below python script:
import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.minimum(0.7, x)
x2 = tf.maximum(x1, 0.4)
y = tf.identity(x2, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:12:56 +08:00
Guo, Yejun 433d3f3906 dnn/native: add native support for divide
it can be tested with model file generated with below python script:
import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
z1 = 2 / x
z2 = 1 / z1
z3 = z2 / 0.25 + 0.3
z4 = z3 - x * 1.5 - 0.3
y = tf.identity(z4, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:12:39 +08:00
Guo, Yejun 1c8338d020 dnn/native: add native support for 'mul'
it can be tested with model file generated from above python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
z1 = 0.5 + 0.3 * x
z2 = z1 * 4
z3 = z2 - x - 2.0
y = tf.identity(z3, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:12:39 +08:00
Guo, Yejun 88edd34908 dnn/native: add native support for 'add'
It can be tested with the model file generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
z1 = 0.039 + x
z2 = x + 0.042
z3 = z1 + z2
z4 = z3 - 0.381
z5 = z4 - x
y = tf.math.maximum(z5, 0.0, 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, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:12:39 +08:00
Guo, Yejun c3705ef175 dnn_backend_native_layer_mathbinary: add sub support
more math binary operations will be added here

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:12:20 +08:00
Guo, Yejun 73a0274ccb convert_from_tensorflow.py: add support when kernel size is 1*1 with one input/output channel (gray image)
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:10:37 +08:00
Guo, Yejun a3d1485050 dnn: add tf.nn.conv2d support for native model
Unlike other tf.*.conv2d layers, tf.nn.conv2d does not create many
nodes (within a scope) in the graph, it just acts like other layers.
tf.nn.conv2d only creates one node in the graph, and no internal
nodes such as 'kernel' are created.

The format of native model file is also changed, a flag named
has_bias is added, so change the version number.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:10:02 +08:00
Guo, Yejun 7a863118e1 libavfilter/dnn: add layer maximum for native mode.
The reason to add this layer is that it is used by srcnn in vf_sr.
This layer is currently ignored in native mode. After this patch,
we can add multiple outputs support for native mode.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:09:16 +08:00
Guo, Yejun b6410b7b41 libavfilter/dnn: add header into native model file
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:46 +08:00
Guo, Yejun e79349bb2f dnn: export operand info in python script and load in c code
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:40 +08:00
Guo, Yejun ced0dcbf31 dnn: change .model file format to put layer number at the end of file
currently, the layer number is at the beginning of the .model file,
so we have to scan twice in python script, the first scan to get the
layer number. Only one scan needed after put the layer number at the
end of .model file.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:40 +08:00
Guo, Yejun dabafcd32b convert_from_tensorflow.py: support conv2d with dilation
conv2d with dilation > 1 generates tens of nodes in graph, it is not
easy to parse each node one by one, so we do special tricks to parse
the conv2d layer.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:30 +08:00
Guo, Yejun 26dfc526b1 convert_from_tensorflow.py: add option to dump graph for visualization in tensorboard
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:30 +08:00
Guo, Yejun 0bbbd17a31 dnn: convert tf.pad to native model in python script, and load/execute it in the c code.
since tf.pad is enabled, the conv2d(valid) changes back to its original behavior.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2026-04-20 20:08:18 +08:00
Guo, Yejun 8bcdb534e2 tools/python: add script to convert TensorFlow model (.pb) to native model (.model)
For example, given TensorFlow model file espcn.pb,
to generate native model file espcn.model, just run:
python convert.py espcn.pb

In current implementation, the native model file is generated for
specific dnn network with hard-code python scripts maintained out of ffmpeg.
For example, srcnn network used by vf_sr is generated with
https://github.com/HighVoltageRocknRoll/sr/blob/master/generate_header_and_model.py#L85

In this patch, the script is designed as a general solution which
converts general TensorFlow model .pb file into .model file. The script
now has some tricky to be compatible with current implemention, will
be refined step by step.

The script is also added into ffmpeg source tree. It is expected there
will be many more patches and community needs the ownership of it.

Another technical direction is to do the conversion in c/c++ code within
ffmpeg source tree. While .pb file is organized with protocol buffers,
it is not easy to do such work with tiny c/c++ code, see more discussion
at http://ffmpeg.org/pipermail/ffmpeg-devel/2019-May/244496.html. So,
choose the python script.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2026-04-20 20:07:58 +08:00