Re: [libav-devel] [PATCH 09/11] cbs: Add some read/write tests
On 20/09/17 19:48, Diego Biurrun wrote: > On Sun, Sep 10, 2017 at 12:09:13AM +0100, Mark Thompson wrote: >> --- /dev/null >> +++ b/tests/fate/cbs.mak >> @@ -0,0 +1,74 @@ >> + >> +define FATE_CBS_TEST >> +# (codec, test_name, sample_file, output_format) >> +FATE_CBS_$(1) += fate-cbs-$(1)-$(2) >> +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -bsf:v >> $(1)_metadata -f $(4) >> +endef >> + >> +$(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call >> FATE_CBS_TEST,h264,$(basename $(N)),h264-conformance/$(N),h264))) >> + >> +$(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call >> FATE_CBS_TEST,hevc,$(basename $(N)),hevc-conformance/$(N),hevc))) > > The 1st and 4th arguments are identical. If you wanted, you could get rid > of the prefix of the third argument by integrating it into CMD. Further down the file there is also: >> +$(foreach N,$(FATE_CBS_MPEG2_SAMPLES),$(eval $(call >> FATE_CBS_TEST,mpeg2,$(basename $(N)),mpeg2/$(N),mpeg2video))) which doesn't admit either of those changes. Thanks, - Mark ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/11] cbs: Add some read/write tests
On Sun, Sep 10, 2017 at 12:09:13AM +0100, Mark Thompson wrote: > --- /dev/null > +++ b/tests/fate/cbs.mak > @@ -0,0 +1,74 @@ > + > +define FATE_CBS_TEST > +# (codec, test_name, sample_file, output_format) > +FATE_CBS_$(1) += fate-cbs-$(1)-$(2) > +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -bsf:v > $(1)_metadata -f $(4) > +endef > + > +$(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call > FATE_CBS_TEST,h264,$(basename $(N)),h264-conformance/$(N),h264))) > + > +$(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call > FATE_CBS_TEST,hevc,$(basename $(N)),hevc-conformance/$(N),hevc))) The 1st and 4th arguments are identical. If you wanted, you could get rid of the prefix of the third argument by integrating it into CMD. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value
On Wed, Sep 20, 2017 at 8:10 PM, wm4wrote: > On Wed, 20 Sep 2017 13:33:13 +0200 > Vittorio Giovara wrote: > > > Signed-off-by: Vittorio Giovara > > --- > > TODO: version bump, APIdoc entry. > > Vittorio > > > > Suggestion: create a table with int/string pairs, and a shared lookup > function, so that you don't need to recreate the boilerplate over and > over? > I thought of that, but since these are tables that get updated relatively often, I didn't want to duplicate the amount of edits needed every time a new value is added. -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value
On Wed, 20 Sep 2017 13:33:13 +0200 Vittorio Giovarawrote: > Signed-off-by: Vittorio Giovara > --- > TODO: version bump, APIdoc entry. > Vittorio > Suggestion: create a table with int/string pairs, and a shared lookup function, so that you don't need to recreate the boilerplate over and over? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value
On Wed, Sep 20, 2017 at 2:06 PM, Luca Barbatowrote: > On 20/09/2017 13:33, Vittorio Giovara wrote: > >> Signed-off-by: Vittorio Giovara >> --- >> TODO: version bump, APIdoc entry. >> Vittorio >> >> libavutil/pixdesc.c | 65 ++ >> +++ >> libavutil/pixdesc.h | 25 + >> 2 files changed, 90 insertions(+) >> >> > Possibly fine, maybe mention negative instead of -1 in the documentation > in case we want to change the return value to ENOSYS later. > Ok, I'll go ahead and just have them return AVERROR(ENOSYS) and update docs. thanks -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value
On 20/09/2017 13:33, Vittorio Giovara wrote: Signed-off-by: Vittorio Giovara--- TODO: version bump, APIdoc entry. Vittorio libavutil/pixdesc.c | 65 + libavutil/pixdesc.h | 25 + 2 files changed, 90 insertions(+) Possibly fine, maybe mention negative instead of -1 in the documentation in case we want to change the return value to ENOSYS later. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value
Signed-off-by: Vittorio Giovara--- TODO: version bump, APIdoc entry. Vittorio libavutil/pixdesc.c | 65 + libavutil/pixdesc.h | 25 + 2 files changed, 90 insertions(+) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 33aa2d705f..52340a459b 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2749,26 +2749,91 @@ const char *av_color_range_name(enum AVColorRange range) color_range_names[range] : NULL; } +int av_color_range_from_name(const char *name) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) { +size_t len = strlen(color_range_names[i]); +if (!strncmp(color_range_names[i], name, len)) +return i; +} + +return -1; +} + const char *av_color_primaries_name(enum AVColorPrimaries primaries) { return (unsigned) primaries < AVCOL_PRI_NB ? color_primaries_names[primaries] : NULL; } +int av_color_primaries_from_name(const char *name) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) { +size_t len = strlen(color_primaries_names[i]); +if (!strncmp(color_primaries_names[i], name, len)) +return i; +} + +return -1; +} + const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer) { return (unsigned) transfer < AVCOL_TRC_NB ? color_transfer_names[transfer] : NULL; } +int av_color_transfer_from_name(const char *name) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) { +size_t len = strlen(color_transfer_names[i]); +if (!strncmp(color_transfer_names[i], name, len)) +return i; +} + +return -1; +} + const char *av_color_space_name(enum AVColorSpace space) { return (unsigned) space < AVCOL_SPC_NB ? color_space_names[space] : NULL; } +int av_color_space_from_name(const char *name) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) { +size_t len = strlen(color_space_names[i]); +if (!strncmp(color_space_names[i], name, len)) +return i; +} + +return -1; +} + const char *av_chroma_location_name(enum AVChromaLocation location) { return (unsigned) location < AVCHROMA_LOC_NB ? chroma_location_names[location] : NULL; } + +int av_chroma_location_from_name(const char *name) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) { +size_t len = strlen(chroma_location_names[i]); +if (!strncmp(chroma_location_names[i], name, len)) +return i; +} + +return -1; +} diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index b0ec81b81b..70e832405e 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -250,26 +250,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); */ const char *av_color_range_name(enum AVColorRange range); +/** + * @return the AVColorRange value for name or -1 if not found. + */ +int av_color_range_from_name(const char *name); + /** * @return the name for provided color primaries or NULL if unknown. */ const char *av_color_primaries_name(enum AVColorPrimaries primaries); +/** + * @return the AVColorPrimaries value for name or -1 if not found. + */ +int av_color_primaries_from_name(const char *name); + /** * @return the name for provided color transfer or NULL if unknown. */ const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); +/** + * @return the AVColorTransferCharacteristic value for name or -1 if not found. + */ +int av_color_transfer_from_name(const char *name); + /** * @return the name for provided color space or NULL if unknown. */ const char *av_color_space_name(enum AVColorSpace space); +/** + * @return the AVColorSpace value for name or -1 if not found. + */ +int av_color_space_from_name(const char *name); + /** * @return the name for provided chroma location or NULL if unknown. */ const char *av_chroma_location_name(enum AVChromaLocation location); +/** + * @return the AVChromaLocation value for name or -1 if not found. + */ +int av_chroma_location_from_name(const char *name); + /** * Return the pixel format corresponding to name. * -- 2.14.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel