Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, 15 Feb 2017 17:37:32 +0100 Diego Biurrun wrote: > On Wed, Feb 15, 2017 at 11:32:47AM -0500, Vittorio Giovara wrote: > > On Wed, Feb 15, 2017 at 11:29 AM, wm4 wrote: > > > On Wed, 15 Feb 2017 11:16:40 -0500 > > > Vittorio Giovara wrote: > > > > > >> On Wed, Feb 15, 2017 at 11:12 AM, wm4 wrote: > > >> > On Fri, 10 Feb 2017 16:08:10 -0500 > > >> > Vittorio Giovara wrote: > > >> >> @@ -3369,6 +3393,26 @@ static int > > >> >> mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_ > > >> >> val = av_stristr(buffer, > > >> >> ""); > > >> >> if (val) > > >> >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); > > >> >> + > > >> >> +/* tiling */ > > >> >> +val = av_stristr(buffer, > > >> >> ""); > > >> >> +if (val) > > >> >> +sc->spherical->left_bound = strtol(val, NULL, 10); > > >> >> +val = av_stristr(buffer, > > >> >> ""); > > >> >> +if (val) > > >> >> +sc->spherical->top_bound = strtol(val, NULL, 10); > > >> >> +val = av_stristr(buffer, > > >> >> ""); > > >> >> +if (val) > > >> >> +sc->spherical->right_bound = > > >> >> +sc->width - sc->spherical->left_bound - strtol(val, > > >> >> NULL, 10); > > >> >> +val = av_stristr(buffer, > > >> >> ""); > > >> >> +if (val) > > >> >> +sc->spherical->bottom_bound = > > >> >> +sc->height - sc->spherical->top_bound - strtol(val, > > >> >> NULL, 10); > > >> > > > >> > Does this try to parse XML? > > >> > > >> ¯\_(ツ)_/¯ > > >> > > >> > Who is responsible for this crime (storing it as XML in mp4)? > > >> > > >> https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md > > >> > > > > > > If it calls itself RFC it's not too late yet? > > > > There is a v2 which supersedes this one, this code is minimal support > > for random files that might be still around. Extremely glad to hear that. > > Just let those crazy samples die. I'm inclined to agree. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, Feb 15, 2017 at 11:32:47AM -0500, Vittorio Giovara wrote: > On Wed, Feb 15, 2017 at 11:29 AM, wm4 wrote: > > On Wed, 15 Feb 2017 11:16:40 -0500 > > Vittorio Giovara wrote: > > > >> On Wed, Feb 15, 2017 at 11:12 AM, wm4 wrote: > >> > On Fri, 10 Feb 2017 16:08:10 -0500 > >> > Vittorio Giovara wrote: > >> >> @@ -3369,6 +3393,26 @@ static int > >> >> mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_ > >> >> val = av_stristr(buffer, > >> >> ""); > >> >> if (val) > >> >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); > >> >> + > >> >> +/* tiling */ > >> >> +val = av_stristr(buffer, ""); > >> >> +if (val) > >> >> +sc->spherical->left_bound = strtol(val, NULL, 10); > >> >> +val = av_stristr(buffer, ""); > >> >> +if (val) > >> >> +sc->spherical->top_bound = strtol(val, NULL, 10); > >> >> +val = av_stristr(buffer, > >> >> ""); > >> >> +if (val) > >> >> +sc->spherical->right_bound = > >> >> +sc->width - sc->spherical->left_bound - strtol(val, > >> >> NULL, 10); > >> >> +val = av_stristr(buffer, > >> >> ""); > >> >> +if (val) > >> >> +sc->spherical->bottom_bound = > >> >> +sc->height - sc->spherical->top_bound - strtol(val, > >> >> NULL, 10); > >> > > >> > Does this try to parse XML? > >> > >> ¯\_(ツ)_/¯ > >> > >> > Who is responsible for this crime (storing it as XML in mp4)? > >> > >> https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md > > > > If it calls itself RFC it's not too late yet? > > There is a v2 which supersedes this one, this code is minimal support > for random files that might be still around. Just let those crazy samples die. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, Feb 15, 2017 at 11:29 AM, wm4 wrote: > On Wed, 15 Feb 2017 11:16:40 -0500 > Vittorio Giovara wrote: > >> On Wed, Feb 15, 2017 at 11:12 AM, wm4 wrote: >> > On Fri, 10 Feb 2017 16:08:10 -0500 >> > Vittorio Giovara wrote: >> >> @@ -3369,6 +3393,26 @@ static int >> >> mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_ >> >> val = av_stristr(buffer, ""); >> >> if (val) >> >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); >> >> + >> >> +/* tiling */ >> >> +val = av_stristr(buffer, ""); >> >> +if (val) >> >> +sc->spherical->left_bound = strtol(val, NULL, 10); >> >> +val = av_stristr(buffer, ""); >> >> +if (val) >> >> +sc->spherical->top_bound = strtol(val, NULL, 10); >> >> +val = av_stristr(buffer, >> >> ""); >> >> +if (val) >> >> +sc->spherical->right_bound = >> >> +sc->width - sc->spherical->left_bound - strtol(val, >> >> NULL, 10); >> >> +val = av_stristr(buffer, >> >> ""); >> >> +if (val) >> >> +sc->spherical->bottom_bound = >> >> +sc->height - sc->spherical->top_bound - strtol(val, >> >> NULL, 10); >> > >> > Does this try to parse XML? >> >> ¯\_(ツ)_/¯ >> >> > Who is responsible for this crime (storing it as XML in mp4)? >> >> https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md > > If it calls itself RFC it's not too late yet? There is a v2 which supersedes this one, this code is minimal support for random files that might be still around. -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, 15 Feb 2017 11:16:40 -0500 Vittorio Giovara wrote: > On Wed, Feb 15, 2017 at 11:12 AM, wm4 wrote: > > On Fri, 10 Feb 2017 16:08:10 -0500 > > Vittorio Giovara wrote: > >> @@ -3369,6 +3393,26 @@ static int > >> mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_ > >> val = av_stristr(buffer, ""); > >> if (val) > >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); > >> + > >> +/* tiling */ > >> +val = av_stristr(buffer, ""); > >> +if (val) > >> +sc->spherical->left_bound = strtol(val, NULL, 10); > >> +val = av_stristr(buffer, ""); > >> +if (val) > >> +sc->spherical->top_bound = strtol(val, NULL, 10); > >> +val = av_stristr(buffer, > >> ""); > >> +if (val) > >> +sc->spherical->right_bound = > >> +sc->width - sc->spherical->left_bound - strtol(val, NULL, > >> 10); > >> +val = av_stristr(buffer, > >> ""); > >> +if (val) > >> +sc->spherical->bottom_bound = > >> +sc->height - sc->spherical->top_bound - strtol(val, NULL, > >> 10); > > > > Does this try to parse XML? > > ¯\_(ツ)_/¯ > > > Who is responsible for this crime (storing it as XML in mp4)? > > https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md If it calls itself RFC it's not too late yet? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, Feb 15, 2017 at 11:12 AM, wm4 wrote: > On Fri, 10 Feb 2017 16:08:10 -0500 > Vittorio Giovara wrote: >> @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext >> *sc, AVIOContext *pb, size_ >> val = av_stristr(buffer, ""); >> if (val) >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); >> + >> +/* tiling */ >> +val = av_stristr(buffer, ""); >> +if (val) >> +sc->spherical->left_bound = strtol(val, NULL, 10); >> +val = av_stristr(buffer, ""); >> +if (val) >> +sc->spherical->top_bound = strtol(val, NULL, 10); >> +val = av_stristr(buffer, >> ""); >> +if (val) >> +sc->spherical->right_bound = >> +sc->width - sc->spherical->left_bound - strtol(val, NULL, >> 10); >> +val = av_stristr(buffer, >> ""); >> +if (val) >> +sc->spherical->bottom_bound = >> +sc->height - sc->spherical->top_bound - strtol(val, NULL, >> 10); > > Does this try to parse XML? ¯\_(ツ)_/¯ > Who is responsible for this crime (storing it as XML in mp4)? https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Fri, 10 Feb 2017 16:08:10 -0500 Vittorio Giovara wrote: > Update the fate test as needed. > --- > libavformat/mov.c| 46 > +++- > tests/fate/mov.mak | 2 +- > tests/ref/fate/mov-spherical | 6 +- > 3 files changed, 51 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 4a6f9c0..bc35677 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > MOVStreamContext *sc; > int size; > int32_t yaw, pitch, roll; > +size_t l, t, r, b; > +size_t padding = 0; > uint32_t tag; > enum AVSphericalProjection projection; > > @@ -3292,9 +3294,17 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > switch (tag) { > case MKTAG('c','b','m','p'): > projection = AV_SPHERICAL_CUBEMAP; > +padding = avio_rb32(pb); > break; > case MKTAG('e','q','u','i'): > -projection = AV_SPHERICAL_EQUIRECTANGULAR; > +t = avio_rb32(pb); > +b = avio_rb32(pb); > +l = avio_rb32(pb); > +r = avio_rb32(pb); > +if (l || t || r || b) > +projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; > +else > +projection = AV_SPHERICAL_EQUIRECTANGULAR; > break; > default: > av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); > @@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > sc->spherical->pitch = pitch; > sc->spherical->roll = roll; > > +sc->spherical->padding = padding; > + > +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { > +/* conversion from 0.32 coordinates to pixels */ > +uint32_t max_coord = (uint32_t) -1; > +size_t orig_width = (size_t) sc->width * max_coord / (max_coord - > r - l); > +size_t orig_height = (size_t) sc->height * max_coord / (max_coord - > b - t); > + > +/* add a (max_coord - 1) to round up integer division */ > +sc->spherical->left_bound = (orig_width * l + max_coord - 1) / > max_coord; > +sc->spherical->top_bound= (orig_height * t + max_coord - 1) / > max_coord; > +sc->spherical->right_bound = orig_width - sc->width - > sc->spherical->left_bound; > +sc->spherical->bottom_bound = orig_height - sc->height - > sc->spherical->top_bound; > +} > return 0; > } > > @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext > *sc, AVIOContext *pb, size_ > val = av_stristr(buffer, ""); > if (val) > sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); > + > +/* tiling */ > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->left_bound = strtol(val, NULL, 10); > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->top_bound = strtol(val, NULL, 10); > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->right_bound = > +sc->width - sc->spherical->left_bound - strtol(val, NULL, > 10); > +val = av_stristr(buffer, > ""); > +if (val) > +sc->spherical->bottom_bound = > +sc->height - sc->spherical->top_bound - strtol(val, NULL, > 10); Does this try to parse XML? Who is responsible for this crime (storing it as XML in mp4)? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
On Wed, Feb 15, 2017 at 2:46 AM, Anton Khirnov wrote: > Quoting Vittorio Giovara (2017-02-10 22:08:10) >> Update the fate test as needed. >> --- >> libavformat/mov.c| 46 >> +++- >> tests/fate/mov.mak | 2 +- >> tests/ref/fate/mov-spherical | 6 +- >> 3 files changed, 51 insertions(+), 3 deletions(-) >> >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index 4a6f9c0..bc35677 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext >> *pb, MOVAtom atom) >> MOVStreamContext *sc; >> int size; >> int32_t yaw, pitch, roll; >> +size_t l, t, r, b; >> +size_t padding = 0; >> uint32_t tag; >> enum AVSphericalProjection projection; >> >> @@ -3292,9 +3294,17 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext >> *pb, MOVAtom atom) >> switch (tag) { >> case MKTAG('c','b','m','p'): >> projection = AV_SPHERICAL_CUBEMAP; >> +padding = avio_rb32(pb); >> break; >> case MKTAG('e','q','u','i'): >> -projection = AV_SPHERICAL_EQUIRECTANGULAR; >> +t = avio_rb32(pb); >> +b = avio_rb32(pb); >> +l = avio_rb32(pb); >> +r = avio_rb32(pb); >> +if (l || t || r || b) >> +projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; >> +else >> +projection = AV_SPHERICAL_EQUIRECTANGULAR; >> break; >> default: >> av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); >> @@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext >> *pb, MOVAtom atom) >> sc->spherical->pitch = pitch; >> sc->spherical->roll = roll; >> >> +sc->spherical->padding = padding; >> + >> +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { >> +/* conversion from 0.32 coordinates to pixels */ >> +uint32_t max_coord = (uint32_t) -1; >> +size_t orig_width = (size_t) sc->width * max_coord / (max_coord - >> r - l); >> +size_t orig_height = (size_t) sc->height * max_coord / (max_coord - >> b - t); >> + >> +/* add a (max_coord - 1) to round up integer division */ >> +sc->spherical->left_bound = (orig_width * l + max_coord - 1) / >> max_coord; >> +sc->spherical->top_bound= (orig_height * t + max_coord - 1) / >> max_coord; >> +sc->spherical->right_bound = orig_width - sc->width - >> sc->spherical->left_bound; >> +sc->spherical->bottom_bound = orig_height - sc->height - >> sc->spherical->top_bound; >> +} >> return 0; >> } >> >> @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext >> *sc, AVIOContext *pb, size_ >> val = av_stristr(buffer, ""); >> if (val) >> sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); >> + >> +/* tiling */ >> +val = av_stristr(buffer, ""); >> +if (val) >> +sc->spherical->left_bound = strtol(val, NULL, 10); >> +val = av_stristr(buffer, ""); >> +if (val) >> +sc->spherical->top_bound = strtol(val, NULL, 10); >> +val = av_stristr(buffer, >> ""); >> +if (val) >> +sc->spherical->right_bound = >> +sc->width - sc->spherical->left_bound - strtol(val, NULL, >> 10); >> +val = av_stristr(buffer, >> ""); >> +if (val) >> +sc->spherical->bottom_bound = >> +sc->height - sc->spherical->top_bound - strtol(val, NULL, >> 10); > > Shouldn't these check that the result is sane? yolo? Spec v1 has no limits, while v2 has checks on the bottom and right bounds only, like projection_bounds_bottom must be less than 0x - projection_bounds_top Given that they are expressed in size_t and that users can use it only for additions I'm unsure how to properly validate these fields. -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
Quoting Vittorio Giovara (2017-02-10 22:08:10) > Update the fate test as needed. > --- > libavformat/mov.c| 46 > +++- > tests/fate/mov.mak | 2 +- > tests/ref/fate/mov-spherical | 6 +- > 3 files changed, 51 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 4a6f9c0..bc35677 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > MOVStreamContext *sc; > int size; > int32_t yaw, pitch, roll; > +size_t l, t, r, b; > +size_t padding = 0; > uint32_t tag; > enum AVSphericalProjection projection; > > @@ -3292,9 +3294,17 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > switch (tag) { > case MKTAG('c','b','m','p'): > projection = AV_SPHERICAL_CUBEMAP; > +padding = avio_rb32(pb); > break; > case MKTAG('e','q','u','i'): > -projection = AV_SPHERICAL_EQUIRECTANGULAR; > +t = avio_rb32(pb); > +b = avio_rb32(pb); > +l = avio_rb32(pb); > +r = avio_rb32(pb); > +if (l || t || r || b) > +projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; > +else > +projection = AV_SPHERICAL_EQUIRECTANGULAR; > break; > default: > av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); > @@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > sc->spherical->pitch = pitch; > sc->spherical->roll = roll; > > +sc->spherical->padding = padding; > + > +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { > +/* conversion from 0.32 coordinates to pixels */ > +uint32_t max_coord = (uint32_t) -1; > +size_t orig_width = (size_t) sc->width * max_coord / (max_coord - > r - l); > +size_t orig_height = (size_t) sc->height * max_coord / (max_coord - > b - t); > + > +/* add a (max_coord - 1) to round up integer division */ > +sc->spherical->left_bound = (orig_width * l + max_coord - 1) / > max_coord; > +sc->spherical->top_bound= (orig_height * t + max_coord - 1) / > max_coord; > +sc->spherical->right_bound = orig_width - sc->width - > sc->spherical->left_bound; > +sc->spherical->bottom_bound = orig_height - sc->height - > sc->spherical->top_bound; > +} > return 0; > } > > @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext > *sc, AVIOContext *pb, size_ > val = av_stristr(buffer, ""); > if (val) > sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); > + > +/* tiling */ > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->left_bound = strtol(val, NULL, 10); > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->top_bound = strtol(val, NULL, 10); > +val = av_stristr(buffer, ""); > +if (val) > +sc->spherical->right_bound = > +sc->width - sc->spherical->left_bound - strtol(val, NULL, > 10); > +val = av_stristr(buffer, > ""); > +if (val) > +sc->spherical->bottom_bound = > +sc->height - sc->spherical->top_bound - strtol(val, NULL, > 10); Shouldn't these check that the result is sane? -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata
Update the fate test as needed. --- libavformat/mov.c| 46 +++- tests/fate/mov.mak | 2 +- tests/ref/fate/mov-spherical | 6 +- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4a6f9c0..bc35677 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVStreamContext *sc; int size; int32_t yaw, pitch, roll; +size_t l, t, r, b; +size_t padding = 0; uint32_t tag; enum AVSphericalProjection projection; @@ -3292,9 +3294,17 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) switch (tag) { case MKTAG('c','b','m','p'): projection = AV_SPHERICAL_CUBEMAP; +padding = avio_rb32(pb); break; case MKTAG('e','q','u','i'): -projection = AV_SPHERICAL_EQUIRECTANGULAR; +t = avio_rb32(pb); +b = avio_rb32(pb); +l = avio_rb32(pb); +r = avio_rb32(pb); +if (l || t || r || b) +projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; +else +projection = AV_SPHERICAL_EQUIRECTANGULAR; break; default: av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); @@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->spherical->pitch = pitch; sc->spherical->roll = roll; +sc->spherical->padding = padding; + +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { +/* conversion from 0.32 coordinates to pixels */ +uint32_t max_coord = (uint32_t) -1; +size_t orig_width = (size_t) sc->width * max_coord / (max_coord - r - l); +size_t orig_height = (size_t) sc->height * max_coord / (max_coord - b - t); + +/* add a (max_coord - 1) to round up integer division */ +sc->spherical->left_bound = (orig_width * l + max_coord - 1) / max_coord; +sc->spherical->top_bound= (orig_height * t + max_coord - 1) / max_coord; +sc->spherical->right_bound = orig_width - sc->width - sc->spherical->left_bound; +sc->spherical->bottom_bound = orig_height - sc->height - sc->spherical->top_bound; +} return 0; } @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_ val = av_stristr(buffer, ""); if (val) sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16); + +/* tiling */ +val = av_stristr(buffer, ""); +if (val) +sc->spherical->left_bound = strtol(val, NULL, 10); +val = av_stristr(buffer, ""); +if (val) +sc->spherical->top_bound = strtol(val, NULL, 10); +val = av_stristr(buffer, ""); +if (val) +sc->spherical->right_bound = +sc->width - sc->spherical->left_bound - strtol(val, NULL, 10); +val = av_stristr(buffer, ""); +if (val) +sc->spherical->bottom_bound = +sc->height - sc->spherical->top_bound - strtol(val, NULL, 10); + +if (sc->spherical->left_bound || sc->spherical->top_bound || +sc->spherical->right_bound || sc->spherical->bottom_bound) +sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; } out: diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 57cbb1c..9d64fd3 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar fate-mov-sar: CMD = probestream sample_aspect_ratio $(TARGET_SAMPLES)/mov/displaymatrix.mov FATE_MOV += fate-mov-spherical -fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll $(TARGET_SAMPLES)/mov/spherical.mov +fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll,left,top,right,bottom $(TARGET_SAMPLES)/mov/spherical.mov FATE_MOV += fate-mov-stereo3d fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical index 760ae88..a3f8cdf 100644 --- a/tests/ref/fate/mov-spherical +++ b/tests/ref/fate/mov-spherical @@ -1,4 +1,8 @@ -equirectangular +tiled equirectangular +148 +73 +147 +72 45 30 15 -- 2.10.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel