nv50: fix some h264 interlaced decoding on vp2
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 1 Aug 2013 16:50:10 +0000 (12:50 -0400)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Sat, 3 Aug 2013 10:52:04 +0000 (12:52 +0200)
Some videos specify mb_adaptive_frame_field_flag instead of
field_pic_flag. This implies that the pic height needs to be halved, and
this field needs to be passed to the VP engine.

Cc: "9.2" mesa-stable@lists.freedesktop.org
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nv50/nv84_video_bsp.c
src/gallium/drivers/nv50/nv84_video_vp.c

index 7885210e94dbc4553c0179ed0e1181c47707b1a2..28ba90f34dcf17595ccb9d234eadc67a4bd44d97 100644 (file)
@@ -136,12 +136,11 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
    params.iseqparm.chroma_format_idc = 1;
 
    params.iseqparm.pic_width_in_mbs_minus1 = mb(dec->base.width) - 1;
-   if (desc->field_pic_flag)
+   if (desc->field_pic_flag || desc->mb_adaptive_frame_field_flag)
       params.iseqparm.pic_height_in_map_units_minus1 = mb_half(dec->base.height) - 1;
    else
       params.iseqparm.pic_height_in_map_units_minus1 = mb(dec->base.height) - 1;
 
-   /* TODO: interlaced still doesn't work, maybe due to ref frame management. */
    if (desc->bottom_field_flag)
       params.ipicparm.curr_pic_order_cnt = desc->field_order_cnt[1];
    else
index e968546ae7b4a91f3149d78a0afc3e36f44542d1..581361b71d7999f908cdba62b36f64b7796323db 100644 (file)
@@ -39,10 +39,10 @@ struct h264_iparm1 {
    uint32_t h1; // 1fc
    uint32_t h2; // 200
    uint32_t h3; // 204
-   uint32_t unk208;
-   uint32_t field_pic_flag;
-   uint32_t format;
-   uint32_t unk214;
+   uint32_t mb_adaptive_frame_field_flag; // 208
+   uint32_t field_pic_flag; // 20c
+   uint32_t format; // 210
+   uint32_t unk214; // 214
 };
 
 struct h264_iparm2 {
@@ -56,7 +56,7 @@ struct h264_iparm2 {
    uint32_t h2; // 1c
    uint32_t h3; // 20
    uint32_t unk24;
-   uint32_t unk28;
+   uint32_t mb_adaptive_frame_field_flag; // 28
    uint32_t top; // 2c
    uint32_t bottom; // 30
    uint32_t is_reference; // 34
@@ -100,6 +100,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
    param1.height = param1.h2 = height;
    param1.h1 = param1.h3 = align(height, 32);
    param1.format = 0x3231564e; /* 'NV12' */
+   param1.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
    param1.field_pic_flag = desc->field_pic_flag;
 
    param2.width = width;
@@ -115,6 +116,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
       param2.top = desc->bottom_field_flag ? 2 : 1;
       param2.bottom = desc->bottom_field_flag;
    }
+   param2.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
    param2.is_reference = desc->is_reference;
 
    PUSH_SPACE(push, 5 + 16 + 3 + 2 + 6 + (is_ref ? 2 : 0) + 3 + 2 + 4 + 2);