* [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact
@ 2025-03-21 11:23 Andreas Rheinhardt
2025-03-21 11:40 ` Zhao Zhili
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2025-03-21 11:23 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 27 bytes --]
Patch attached.
- Andreas
[-- Attachment #2: 0001-fftools-ffprobe-Remove-endianness-dependency-of-pix-.patch --]
[-- Type: text/x-patch, Size: 4660 bytes --]
From 399db8b981f7d09cfb7305549a134d6e8522357e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Fri, 21 Mar 2025 12:19:56 +0100
Subject: [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when
bitexact
Also remove the sed workarounds in fate/mxf.mak.
This is supposed to fix the enhanced-flv-hevc-hdr10 test
on big endian systems.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
fftools/ffprobe.c | 33 +++++++++++++++++++++-----
tests/fate/mxf.mak | 4 ++--
tests/ref/fate/enhanced-flv-hevc-hdr10 | 2 +-
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 7341731d2f..ccc046c560 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2651,6 +2651,31 @@ static void print_private_data(WriterContext *w, void *priv_data)
}
}
+static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
+{
+ const char *s = av_get_pix_fmt_name(pix_fmt);
+ enum AVPixelFormat swapped_pix_fmt;
+
+ if (!s) {
+ print_str_opt("pix_fmt", "unknown");
+ } else if (!do_bitexact ||
+ (swapped_pix_fmt = av_pix_fmt_swap_endianness(pix_fmt)) == AV_PIX_FMT_NONE) {
+ print_str ("pix_fmt", s);
+ } else {
+ const char *s2 = av_get_pix_fmt_name(swapped_pix_fmt);
+ char buf[128];
+ size_t i = 0;
+
+ while (s[i] && s[i] == s2[i])
+ i++;
+
+ memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
+ buf[i] = '\0';
+
+ print_str ("pix_fmt", buf);
+ }
+}
+
static void print_color_range(WriterContext *w, enum AVColorRange color_range)
{
const char *val = av_color_range_name(color_range);
@@ -2959,9 +2984,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
print_int("crop_bottom", frame->crop_bottom);
print_int("crop_left", frame->crop_left);
print_int("crop_right", frame->crop_right);
- s = av_get_pix_fmt_name(frame->format);
- if (s) print_str ("pix_fmt", s);
- else print_str_opt("pix_fmt", "unknown");
+ print_pixel_format(w, frame->format);
sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
if (sar.num) {
print_q("sample_aspect_ratio", sar, ':');
@@ -3360,9 +3383,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
print_str_opt("sample_aspect_ratio", "N/A");
print_str_opt("display_aspect_ratio", "N/A");
}
- s = av_get_pix_fmt_name(par->format);
- if (s) print_str ("pix_fmt", s);
- else print_str_opt("pix_fmt", "unknown");
+ print_pixel_format(w, par->format);
print_int("level", par->level);
print_color_range(w, par->color_range);
diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak
index 3e0e70e28b..ba09d136ce 100644
--- a/tests/fate/mxf.mak
+++ b/tests/fate/mxf.mak
@@ -29,7 +29,7 @@ fate-mxf-probe-dnxhd: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k
fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf
-fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/rgb48../rgb48/"
+fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv25
fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-00005.mxf
@@ -37,7 +37,7 @@ fate-mxf-probe-dv25: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
FATE_MXF_PROBE-$(call DEMDEC, MXF, PRORES PCM_S24LE) += fate-mxf-probe-applehdr10
fate-mxf-probe-applehdr10: SRC = $(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf
-fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/yuv422p10../yuv422p10/"
+fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
# Tests remuxing ProRes as well as writing mastering display metadata.
FATE_MXF_FFMPEG_FFPROBE-$(call REMUX, MXF, PRORES_DECODER) += fate-mxf-remux-applehdr10
diff --git a/tests/ref/fate/enhanced-flv-hevc-hdr10 b/tests/ref/fate/enhanced-flv-hevc-hdr10
index cb7acea328..4d93f98e57 100644
--- a/tests/ref/fate/enhanced-flv-hevc-hdr10
+++ b/tests/ref/fate/enhanced-flv-hevc-hdr10
@@ -25,7 +25,7 @@ crop_top=0
crop_bottom=0
crop_left=0
crop_right=0
-pix_fmt=yuv420p10le
+pix_fmt=yuv420p10
sample_aspect_ratio=N/A
pict_type=I
interlaced_frame=0
--
2.45.2
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact
2025-03-21 11:23 [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact Andreas Rheinhardt
@ 2025-03-21 11:40 ` Zhao Zhili
2025-03-21 12:51 ` Andreas Rheinhardt
0 siblings, 1 reply; 5+ messages in thread
From: Zhao Zhili @ 2025-03-21 11:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mar 21, 2025, at 19:23, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>
> Patch attached.
Sometimes the bitstream has builtin endian, not native endian, in which case it shouldn’t be ignored.
>
> - Andreas
>
> <0001-fftools-ffprobe-Remove-endianness-dependency-of-pix-.patch>_______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact
2025-03-21 11:40 ` Zhao Zhili
@ 2025-03-21 12:51 ` Andreas Rheinhardt
2025-03-21 13:09 ` Zhao Zhili
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2025-03-21 12:51 UTC (permalink / raw)
To: ffmpeg-devel
Zhao Zhili:
> On Mar 21, 2025, at 19:23, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>>
>> Patch attached.
>
> Sometimes the bitstream has builtin endian, not native endian, in which case it shouldn’t be ignored.
>
Do you have a list of all decoders for which this is true?
Anyway, the documentation of the bitexact flag says that the output
shall not be dependent on the specific build, which is currently not
guaranteed. If we can't distinguish the cases in which a decoder output
in the codec's "native" endianness from the cases in which it just
outputs in the system's endianness (and I don't see how we would
distinguish these cases), then we need to fix up both to ensure that the
output really does not depend on the specific system.
Should there be a need in the future, we could add an option to be
bitexact, but not normalize the pixel formats.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact
2025-03-21 12:51 ` Andreas Rheinhardt
@ 2025-03-21 13:09 ` Zhao Zhili
2025-03-21 13:14 ` Andreas Rheinhardt
0 siblings, 1 reply; 5+ messages in thread
From: Zhao Zhili @ 2025-03-21 13:09 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Mar 21, 2025, at 20:51, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>
> Zhao Zhili:
>> On Mar 21, 2025, at 19:23, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>>>
>>> Patch attached.
>>
>> Sometimes the bitstream has builtin endian, not native endian, in which case it shouldn’t be ignored.
>>
>
> Do you have a list of all decoders for which this is true?
rawvideo of course :P
And evc.
> Anyway, the documentation of the bitexact flag says that the output
> shall not be dependent on the specific build, which is currently not
> guaranteed. If we can't distinguish the cases in which a decoder output
> in the codec's "native" endianness from the cases in which it just
> outputs in the system's endianness (and I don't see how we would
> distinguish these cases), then we need to fix up both to ensure that the
> output really does not depend on the specific system.
> Should there be a need in the future, we could add an option to be
> bitexact, but not normalize the pixel formats.
>
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact
2025-03-21 13:09 ` Zhao Zhili
@ 2025-03-21 13:14 ` Andreas Rheinhardt
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2025-03-21 13:14 UTC (permalink / raw)
To: ffmpeg-devel
Zhao Zhili:
>
>
>> On Mar 21, 2025, at 20:51, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>>
>> Zhao Zhili:
>>> On Mar 21, 2025, at 19:23, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>>>>
>>>> Patch attached.
>>>
>>> Sometimes the bitstream has builtin endian, not native endian, in which case it shouldn’t be ignored.
>>>
>>
>> Do you have a list of all decoders for which this is true?
>
> rawvideo of course :P
I thought so, but rawvideo also sometimes swaps the endianness of its input.
> And evc.
Crazily, export_stream_params() in lavc/libxevd.c first sets the pix fmt
to the native AV_PIX_FMT_YUV420P10 and then overwrites it
unconditionally with a LE format.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-21 13:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-21 11:23 [FFmpeg-devel] [PATCH] fftools/ffprobe: Remove endianness dependency of pix fmt when, bitexact Andreas Rheinhardt
2025-03-21 11:40 ` Zhao Zhili
2025-03-21 12:51 ` Andreas Rheinhardt
2025-03-21 13:09 ` Zhao Zhili
2025-03-21 13:14 ` Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git