They are intended as replacements for avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum().
Unified · Split
| @@ -14,6 +14,9 @@ libavutil: 2021-04-27 · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | API changes, most recent first: | 15 | API changes, most recent first: |
| 16 | 16 | ||
| 17 | 2022-09-26 - xxxxxxxxxx - lavu 57.37.100 - pixdesc.h | ||
| 18 | Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum(). | ||
| 19 | |||
| 17 | 2022-09-26 - xxxxxxxxxx - lavc 59.47.100 - avcodec.h defs.h | 20 | 2022-09-26 - xxxxxxxxxx - lavc 59.47.100 - avcodec.h defs.h |
| 18 | Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h. | 21 | Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h. |
| 19 | 22 | ||
| @@ -3315,3 +3315,26 @@ int av_chroma_location_from_name(const char *name) · 3314 unmodified lines | |||
| 3315 | 3315 | ||
| 3316 | return AVERROR(EINVAL); | 3316 | return AVERROR(EINVAL); |
| 3317 | } | 3317 | } |
| 3318 | |||
| 3319 | int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos) | ||
| 3320 | { | ||
| 3321 | if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB) | ||
| 3322 | return AVERROR(EINVAL); | ||
| 3323 | pos--; | ||
| 3324 | |||
| 3325 | *xpos = (pos&1) * 128; | ||
| 3326 | *ypos = ((pos>>1)^(pos<4)) * 128; | ||
| 3327 | |||
| 3328 | return 0; | ||
| 3329 | } | ||
| 3330 | |||
| 3331 | enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos) | ||
| 3332 | { | ||
| 3333 | int pos, xout, yout; | ||
| 3334 | |||
| 3335 | for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) { | ||
| 3336 | if (av_chroma_location_enum_to_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos) | ||
| 3337 | return pos; | ||
| 3338 | } | ||
| 3339 | return AVCHROMA_LOC_UNSPECIFIED; | ||
| 3340 | } | ||
| @@ -264,6 +264,28 @@ const char *av_chroma_location_name(enum AVChromaLocation location); · 263 unmodified lines | |||
| 264 | */ | 264 | */ |
| 265 | int av_chroma_location_from_name(const char *name); | 265 | int av_chroma_location_from_name(const char *name); |
| 266 | 266 | ||
| 267 | /** | ||
| 268 | * Converts AVChromaLocation to swscale x/y chroma position. | ||
| 269 | * | ||
| 270 | * The positions represent the chroma (0,0) position in a coordinates system | ||
| 271 | * with luma (0,0) representing the origin and luma(1,1) representing 256,256 | ||
| 272 | * | ||
| 273 | * @param xpos horizontal chroma sample position | ||
| 274 | * @param ypos vertical chroma sample position | ||
| 275 | */ | ||
| 276 | int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos); | ||
| 277 | |||
| 278 | /** | ||
| 279 | * Converts swscale x/y chroma position to AVChromaLocation. | ||
| 280 | * | ||
| 281 | * The positions represent the chroma (0,0) position in a coordinates system | ||
| 282 | * with luma (0,0) representing the origin and luma(1,1) representing 256,256 | ||
| 283 | * | ||
| 284 | * @param xpos horizontal chroma sample position | ||
| 285 | * @param ypos vertical chroma sample position | ||
| 286 | */ | ||
| 287 | enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos); | ||
| 288 | |||
| 267 | /** | 289 | /** |
| 268 | * Return the pixel format corresponding to name. | 290 | * Return the pixel format corresponding to name. |
| 269 | * | 291 | * |
| @@ -79,8 +79,8 @@ · 78 unmodified lines | |||
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | #define LIBAVUTIL_VERSION_MAJOR 57 | 81 | #define LIBAVUTIL_VERSION_MAJOR 57 |
| 82 | #define LIBAVUTIL_VERSION_MINOR 36 | 82 | #define LIBAVUTIL_VERSION_MINOR 37 |
| 83 | #define LIBAVUTIL_VERSION_MICRO 102 | 83 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 84 | 84 | ||
| 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 86 | LIBAVUTIL_VERSION_MINOR, \ | 86 | LIBAVUTIL_VERSION_MINOR, \ |