On 25/08/16 19:54, Lucien AT wrote:
> Seems you didn't see another post above....
>
> I tested this patch with videos encoded by aomenc, and found that for
> 10/12-bit av1 videos this patch decodes incorrectly. I found that
> ff_aom_imgfmt_to_pixfmt might not work as supposed for high bit depth. Like
> libvpx, avctx->pix_fmt should be set by both img->fmt and img->bit_depth.
> Also it seems that AV_PIX_FMT_YUV4XXP10/12/16 should use LE instead of BE.
> So after I change ff_aom_imgfmt_to_pixfmt to the following one:
>
> +enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, unsigned int
> bit_depth)
> +{
> + switch (img) {
> + case AOM_IMG_FMT_RGB24: return AV_PIX_FMT_RGB24;
> + case AOM_IMG_FMT_RGB565: return AV_PIX_FMT_RGB565BE;
> + case AOM_IMG_FMT_RGB555: return AV_PIX_FMT_RGB555BE;
> + case AOM_IMG_FMT_UYVY: return AV_PIX_FMT_UYVY422;
> + case AOM_IMG_FMT_YUY2: return AV_PIX_FMT_YUYV422;
> + case AOM_IMG_FMT_YVYU: return AV_PIX_FMT_YVYU422;
> + case AOM_IMG_FMT_BGR24: return AV_PIX_FMT_BGR24;
> + case AOM_IMG_FMT_ARGB: return AV_PIX_FMT_ARGB;
> + case AOM_IMG_FMT_ARGB_LE: return AV_PIX_FMT_BGRA;
> + case AOM_IMG_FMT_RGB565_LE: return AV_PIX_FMT_RGB565LE;
> + case AOM_IMG_FMT_RGB555_LE: return AV_PIX_FMT_RGB555LE;
> + case AOM_IMG_FMT_I420: return AV_PIX_FMT_YUV420P;
> + case AOM_IMG_FMT_I422: return AV_PIX_FMT_YUV422P;
> + case AOM_IMG_FMT_I444: return AV_PIX_FMT_YUV444P;
> + case AOM_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P;
> +#if AOM_IMAGE_ABI_VERSION >= 3
> + case AOM_IMG_FMT_I440: return AV_PIX_FMT_YUV440P;
> + case AOM_IMG_FMT_I42016:
> + switch (bit_depth) {
> + case 10: return AV_PIX_FMT_YUV420P10;
> + case 12: return AV_PIX_FMT_YUV420P12;
> + }
> + case AOM_IMG_FMT_I42216:
> + switch (bit_depth) {
> + case 10: return AV_PIX_FMT_YUV422P10;
> + case 12: return AV_PIX_FMT_YUV422P12;
> + }
> + case AOM_IMG_FMT_I44416:
> + switch (bit_depth) {
> + case 10: return AV_PIX_FMT_YUV444P10;
> + case 12: return AV_PIX_FMT_YUV444P12;
> + }
> +#endif
> + default: return AV_PIX_FMT_NONE;
> + }
> +}
>
> and use
> + avctx->pix_fmt = ff_aom_imgfmt_to_pixfmt(img->fmt, img->bit_depth);
> in libaomdec, the decoding result is identical to aomdec.
>
> If it is correct to do this, ff_aom_pixfmt_to_imgfmt might also need to be
> re-defined. While libaom can be built with or without high bit depth
> support (--enable/disable-aom-highbitdepth), it does not expose a macro
> like AOM_IMG_FMT_HIGHBITDEPTH. It only defines CONFIG_AOM_HIGHBITDEPTH in
> aom_config.h which is used for building aom reference tools only. I'm not
> sure if we should add further check on the pixel format conversion above.
Thank you a lot =) I eventually found time to rebuild aom with the
correct flags to test it. I'm updating my patch accordingly.
lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel