summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Scheel <julian@jusst.de>2010-06-12 12:31:04 +0200
committerJulian Scheel <julian@jusst.de>2010-06-12 12:31:04 +0200
commitd4db3fd962138805227e55cfa16fefe5323b63de (patch)
treea5f1b1de6458759023dc9f87a958b4bae7ff2fc2
parent2c438e4666ebac309668c147a12df790fccaf079 (diff)
downloadxine-lib-d4db3fd962138805227e55cfa16fefe5323b63de.tar.gz
xine-lib-d4db3fd962138805227e55cfa16fefe5323b63de.tar.bz2
interlaced/progressive detection
implemented a proper detection of interlaced/progressive content to enable deinterlacing only when needed
-rw-r--r--src/video_dec/libvdpau/nal.h7
-rw-r--r--src/video_dec/libvdpau/vdpau_h264.c44
2 files changed, 44 insertions, 7 deletions
diff --git a/src/video_dec/libvdpau/nal.h b/src/video_dec/libvdpau/nal.h
index 60e3c22b0..b2fe581ad 100644
--- a/src/video_dec/libvdpau/nal.h
+++ b/src/video_dec/libvdpau/nal.h
@@ -56,6 +56,13 @@ enum pic_struct {
DISP_FRAME_TRIPLING
};
+enum ct_type {
+ CT_PROGRESSIVE = 0,
+ CT_INTERLACED,
+ CT_UNKNOWN,
+ CT_RESERVED
+};
+
/* slice types repeat from 5-9, we
* need a helper function for comparison
*/
diff --git a/src/video_dec/libvdpau/vdpau_h264.c b/src/video_dec/libvdpau/vdpau_h264.c
index 04ab8f8fe..72ee39868 100644
--- a/src/video_dec/libvdpau/vdpau_h264.c
+++ b/src/video_dec/libvdpau/vdpau_h264.c
@@ -290,6 +290,41 @@ static void fill_vdpau_pictureinfo_h264(video_decoder_t *this_gen, uint32_t slic
}
+int check_progressive(struct coded_picture *pic)
+{
+ if (pic->flag_mask & PIC_STRUCT_PRESENT) {
+ uint8_t pic_struct = pic->sei_nal->sei.pic_timing.pic_struct;
+
+ if (pic_struct == DISP_FRAME) {
+ return 1;
+ } else if (pic_struct == DISP_TOP_BOTTOM ||
+ pic_struct == DISP_BOTTOM_TOP) {
+ return 0;
+ }
+
+ /* FIXME: seems unreliable, maybe it's has to be interpreted more complex */
+ /*if (pic->sei_nal->sei.pic_timing.ct_type == CT_INTERLACED) {
+ return 0;
+ } else if (pic->sei_nal->sei.pic_timing.ct_type == CT_PROGRESSIVE) {
+ return 1;
+ } */
+ }
+
+ if (pic->slc_nal->slc.field_pic_flag && pic->pps_nal->pps.pic_order_present_flag) {
+ if(pic->slc_nal->slc.delta_pic_order_cnt_bottom == 1 ||
+ pic->slc_nal->slc.delta_pic_order_cnt_bottom == -1) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ if (!pic->slc_nal->slc.field_pic_flag & pic->sps_nal->sps.frame_mbs_only_flag) {
+ return 1;
+ }
+
+ return 0;
+}
+
static int vdpau_decoder_init(video_decoder_t *this_gen)
{
vdpau_h264_decoder_t *this = (vdpau_h264_decoder_t *)this_gen;
@@ -526,13 +561,8 @@ static int vdpau_decoder_render(video_decoder_t *this_gen, VdpBitstreamBuffer *v
else {
img->bad_frame = 0;
- img->progressive_frame = 0;
-
- if(/*(sps->vui_parameters_present_flag &&
- sps->vui_parameters.pic_struct_present_flag &&
- !(this->completed_pic->flag_mask & INTERLACED)) ||*/
- (!pic.field_pic_flag && !pic.mb_adaptive_frame_field_flag))
- img->progressive_frame = 1;
+ img->progressive_frame = check_progressive(this->completed_pic);
+ printf("progressive: %d\n", img->progressive_frame);
if(!img->progressive_frame && this->completed_pic->repeat_pic)
img->repeat_first_field = 1;