mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-18 21:30:55 +00:00
avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum)
They are intended as replacements for avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
cf856d8957
commit
8be6552aa4
@ -14,6 +14,9 @@ libavutil: 2021-04-27
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2022-09-26 - xxxxxxxxxx - lavu 57.37.100 - pixdesc.h
|
||||||
|
Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
|
||||||
|
|
||||||
2022-09-26 - xxxxxxxxxx - lavc 59.47.100 - avcodec.h defs.h
|
2022-09-26 - xxxxxxxxxx - lavc 59.47.100 - avcodec.h defs.h
|
||||||
Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h.
|
Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h.
|
||||||
|
|
||||||
|
@ -3315,3 +3315,26 @@ int av_chroma_location_from_name(const char *name)
|
|||||||
|
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
|
||||||
|
{
|
||||||
|
if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
pos--;
|
||||||
|
|
||||||
|
*xpos = (pos&1) * 128;
|
||||||
|
*ypos = ((pos>>1)^(pos<4)) * 128;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
|
||||||
|
{
|
||||||
|
int pos, xout, yout;
|
||||||
|
|
||||||
|
for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
|
||||||
|
if (av_chroma_location_enum_to_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
return AVCHROMA_LOC_UNSPECIFIED;
|
||||||
|
}
|
||||||
|
@ -264,6 +264,28 @@ const char *av_chroma_location_name(enum AVChromaLocation location);
|
|||||||
*/
|
*/
|
||||||
int av_chroma_location_from_name(const char *name);
|
int av_chroma_location_from_name(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts AVChromaLocation to swscale x/y chroma position.
|
||||||
|
*
|
||||||
|
* The positions represent the chroma (0,0) position in a coordinates system
|
||||||
|
* with luma (0,0) representing the origin and luma(1,1) representing 256,256
|
||||||
|
*
|
||||||
|
* @param xpos horizontal chroma sample position
|
||||||
|
* @param ypos vertical chroma sample position
|
||||||
|
*/
|
||||||
|
int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts swscale x/y chroma position to AVChromaLocation.
|
||||||
|
*
|
||||||
|
* The positions represent the chroma (0,0) position in a coordinates system
|
||||||
|
* with luma (0,0) representing the origin and luma(1,1) representing 256,256
|
||||||
|
*
|
||||||
|
* @param xpos horizontal chroma sample position
|
||||||
|
* @param ypos vertical chroma sample position
|
||||||
|
*/
|
||||||
|
enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the pixel format corresponding to name.
|
* Return the pixel format corresponding to name.
|
||||||
*
|
*
|
||||||
|
@ -79,8 +79,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 57
|
#define LIBAVUTIL_VERSION_MAJOR 57
|
||||||
#define LIBAVUTIL_VERSION_MINOR 36
|
#define LIBAVUTIL_VERSION_MINOR 37
|
||||||
#define LIBAVUTIL_VERSION_MICRO 102
|
#define LIBAVUTIL_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
LIBAVUTIL_VERSION_MINOR, \
|
LIBAVUTIL_VERSION_MINOR, \
|
||||||
|
Loading…
Reference in New Issue
Block a user