Browse Source

lavc/libvpx: Fix high-bitdepth pix_fmts on big endian.

tags/n3.1
Carl Eugen Hoyos 9 years ago
parent
commit
84d7933e3b
4 changed files with 31 additions and 31 deletions
  1. +8
    -8
      libavcodec/libvpx.c
  2. +10
    -10
      libavcodec/libvpxdec.c
  3. +12
    -12
      libavcodec/libvpxenc.c
  4. +1
    -1
      libavcodec/version.h

+ 8
- 8
libavcodec/libvpx.c View File

@@ -46,14 +46,14 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV440P,
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_YUV420P10LE,
AV_PIX_FMT_YUV422P10LE,
AV_PIX_FMT_YUV440P10LE,
AV_PIX_FMT_YUV444P10LE,
AV_PIX_FMT_YUV420P12LE,
AV_PIX_FMT_YUV422P12LE,
AV_PIX_FMT_YUV440P12LE,
AV_PIX_FMT_YUV444P12LE,
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10,
AV_PIX_FMT_YUV440P10,
AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_YUV420P12,
AV_PIX_FMT_YUV422P12,
AV_PIX_FMT_YUV440P12,
AV_PIX_FMT_YUV444P12,
AV_PIX_FMT_NONE AV_PIX_FMT_NONE
}; };
#endif #endif


+ 10
- 10
libavcodec/libvpxdec.c View File

