* [FFmpeg-devel] [PATCH 2/8 v2] avutil/stereo3d: add a Stereo3D type to signal that the packing is defined by the view field
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 19:59 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 3/8 v2] avformat/mov: default to Monoscopic view when parsing eyes box James Almer
` (6 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
Given that a video stream/frame may have only one view coded, or both packed in
an undefined way, and as the values of AVStereo3DView and AVStereo3DType may
clash (namely if type is AV_STEREO3D_2D, then AV_STEREO3D_VIEW_PACKED would be
invalid, and if it's anything other than it, then only AV_STEREO3D_VIEW_PACKED
would be valid), this commit adds a new type value AV_STEREO3D_VIEW that
signals the user that AVStereo3D.view contains information about the nature of
the stream, with the added constrain that AVStereo3D.view should be ignored if
AVStereo3D.type is anything other than AV_STEREO3D_VIEW.
Signed-off-by: James Almer <jamrial@gmail.com>
---
This is the only way i could think of to work around the fact AVStereo3DType
and AVStereo3DView just can't work well together if we want to keep AVStereo
backwards compatible.
libavutil/stereo3d.c | 1 +
libavutil/stereo3d.h | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index 0c0cad127c..e8e5030db9 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -65,6 +65,7 @@ static const char * const stereo3d_type_names[] = {
[AV_STEREO3D_SIDEBYSIDE_QUINCUNX] = "side by side (quincunx subsampling)",
[AV_STEREO3D_LINES] = "interleaved lines",
[AV_STEREO3D_COLUMNS] = "interleaved columns",
+ [AV_STEREO3D_VIEW] = "view defined",
};
static const char * const stereo3d_view_names[] = {
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 77340f72b2..e3af519e03 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -136,6 +136,14 @@ enum AVStereo3DType {
* @endcode
*/
AV_STEREO3D_COLUMNS,
+
+ /**
+ * Video may be monoscopic, or stereoscopic where either the
+ * packing is unknown or only one view is present.
+ *
+ * @see AVStereo3DView
+ */
+ AV_STEREO3D_VIEW,
};
/**
@@ -207,7 +215,8 @@ typedef struct AVStereo3D {
int flags;
/**
- * Determines which views are packed.
+ * Determines which views are packed. This field should be ignored when
+ * @ref type is set to anything other than AV_STEREO3D_VIEW.
*/
enum AVStereo3DView view;
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/8 v2] avutil/stereo3d: add a Stereo3D type to signal that the packing is defined by the view field
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 2/8 v2] avutil/stereo3d: add a Stereo3D type to signal that the packing is defined by the view field James Almer
@ 2024-06-22 19:59 ` James Almer
0 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 19:59 UTC (permalink / raw)
To: ffmpeg-devel
On 6/22/2024 12:31 PM, James Almer wrote:
> Given that a video stream/frame may have only one view coded, or both packed in
> an undefined way, and as the values of AVStereo3DView and AVStereo3DType may
> clash (namely if type is AV_STEREO3D_2D, then AV_STEREO3D_VIEW_PACKED would be
> invalid, and if it's anything other than it, then only AV_STEREO3D_VIEW_PACKED
> would be valid), this commit adds a new type value AV_STEREO3D_VIEW that
> signals the user that AVStereo3D.view contains information about the nature of
> the stream, with the added constrain that AVStereo3D.view should be ignored if
> AVStereo3D.type is anything other than AV_STEREO3D_VIEW.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> This is the only way i could think of to work around the fact AVStereo3DType
> and AVStereo3DView just can't work well together if we want to keep AVStereo
> backwards compatible.
And this is also not ok given that type == AV_STEREO3D_FRAMESEQUENCE can
(and should) go alongside view == AV_STEREO3D_VIEW_{LEFT,RIGHT}. Plus
the fact AVStereo3DView has been around for a while, so the
inconsistencies (like type 2D and view packed being default) are not new...
I'll look at this a bit more and send a new set.
>
> libavutil/stereo3d.c | 1 +
> libavutil/stereo3d.h | 11 ++++++++++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
> index 0c0cad127c..e8e5030db9 100644
> --- a/libavutil/stereo3d.c
> +++ b/libavutil/stereo3d.c
> @@ -65,6 +65,7 @@ static const char * const stereo3d_type_names[] = {
> [AV_STEREO3D_SIDEBYSIDE_QUINCUNX] = "side by side (quincunx subsampling)",
> [AV_STEREO3D_LINES] = "interleaved lines",
> [AV_STEREO3D_COLUMNS] = "interleaved columns",
> + [AV_STEREO3D_VIEW] = "view defined",
> };
>
> static const char * const stereo3d_view_names[] = {
> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
> index 77340f72b2..e3af519e03 100644
> --- a/libavutil/stereo3d.h
> +++ b/libavutil/stereo3d.h
> @@ -136,6 +136,14 @@ enum AVStereo3DType {
> * @endcode
> */
> AV_STEREO3D_COLUMNS,
> +
> + /**
> + * Video may be monoscopic, or stereoscopic where either the
> + * packing is unknown or only one view is present.
> + *
> + * @see AVStereo3DView
> + */
> + AV_STEREO3D_VIEW,
> };
>
> /**
> @@ -207,7 +215,8 @@ typedef struct AVStereo3D {
> int flags;
>
> /**
> - * Determines which views are packed.
> + * Determines which views are packed. This field should be ignored when
> + * @ref type is set to anything other than AV_STEREO3D_VIEW.
> */
> enum AVStereo3DView view;
>
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 3/8 v2] avformat/mov: default to Monoscopic view when parsing eyes box
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 2/8 v2] avutil/stereo3d: add a Stereo3D type to signal that the packing is defined by the view field James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 4/8 v2] avformat/dump: print Stereo3D view only when type is view defined James Almer
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/mov.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f08fec3fb6..9b2ce1f167 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6546,7 +6546,8 @@ static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int size, flags = 0;
int64_t remaining;
uint32_t tag, baseline = 0;
- enum AVStereo3DView view = AV_STEREO3D_VIEW_PACKED;
+ enum AVStereo3DType type = AV_STEREO3D_2D;
+ enum AVStereo3DView view = AV_STEREO3D_VIEW_MONO;
enum AVStereo3DPrimaryEye primary_eye = AV_PRIMARY_EYE_NONE;
AVRational horizontal_disparity_adjustment = { 0, 1 };
@@ -6596,6 +6597,9 @@ static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
view = AV_STEREO3D_VIEW_LEFT;
else if (has_right)
view = AV_STEREO3D_VIEW_RIGHT;
+ if (view)
+ type = AV_STEREO3D_VIEW;
+
break;
}
case MKTAG('h','e','r','o'): {
@@ -6697,6 +6701,7 @@ static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
sc->stereo3d->flags = flags;
+ sc->stereo3d->type = type;
sc->stereo3d->view = view;
sc->stereo3d->primary_eye = primary_eye;
sc->stereo3d->baseline = baseline;
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 4/8 v2] avformat/dump: print Stereo3D view only when type is view defined
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 2/8 v2] avutil/stereo3d: add a Stereo3D type to signal that the packing is defined by the view field James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 3/8 v2] avformat/mov: default to Monoscopic view when parsing eyes box James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 5/8 v2] fftools/ffprobe: infer AVStereo3D.view when it's not explicit James Almer
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/dump.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 61a2c6a29f..33d72b7e18 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -259,9 +259,10 @@ static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
stereo = (const AVStereo3D *)sd->data;
- av_log(ctx, log_level, "%s, view: %s, primary eye: %s",
- av_stereo3d_type_name(stereo->type), av_stereo3d_view_name(stereo->view),
- av_stereo3d_primary_eye_name(stereo->primary_eye));
+ av_log(ctx, log_level, "%s", av_stereo3d_type_name(stereo->type));
+ if (stereo->type == AV_STEREO3D_VIEW)
+ av_log(ctx, log_level, ", view: %s", av_stereo3d_view_name(stereo->view));
+ av_log(ctx, log_level, ", primary eye: %s", av_stereo3d_primary_eye_name(stereo->primary_eye));
if (stereo->baseline)
av_log(ctx, log_level, ", baseline: %"PRIu32"", stereo->baseline);
if (stereo->horizontal_disparity_adjustment.num && stereo->horizontal_disparity_adjustment.den)
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 5/8 v2] fftools/ffprobe: infer AVStereo3D.view when it's not explicit
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
` (2 preceding siblings ...)
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 4/8 v2] avformat/dump: print Stereo3D view only when type is view defined James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 6/8 v2] avutil/stereo3d: add a new allocator function that returns a size James Almer
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
Better infer it than not printing it, following the logic from 5140d8334e3b.
fftools/ffprobe.c | 6 +++++-
tests/ref/fate/matroska-stereo_mode | 8 ++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index d7ba980ff9..397ea848fc 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2542,9 +2542,13 @@ static void print_pkt_side_data(WriterContext *w,
print_int("rotation", rotation);
} else if (sd->type == AV_PKT_DATA_STEREO3D) {
const AVStereo3D *stereo = (AVStereo3D *)sd->data;
+ enum AVStereo3DView view = stereo->view;
print_str("type", av_stereo3d_type_name(stereo->type));
print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
- print_str("view", av_stereo3d_view_name(stereo->view));
+ if (stereo->type != AV_STEREO3D_VIEW)
+ view = (stereo->type == AV_STEREO3D_2D) ?
+ AV_STEREO3D_VIEW_MONO : AV_STEREO3D_VIEW_PACKED;
+ print_str("view", av_stereo3d_view_name(view));
print_str("primary_eye", av_stereo3d_primary_eye_name(stereo->primary_eye));
print_int("baseline", stereo->baseline);
print_q("horizontal_disparity_adjustment", stereo->horizontal_disparity_adjustment, '/');
diff --git a/tests/ref/fate/matroska-stereo_mode b/tests/ref/fate/matroska-stereo_mode
index e35425ae76..26c325b20e 100644
--- a/tests/ref/fate/matroska-stereo_mode
+++ b/tests/ref/fate/matroska-stereo_mode
@@ -132,7 +132,7 @@ TAG:DURATION=00:00:10.000000000
side_data_type=Stereo 3D
type=side by side
inverted=0
-view=monoscopic
+view=packed
primary_eye=none
baseline=0
horizontal_disparity_adjustment=0/1
@@ -152,7 +152,7 @@ TAG:DURATION=00:00:10.000000000
side_data_type=Stereo 3D
type=top and bottom
inverted=1
-view=monoscopic
+view=packed
primary_eye=none
baseline=0
horizontal_disparity_adjustment=0/1
@@ -170,7 +170,7 @@ TAG:DURATION=00:00:10.000000000
side_data_type=Stereo 3D
type=interleaved lines
inverted=1
-view=monoscopic
+view=packed
primary_eye=none
baseline=0
horizontal_disparity_adjustment=0/1
@@ -189,7 +189,7 @@ TAG:DURATION=00:00:10.000000000
side_data_type=Stereo 3D
type=interleaved columns
inverted=1
-view=monoscopic
+view=packed
primary_eye=none
baseline=0
horizontal_disparity_adjustment=0/1
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 6/8 v2] avutil/stereo3d: add a new allocator function that returns a size
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
` (3 preceding siblings ...)
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 5/8 v2] fftools/ffprobe: infer AVStereo3D.view when it's not explicit James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 7/8 v2] avformat/mov: don't use sizeof(AVStereo3D) James Almer
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
av_stereo3d_alloc() is not useful in scenarios where you need to know the
runtime size of AVStereo3D.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavutil/stereo3d.c | 8 ++++++++
libavutil/stereo3d.h | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index e8e5030db9..c182b18e52 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -32,6 +32,11 @@ static void get_defaults(AVStereo3D *stereo)
}
AVStereo3D *av_stereo3d_alloc(void)
+{
+ return av_stereo3d_alloc_size(NULL);
+}
+
+AVStereo3D *av_stereo3d_alloc_size(size_t *size)
{
AVStereo3D *stereo = av_mallocz(sizeof(AVStereo3D));
if (!stereo)
@@ -39,6 +44,9 @@ AVStereo3D *av_stereo3d_alloc(void)
get_defaults(stereo);
+ if (size)
+ *size = sizeof(*stereo);
+
return stereo;
}
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index e3af519e03..31167c14fa 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -251,6 +251,14 @@ typedef struct AVStereo3D {
*/
AVStereo3D *av_stereo3d_alloc(void);
+/**
+ * Allocate an AVStereo3D structure and set its fields to default values.
+ * The resulting struct can be freed using av_freep().
+ *
+ * @return An AVStereo3D filled with default values or NULL on failure.
+ */
+AVStereo3D *av_stereo3d_alloc_size(size_t *size);
+
/**
* Allocate a complete AVFrameSideData and add it to the frame.
*
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 7/8 v2] avformat/mov: don't use sizeof(AVStereo3D)
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
` (4 preceding siblings ...)
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 6/8 v2] avutil/stereo3d: add a new allocator function that returns a size James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 8/8 v2] avformat/matroskadec: " James Almer
2024-06-22 19:57 ` [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
It's not part of the libavutil ABI.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/isom.h | 1 +
libavformat/mov.c | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 35b767a52c..a0498f45e5 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -247,6 +247,7 @@ typedef struct MOVStreamContext {
int32_t *display_matrix;
AVStereo3D *stereo3d;
+ size_t stereo3d_size;
AVSphericalMapping *spherical;
size_t spherical_size;
AVMasteringDisplayMetadata *mastering;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9b2ce1f167..07c0ec3ec4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6332,7 +6332,7 @@ static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
- sc->stereo3d = av_stereo3d_alloc();
+ sc->stereo3d = av_stereo3d_alloc_size(&sc->stereo3d_size);
if (!sc->stereo3d)
return AVERROR(ENOMEM);
@@ -6695,7 +6695,7 @@ static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
if (!sc->stereo3d) {
- sc->stereo3d = av_stereo3d_alloc();
+ sc->stereo3d = av_stereo3d_alloc_size(&sc->stereo3d_size);
if (!sc->stereo3d)
return AVERROR(ENOMEM);
}
@@ -6782,7 +6782,7 @@ static int mov_read_hfov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!sc->stereo3d) {
- sc->stereo3d = av_stereo3d_alloc();
+ sc->stereo3d = av_stereo3d_alloc_size(&sc->stereo3d_size);
if (!sc->stereo3d)
return AVERROR(ENOMEM);
}
@@ -6831,7 +6831,7 @@ static int mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_
else
mode = AV_STEREO3D_2D;
- sc->stereo3d = av_stereo3d_alloc();
+ sc->stereo3d = av_stereo3d_alloc_size(&sc->stereo3d_size);
if (!sc->stereo3d)
goto out;
@@ -10032,7 +10032,7 @@ static int mov_read_header(AVFormatContext *s)
if (sc->stereo3d) {
if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data,
AV_PKT_DATA_STEREO3D,
- (uint8_t *)sc->stereo3d, sizeof(*sc->stereo3d), 0))
+ (uint8_t *)sc->stereo3d, sc->stereo3d_size, 0))
return AVERROR(ENOMEM);
sc->stereo3d = NULL;
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* [FFmpeg-devel] [PATCH 8/8 v2] avformat/matroskadec: don't use sizeof(AVStereo3D)
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
` (5 preceding siblings ...)
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 7/8 v2] avformat/mov: don't use sizeof(AVStereo3D) James Almer
@ 2024-06-22 15:31 ` James Almer
2024-06-22 19:57 ` [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
7 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-06-22 15:31 UTC (permalink / raw)
To: ffmpeg-devel
It's not part of the libavutil ABI.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/matroskadec.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6bc5fa621e..d1a135ed63 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2253,8 +2253,9 @@ static int mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mo
STEREOMODE_STEREO3D_MAPPING(STEREO_MODE_CONV, NOTHING)
};
AVStereo3D *stereo;
+ size_t size;
- stereo = av_stereo3d_alloc();
+ stereo = av_stereo3d_alloc_size(&size);
if (!stereo)
return AVERROR(ENOMEM);
@@ -2262,7 +2263,7 @@ static int mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mo
stereo->flags = stereo_mode_conv[stereo_mode].flags;
if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data,
- AV_PKT_DATA_STEREO3D, stereo, sizeof(*stereo), 0)) {
+ AV_PKT_DATA_STEREO3D, stereo, size, 0)) {
av_freep(&stereo);
return AVERROR(ENOMEM);
}
--
2.45.2
_______________________________________________
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] 11+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value
2024-06-22 15:31 [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
` (6 preceding siblings ...)
2024-06-22 15:31 ` [FFmpeg-devel] [PATCH 8/8 v2] avformat/matroskadec: " James Almer
@ 2024-06-22 19:57 ` James Almer
2024-06-22 22:42 ` Vittorio Giovara
7 siblings, 1 reply; 11+ messages in thread
From: James Almer @ 2024-06-22 19:57 UTC (permalink / raw)
To: ffmpeg-devel
On 6/22/2024 12:31 PM, James Almer wrote:
> We need a way to signal the frame has a single view that doesn't map to any
> particular eye, and it should be the default one.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Now updating all the fate test...
>
> The 3D ones will be updated again in the following commits once ffprobe is
> adapted to properly handle the view field.
Ok, turns out AVStereo3DView is not by Derek from a few days ago but by
Vittorio from 7 years ago, so of course this change is not ok.
The new value would need to be added last and moved to the beginning
after a major bump.
>
> libavutil/stereo3d.c | 3 ++-
> libavutil/stereo3d.h | 9 +++++++--
> tests/ref/fate/matroska-spherical-mono | 2 +-
> tests/ref/fate/matroska-spherical-mono-remux | 4 ++--
> tests/ref/fate/matroska-stereo_mode | 8 ++++----
> tests/ref/fate/matroska-vp8-alpha-remux | 2 +-
> tests/ref/fate/mov-spherical-mono | 2 +-
> 7 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
> index 19e81e4124..0c0cad127c 100644
> --- a/libavutil/stereo3d.c
> +++ b/libavutil/stereo3d.c
> @@ -68,9 +68,10 @@ static const char * const stereo3d_type_names[] = {
> };
>
> static const char * const stereo3d_view_names[] = {
> - [AV_STEREO3D_VIEW_PACKED] = "packed",
> + [AV_STEREO3D_VIEW_MONO] = "monoscopic",
> [AV_STEREO3D_VIEW_LEFT] = "left",
> [AV_STEREO3D_VIEW_RIGHT] = "right",
> + [AV_STEREO3D_VIEW_PACKED] = "packed",
> };
>
> static const char * const stereo3d_primary_eye_names[] = {
> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
> index 00a5c3900e..77340f72b2 100644
> --- a/libavutil/stereo3d.h
> +++ b/libavutil/stereo3d.h
> @@ -143,9 +143,9 @@ enum AVStereo3DType {
> */
> enum AVStereo3DView {
> /**
> - * Frame contains two packed views.
> + * Frame is monoscopic.
> */
> - AV_STEREO3D_VIEW_PACKED,
> + AV_STEREO3D_VIEW_MONO,
>
> /**
> * Frame contains only the left view.
> @@ -156,6 +156,11 @@ enum AVStereo3DView {
> * Frame contains only the right view.
> */
> AV_STEREO3D_VIEW_RIGHT,
> +
> + /**
> + * Frame contains two packed views.
> + */
> + AV_STEREO3D_VIEW_PACKED,
> };
>
> /**
> diff --git a/tests/ref/fate/matroska-spherical-mono b/tests/ref/fate/matroska-spherical-mono
> index b108596350..aa17e9c624 100644
> --- a/tests/ref/fate/matroska-spherical-mono
> +++ b/tests/ref/fate/matroska-spherical-mono
> @@ -3,7 +3,7 @@
> side_data_type=Stereo 3D
> type=2D
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> diff --git a/tests/ref/fate/matroska-spherical-mono-remux b/tests/ref/fate/matroska-spherical-mono-remux
> index eec41b77f3..75a9b73a37 100644
> --- a/tests/ref/fate/matroska-spherical-mono-remux
> +++ b/tests/ref/fate/matroska-spherical-mono-remux
> @@ -27,7 +27,7 @@ DISPOSITION:forced=1
> side_data_type=Stereo 3D
> type=2D
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> @@ -56,7 +56,7 @@ DISPOSITION:forced=0
> side_data_type=Stereo 3D
> type=2D
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> diff --git a/tests/ref/fate/matroska-stereo_mode b/tests/ref/fate/matroska-stereo_mode
> index 26c325b20e..e35425ae76 100644
> --- a/tests/ref/fate/matroska-stereo_mode
> +++ b/tests/ref/fate/matroska-stereo_mode
> @@ -132,7 +132,7 @@ TAG:DURATION=00:00:10.000000000
> side_data_type=Stereo 3D
> type=side by side
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> @@ -152,7 +152,7 @@ TAG:DURATION=00:00:10.000000000
> side_data_type=Stereo 3D
> type=top and bottom
> inverted=1
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> @@ -170,7 +170,7 @@ TAG:DURATION=00:00:10.000000000
> side_data_type=Stereo 3D
> type=interleaved lines
> inverted=1
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> @@ -189,7 +189,7 @@ TAG:DURATION=00:00:10.000000000
> side_data_type=Stereo 3D
> type=interleaved columns
> inverted=1
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> diff --git a/tests/ref/fate/matroska-vp8-alpha-remux b/tests/ref/fate/matroska-vp8-alpha-remux
> index 06bcc4b4ba..814463eeda 100644
> --- a/tests/ref/fate/matroska-vp8-alpha-remux
> +++ b/tests/ref/fate/matroska-vp8-alpha-remux
> @@ -35,7 +35,7 @@ DISPOSITION:still_image=0
> side_data_type=Stereo 3D
> type=2D
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
> diff --git a/tests/ref/fate/mov-spherical-mono b/tests/ref/fate/mov-spherical-mono
> index b108596350..aa17e9c624 100644
> --- a/tests/ref/fate/mov-spherical-mono
> +++ b/tests/ref/fate/mov-spherical-mono
> @@ -3,7 +3,7 @@
> side_data_type=Stereo 3D
> type=2D
> inverted=0
> -view=packed
> +view=monoscopic
> primary_eye=none
> baseline=0
> horizontal_disparity_adjustment=0/1
_______________________________________________
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] 11+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value
2024-06-22 19:57 ` [FFmpeg-devel] [PATCH 1/8 v3] avutil/stereo3d add a Monoscopic view enum value James Almer
@ 2024-06-22 22:42 ` Vittorio Giovara
0 siblings, 0 replies; 11+ messages in thread
From: Vittorio Giovara @ 2024-06-22 22:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jun 22, 2024 at 9:57 PM James Almer <jamrial@gmail.com> wrote:
> On 6/22/2024 12:31 PM, James Almer wrote:
> > We need a way to signal the frame has a single view that doesn't map to
> any
> > particular eye, and it should be the default one.
> >
> > Signed-off-by: James Almer <jamrial@gmail.com>
> > ---
> > Now updating all the fate test...
> >
> > The 3D ones will be updated again in the following commits once ffprobe
> is
> > adapted to properly handle the view field.
>
> Ok, turns out AVStereo3DView is not by Derek from a few days ago but by
> Vittorio from 7 years ago, so of course this change is not ok.
> The new value would need to be added last and moved to the beginning
> after a major bump.
>
I think it's a good idea fwiw, we chatted about it with Derek, but beside
the waiting for the bump, I /believe/ these enum values come straight from
the google metadata document so if they get changed we need to make sure
that these are properly read/written in the related format.
--
Vittorio
_______________________________________________
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] 11+ messages in thread