ffmpeg: updat XVBA patches

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-05-05 21:40:21 +02:00
parent ca707042cc
commit 2c00390897
6 changed files with 252 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From f7bb0fe1f6336ce3d5263680f2985fd0cedb719d Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Wed, 1 May 2013 18:43:56 +0200
Subject: [PATCH] ffmpeg: register vdpau hwaccel for mpeg12
---
libavcodec/mpeg12.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 9d2743a..0f94772 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1202,6 +1202,7 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
#endif
#if CONFIG_MPEG1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG1,
+ AV_PIX_FMT_VDPAU,
#endif
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE
@@ -1214,6 +1215,7 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
#endif
#if CONFIG_MPEG2_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG2,
+ AV_PIX_FMT_VDPAU,
#endif
#if CONFIG_MPEG2_DXVA2_HWACCEL
AV_PIX_FMT_DXVA2_VLD,
--
1.8.1.6

View File

@ -0,0 +1,30 @@
From 7c305a6fc9cd41a5eddf28cfbfc33bb98459c29e Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Thu, 2 May 2013 19:29:05 +0200
Subject: [PATCH] ffmpeg: fix vdpau vc1 field interlace
---
libavcodec/vdpau_vc1.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
index f5da9bb..6831599 100644
--- a/libavcodec/vdpau_vc1.c
+++ b/libavcodec/vdpau_vc1.c
@@ -59,7 +59,12 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
else
info->picture_type = s->pict_type - 1 + s->pict_type / 3;
- info->frame_coding_mode = v->fcm;
+ if (v->fcm == PROGRESSIVE)
+ info->frame_coding_mode = 0;
+ else if (v->fcm == ILACE_FRAME)
+ info->frame_coding_mode = 2;
+ else if (v->fcm == ILACE_FIELD)
+ info->frame_coding_mode = 3;
info->postprocflag = v->postprocflag;
info->pulldown = v->broadcast;
info->interlace = v->interlace;
--
1.8.1.6

View File

@ -0,0 +1,26 @@
From 7eadcd87bee856b71d98f5a02ab210fcb7b57311 Mon Sep 17 00:00:00 2001
From: fritsch <peter.fruehberger@gmail.com>
Date: Sat, 13 Apr 2013 16:38:50 +0200
Subject: [PATCH] ffmpeg: XVBA-VC1 use v->second_field instead of
!s->first_field to make VC1 interlaced working
---
libavcodec/xvba_vc1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
index ff35a28..04e7983 100644
--- a/libavcodec/xvba_vc1.c
+++ b/libavcodec/xvba_vc1.c
@@ -99,7 +99,7 @@ static int end_frame(AVCodecContext *avctx)
pic_descriptor->sps_info.vc1.psf = v->psf;
// what about if it is a frame (page 31)
// looked at xvba-driver
- pic_descriptor->sps_info.vc1.second_field = !s->first_field;
+ pic_descriptor->sps_info.vc1.second_field = v->second_field;
pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved = 0;
// VC-1 explicit parameters see page 30 of sdk
--
1.8.1.6

View File

@ -0,0 +1,26 @@
From 2b6cd6a04eb38e0ac210c6e5c70267dd12512295 Mon Sep 17 00:00:00 2001
From: fritsch <peter.fruehberger@gmail.com>
Date: Sat, 27 Apr 2013 17:36:15 +0200
Subject: [PATCH] XVBA: Only set second_field when we are interlaced and an
interlaced field
---
libavcodec/xvba_vc1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
index 04e7983..eb90c12 100644
--- a/libavcodec/xvba_vc1.c
+++ b/libavcodec/xvba_vc1.c
@@ -99,7 +99,7 @@ static int end_frame(AVCodecContext *avctx)
pic_descriptor->sps_info.vc1.psf = v->psf;
// what about if it is a frame (page 31)
// looked at xvba-driver
- pic_descriptor->sps_info.vc1.second_field = v->second_field;
+ pic_descriptor->sps_info.vc1.second_field = v->interlace && v->second_field && (v->fcm == ILACE_FIELD);
pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved = 0;
// VC-1 explicit parameters see page 30 of sdk
--
1.8.1.6

View File

@ -0,0 +1,84 @@
From e1c66a2726b0342bf8c166546838f72d3cfb26a8 Mon Sep 17 00:00:00 2001
From: fritsch <peter.fruehberger@gmail.com>
Date: Sat, 27 Apr 2013 22:08:50 +0200
Subject: [PATCH] xvba: translate picture_structure to a value xvba understands
---
libavcodec/xvba.c | 11 +++++++++++
libavcodec/xvba_h264.c | 4 +++-
libavcodec/xvba_internal.h | 1 +
libavcodec/xvba_vc1.c | 4 +++-
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/libavcodec/xvba.c b/libavcodec/xvba.c
index be29e5d..566922e 100644
--- a/libavcodec/xvba.c
+++ b/libavcodec/xvba.c
@@ -31,6 +31,7 @@
#include "xvba.h"
#include "xvba_internal.h"
#include "avcodec.h"
+#include "mpegvideo.h"
int ff_xvba_translate_profile(int profile) {
@@ -50,6 +51,16 @@ int ff_xvba_translate_profile(int profile) {
return -1;
}
+// See page 25 of the documentation
+int ff_xvba_translate_picture_structure(int picture_structure) {
+ if(picture_structure == PICT_TOP_FIELD)
+ return 0;
+ else if (picture_structure == PICT_BOTTOM_FIELD)
+ return 1;
+ else //PICT_FRAME by default
+ return 3;
+}
+
void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size) {
render->buffers = av_fast_realloc(
diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
index 309d928..20ba2f2 100644
--- a/libavcodec/xvba_h264.c
+++ b/libavcodec/xvba_h264.c
@@ -87,7 +87,9 @@ static int end_frame(AVCodecContext *avctx)
pic_descriptor->level = avctx->level;
pic_descriptor->width_in_mb = h->mb_width;
pic_descriptor->height_in_mb = h->mb_height;
- pic_descriptor->picture_structure = h->picture_structure;
+
+ pic_descriptor->picture_structure = ff_xvba_translate_picture_structure(h->picture_structure);
+
pic_descriptor->chroma_format = h->chroma_format_idc ? h->chroma_format_idc : 1;
pic_descriptor->avc_intra_flag = (h->slice_type == AV_PICTURE_TYPE_I) ? 1 : 0;
pic_descriptor->avc_reference = (h->cur_pic_ptr->f.reference & 3) ? 1 : 0;
diff --git a/libavcodec/xvba_internal.h b/libavcodec/xvba_internal.h
index 9653f85..18faa3e 100644
--- a/libavcodec/xvba_internal.h
+++ b/libavcodec/xvba_internal.h
@@ -21,4 +21,5 @@
*/
int ff_xvba_translate_profile(int profile);
+int ff_xvba_translate_picture_structure(int picture_structure);
void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size);
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
index eb90c12..c98dba5 100644
--- a/libavcodec/xvba_vc1.c
+++ b/libavcodec/xvba_vc1.c
@@ -78,7 +78,9 @@ static int end_frame(AVCodecContext *avctx)
pic_descriptor->width_in_mb = s->mb_width;
pic_descriptor->height_in_mb = s->mb_height;
}
- pic_descriptor->picture_structure = s->picture_structure;
+
+ pic_descriptor->picture_structure = ff_xvba_translate_picture_structure(s->picture_structure);
+
// xvba-video set this to 1 only 4:2:0 supported
// doc says: if not set, choose 1 - we try this
pic_descriptor->chroma_format = 1;
--
1.8.1.6

View File

@ -0,0 +1,54 @@
From 4474d708a96a2488f346a323cc79e6597c9326bf Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Tue, 30 Apr 2013 21:18:55 +0200
Subject: [PATCH] ffmpeg xvba: fix vc1 field interlace
---
lib/ffmpeg/libavcodec/xvba.c | 4 ++--
libavcodec/xvba.h | 1 +
libavcodec/xvba_vc1.c | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/xvba.c b/libavcodec/xvba.c
index 566922e..c6ff2fe 100644
--- a/libavcodec/xvba.c
+++ b/libavcodec/xvba.c
@@ -53,9 +53,9 @@ int ff_xvba_translate_profile(int profile) {
// See page 25 of the documentation
int ff_xvba_translate_picture_structure(int picture_structure) {
- if(picture_structure == PICT_TOP_FIELD)
+ if(picture_structure == PICT_BOTTOM_FIELD)
return 0;
- else if (picture_structure == PICT_BOTTOM_FIELD)
+ else if (picture_structure == PICT_TOP_FIELD)
return 1;
else //PICT_FRAME by default
return 3;
diff --git a/libavcodec/xvba.h b/libavcodec/xvba.h
index 9f9ff0c..e590faf 100644
--- a/libavcodec/xvba.h
+++ b/libavcodec/xvba.h
@@ -66,6 +66,7 @@ struct xvba_render_state {
unsigned int num_slices;
struct xvba_bitstream_buffers *buffers;
uint32_t buffers_alllocated;
+ int psf;
};
#endif /* AVCODEC_XVBA_H */
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
index c98dba5..e7a85a7 100644
--- a/libavcodec/xvba_vc1.c
+++ b/libavcodec/xvba_vc1.c
@@ -143,6 +143,7 @@ static int end_frame(AVCodecContext *avctx)
pic_descriptor->future_surface = last->surface;
break;
}
+ render->psf = v->psf;
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
--
1.8.1.6