History

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().

Andreas Rheinhardt committed 4 years ago

Commit 8be65521 parent cf856d84 files · +50 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/pixdesc.c +23 −0
  3. libavutil/pixdesc.h +22 −0
  4. libavutil/version.h +2 −2
doc/APIchanges+3−0
@@ -14,6 +14,9 @@ libavutil: 2021-04-27 · 13 unmodified lines
14 14
15API changes, most recent first:15API changes, most recent first:
16 16
172022-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
172022-09-26 - xxxxxxxxxx - lavc 59.47.100 - avcodec.h defs.h202022-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
libavutil/pixdesc.c+23−0
@@ -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
3319int 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
3331enum 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}
libavutil/pixdesc.h+22−0
@@ -264,6 +264,28 @@ const char *av_chroma_location_name(enum AVChromaLocation location); · 263 unmodified lines
264 */264 */
265int av_chroma_location_from_name(const char *name);265int 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 */
276int 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 */
287enum 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 *
libavutil/version.h+2−2
@@ -79,8 +79,8 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5781#define LIBAVUTIL_VERSION_MAJOR 57
82#define LIBAVUTIL_VERSION_MINOR 3682#define LIBAVUTIL_VERSION_MINOR 37
83#define LIBAVUTIL_VERSION_MICRO 10283#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, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t