[FFmpeg-devel,2/2,v2] avcodec/libaomdec: export chroma sample location

Submitted by James Almer on Sept. 19, 2018, 1:14 a.m.

Details

Message ID 20180919011447.8804-2-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Sept. 19, 2018, 1:14 a.m.
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libaomdec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 2530c9f76b..68157b253d 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -94,6 +94,15 @@  static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
     avctx->colorspace  = img->mc;
     avctx->color_trc   = img->tc;
 
+    switch (img->csp) {
+    case AOM_CSP_VERTICAL:
+        avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
+        break;
+    case AOM_CSP_COLOCATED:
+        avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
+        break;
+    }
+
     switch (img->fmt) {
     case AOM_IMG_FMT_I420:
     case AOM_IMG_FMT_I42016: