X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fimgutils.h;h=50fa8159e82a5a08e7f91d3d445501f00ad631f2;hb=d7913bf59ccbf781ce57c5d58998e8f25d10e040;hp=71510132ae73360bd097999d7d6ec8be896c062b;hpb=52d113ee06ba136e530c11e651a5ae085384d49c;p=ffmpeg diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index 71510132ae7..50fa8159e82 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -29,6 +29,7 @@ #include "avutil.h" #include "pixdesc.h" +#include "rational.h" /** * Compute the max pixel step for each plane of an image with a @@ -128,7 +129,19 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], */ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); -int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); +/** + * Check if the given sample aspect ratio of an image is valid. + * + * It is considered invalid if the denominator is 0 or if applying the ratio + * to the image size would make the smaller dimension less than 1. If the + * sar numerator is 0, it is considered unknown and will return as valid. + * + * @param w width of the image + * @param h height of the image + * @param sar sample aspect ratio of the image + * @return 0 if valid, a negative AVERROR code otherwise + */ +int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); /** * @}