Merge remote-tracking branch 'qatar/master'

* qatar/master:
  eval: add gt(), gte(), lt() and lte() fate tests
  eval: fix swapping of lt() and lte()
  imgconvert: deprecate avcodec_find_best_pix_fmt()
  imgconvert: add avcodec_find_best_pix_fmt2()
  imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt

Conflicts:
	libavcodec/imgconvert.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-07-15 01:21:05 +02:00
commit 39afcf1d7e
5 changed files with 65 additions and 2 deletions

View File

@ -4413,7 +4413,10 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
int has_alpha);
#if FF_API_FIND_BEST_PIX_FMT
/**
* @deprecated use avcodec_find_best_pix_fmt2() instead.
*
* Find the best pixel format to convert to given a certain source pixel
* format. When converting from one pixel format to another, information loss
* may occur. For example, when converting from RGB24 to GRAY, the color
@ -4437,8 +4440,31 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
* @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
* @return The best pixel format to convert to or -1 if none was found.
*/
attribute_deprecated
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
#endif /* FF_API_FIND_BEST_PIX_FMT */
/**
* Find the best pixel format to convert to given a certain source pixel
* format. When converting from one pixel format to another, information loss
* may occur. For example, when converting from RGB24 to GRAY, the color
* information will be lost. Similarly, other losses occur when converting from
* some formats to other formats. avcodec_find_best_pix_fmt2() searches which of
* the given pixel formats should be used to suffer the least amount of loss.
* The pixel formats from which it chooses one, are determined by the
* pix_fmt_list parameter.
*
*
* @param[in] pix_fmt_list PIX_FMT_NONE terminated array of pixel formats to choose from
* @param[in] src_pix_fmt source pixel format
* @param[in] has_alpha Whether the source pixel format alpha channel is used.
* @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
* @return The best pixel format to convert to or -1 if none was found.
*/
enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list,
enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
/**
* Find the best pixel format to convert to given a certain source pixel

View File

@ -515,6 +515,7 @@ static int avg_bits_per_pixel(enum PixelFormat pix_fmt)
info->padded_size : av_get_bits_per_pixel(desc);
}
#if FF_API_FIND_BEST_PIX_FMT
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr)
{
@ -531,6 +532,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
}
return dst_pix_fmt;
}
#endif /* FF_API_FIND_BEST_PIX_FMT */
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)

View File

@ -27,8 +27,8 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 39
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MINOR 40
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@ -83,5 +83,8 @@
#ifndef FF_API_DSP_MASK
#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
#ifndef FF_API_FIND_BEST_PIX_FMT
#define FF_API_FIND_BEST_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
#endif /* AVCODEC_VERSION_H */

View File

@ -746,6 +746,14 @@ int main(int argc, char **argv)
"1Gi",
"st(0, 123)",
"st(1, 123); ld(1)",
"lte(0, 1)",
"lte(1, 1)",
"lte(1, 0)",
"lt(0, 1)",
"lt(1, 1)",
"gt(1, 0)",
"gt(2, 7)",
"gte(122, 122)",
/* compute 1+2+...+N */
"st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)",
/* compute Fib(N) */

View File

@ -94,6 +94,30 @@ Evaluating 'st(0, 123)'
Evaluating 'st(1, 123); ld(1)'
'st(1, 123); ld(1)' -> 123.000000
Evaluating 'lte(0, 1)'
'lte(0, 1)' -> 1.000000
Evaluating 'lte(1, 1)'
'lte(1, 1)' -> 1.000000
Evaluating 'lte(1, 0)'
'lte(1, 0)' -> 0.000000
Evaluating 'lt(0, 1)'
'lt(0, 1)' -> 1.000000
Evaluating 'lt(1, 1)'
'lt(1, 1)' -> 0.000000
Evaluating 'gt(1, 0)'
'gt(1, 0)' -> 1.000000
Evaluating 'gt(2, 7)'
'gt(2, 7)' -> 0.000000
Evaluating 'gte(122, 122)'
'gte(122, 122)' -> 1.000000
Evaluating 'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)'
'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)' -> 5050.000000