@@ -108,10 +108,10 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
case VPX_IMG_FMT_I42016: case VPX_IMG_FMT_I42016:
avctx->profile = FF_PROFILE_VP9_2; avctx->profile = FF_PROFILE_VP9_2;
if (img->bit_depth == 10) { if (img->bit_depth == 10) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
return 0; return 0;
} else if (img->bit_depth == 12) { } else if (img->bit_depth == 12) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P12LE;
avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
return 0; return 0;
} else { } else {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@@ -119,10 +119,10 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
case VPX_IMG_FMT_I42216: case VPX_IMG_FMT_I42216:
avctx->profile = FF_PROFILE_VP9_3; avctx->profile = FF_PROFILE_VP9_3;
if (img->bit_depth == 10) { if (img->bit_depth == 10) {
avctx->pix_fmt = AV_PIX_FMT_YUV422P10LE;
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
return 0; return 0;
} else if (img->bit_depth == 12) { } else if (img->bit_depth == 12) {
avctx->pix_fmt = AV_PIX_FMT_YUV422P12LE;
avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
return 0; return 0;
} else { } else {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@@ -131,10 +131,10 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
case VPX_IMG_FMT_I44016: case VPX_IMG_FMT_I44016:
avctx->profile = FF_PROFILE_VP9_3; avctx->profile = FF_PROFILE_VP9_3;
if (img->bit_depth == 10) { if (img->bit_depth == 10) {
avctx->pix_fmt = AV_PIX_FMT_YUV440P10LE;
avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
return 0; return 0;
} else if (img->bit_depth == 12) { } else if (img->bit_depth == 12) {
avctx->pix_fmt = AV_PIX_FMT_YUV440P12LE;
avctx->pix_fmt = AV_PIX_FMT_YUV440P12;
return 0; return 0;
} else { } else {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@@ -145,17 +145,17 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
if (img->bit_depth == 10) { if (img->bit_depth == 10) {
#if VPX_IMAGE_ABI_VERSION >= 3 #if VPX_IMAGE_ABI_VERSION >= 3
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP10LE : AV_PIX_FMT_YUV444P10LE;
AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
#else #else
avctx->pix_fmt = AV_PIX_FMT_YUV444P10LE;
avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
#endif #endif
return 0; return 0;
} else if (img->bit_depth == 12) { } else if (img->bit_depth == 12) {
#if VPX_IMAGE_ABI_VERSION >= 3 #if VPX_IMAGE_ABI_VERSION >= 3
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP12LE : AV_PIX_FMT_YUV444P12LE;
AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
#else #else
avctx->pix_fmt = AV_PIX_FMT_YUV444P12LE;
avctx->pix_fmt = AV_PIX_FMT_YUV444P12;
#endif #endif
return 0; return 0;
} else { } else {


+ 12
- 12
libavcodec/libvpxenc.c View File

@@ -300,22 +300,22 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps,
*img_fmt = VPX_IMG_FMT_I444; *img_fmt = VPX_IMG_FMT_I444;
return 0; return 0;
#ifdef VPX_IMG_FMT_HIGHBITDEPTH #ifdef VPX_IMG_FMT_HIGHBITDEPTH
case AV_PIX_FMT_YUV420P10LE:
case AV_PIX_FMT_YUV420P12LE:
case AV_PIX_FMT_YUV420P10:
case AV_PIX_FMT_YUV420P12:
if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
enccfg->g_bit_depth = enccfg->g_input_bit_depth = enccfg->g_bit_depth = enccfg->g_input_bit_depth =
avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE ? 10 : 12;
avctx->pix_fmt == AV_PIX_FMT_YUV420P10 ? 10 : 12;
enccfg->g_profile = 2; enccfg->g_profile = 2;
*img_fmt = VPX_IMG_FMT_I42016; *img_fmt = VPX_IMG_FMT_I42016;
*flags |= VPX_CODEC_USE_HIGHBITDEPTH; *flags |= VPX_CODEC_USE_HIGHBITDEPTH;
return 0; return 0;
} }
break; break;
case AV_PIX_FMT_YUV422P10LE:
case AV_PIX_FMT_YUV422P12LE:
case AV_PIX_FMT_YUV422P10:
case AV_PIX_FMT_YUV422P12:
if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
enccfg->g_bit_depth = enccfg->g_input_bit_depth = enccfg->g_bit_depth = enccfg->g_input_bit_depth =
avctx->pix_fmt == AV_PIX_FMT_YUV422P10LE ? 10 : 12;
avctx->pix_fmt == AV_PIX_FMT_YUV422P10 ? 10 : 12;
enccfg->g_profile = 3; enccfg->g_profile = 3;
*img_fmt = VPX_IMG_FMT_I42216; *img_fmt = VPX_IMG_FMT_I42216;
*flags |= VPX_CODEC_USE_HIGHBITDEPTH; *flags |= VPX_CODEC_USE_HIGHBITDEPTH;
@@ -323,11 +323,11 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps,
} }
break; break;
#if VPX_IMAGE_ABI_VERSION >= 3 #if VPX_IMAGE_ABI_VERSION >= 3
case AV_PIX_FMT_YUV440P10LE:
case AV_PIX_FMT_YUV440P12LE:
case AV_PIX_FMT_YUV440P10:
case AV_PIX_FMT_YUV440P12:
if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
enccfg->g_bit_depth = enccfg->g_input_bit_depth = enccfg->g_bit_depth = enccfg->g_input_bit_depth =
avctx->pix_fmt == AV_PIX_FMT_YUV440P10LE ? 10 : 12;
avctx->pix_fmt == AV_PIX_FMT_YUV440P10 ? 10 : 12;
enccfg->g_profile = 3; enccfg->g_profile = 3;
*img_fmt = VPX_IMG_FMT_I44016; *img_fmt = VPX_IMG_FMT_I44016;
*flags |= VPX_CODEC_USE_HIGHBITDEPTH; *flags |= VPX_CODEC_USE_HIGHBITDEPTH;
@@ -335,11 +335,11 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps,
} }
break; break;
#endif #endif
case AV_PIX_FMT_YUV444P10LE:
case AV_PIX_FMT_YUV444P12LE:
case AV_PIX_FMT_YUV444P10:
case AV_PIX_FMT_YUV444P12:
if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
enccfg->g_bit_depth = enccfg->g_input_bit_depth = enccfg->g_bit_depth = enccfg->g_input_bit_depth =
avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE ? 10 : 12;
avctx->pix_fmt == AV_PIX_FMT_YUV444P10 ? 10 : 12;
enccfg->g_profile = 3; enccfg->g_profile = 3;
*img_fmt = VPX_IMG_FMT_I44416; *img_fmt = VPX_IMG_FMT_I44416;
*flags |= VPX_CODEC_USE_HIGHBITDEPTH; *flags |= VPX_CODEC_USE_HIGHBITDEPTH;


+ 1
- 1
libavcodec/version.h View File

@@ -30,7 +30,7 @@


#define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 24 #define LIBAVCODEC_VERSION_MINOR 24
#define LIBAVCODEC_VERSION_MICRO 103
#define LIBAVCODEC_VERSION_MICRO 104


#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \


Loading…
Cancel
Save