summaryrefslogtreecommitdiff
path: root/libre/mplayer-vaapi-libre/patch-fixes.patch
blob: 5da97d1d97aecca91e835cf902b157ac7326a7c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
diff -upr mplayer-vaapi-20110127.orig/patches/mplayer-vaapi-0.29.patch mplayer-vaapi-20110127/patches/mplayer-vaapi-0.29.patch
--- mplayer-vaapi-20110127.orig/patches/mplayer-vaapi-0.29.patch	2011-01-27 17:15:16.000000000 +0200
+++ mplayer-vaapi-20110127/patches/mplayer-vaapi-0.29.patch	2011-03-30 21:22:32.000000000 +0300
@@ -434,7 +434,7 @@ diff --git a/ffmpeg/libavcodec/vaapi_vc1
 index 34e9056..b29e50e 100644
 --- a/ffmpeg/libavcodec/vaapi_vc1.c
 +++ b/ffmpeg/libavcodec/vaapi_vc1.c
-@@ -146,101 +146,103 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
+@@ -146,103 +146,103 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
      pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
      if (!pic_param)
          return -1;
@@ -452,7 +452,9 @@ index 34e9056..b29e50e 100644
 -    pic_param->sequence_fields.bits.syncmarker                      = s->resync_marker;
 -    pic_param->sequence_fields.bits.rangered                        = v->rangered;
 -    pic_param->sequence_fields.bits.max_b_frames                    = s->avctx->max_b_frames;
+-#if VA_CHECK_VERSION(0,32,0)
 -    pic_param->sequence_fields.bits.profile                         = v->profile;
+-#endif
 -    pic_param->coded_width                                          = s->avctx->coded_width;
 -    pic_param->coded_height                                         = s->avctx->coded_height;
 -    pic_param->entrypoint_fields.value                              = 0; /* reset all bits */
diff -upr mplayer-vaapi-20110127.orig/patches/mplayer-vaapi.patch mplayer-vaapi-20110127/patches/mplayer-vaapi.patch
--- mplayer-vaapi-20110127.orig/patches/mplayer-vaapi.patch	2011-01-27 17:15:29.000000000 +0200
+++ mplayer-vaapi-20110127/patches/mplayer-vaapi.patch	2011-03-30 21:09:14.000000000 +0300
@@ -207,15 +207,6 @@ index 1e0f7fc..45e4574 100755
  echocheck "Xv"
  if test "$_xv" = auto ; then
    _xv=no
-@@ -4372,7 +4435,7 @@ if test "$_vdpau" = yes ; then
- else
-   def_vdpau='#define CONFIG_VDPAU 0'
-   novomodules="vdpau $novomodules"
--  libavdecoders=$(echo $libavdecoders | sed -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/H264_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER// -e s/MPEG4_VDPAU_DECODER//)
-+  libavdecoders=$(echo $libavdecoders | sed -e "s/\(MPEG\|MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_DECODER//g")
- fi
- echores "$_vdpau"
- 
 @@ -4791,6 +4854,31 @@ echores "$_corevideo"
  fi #if darwin
  
@@ -433,30 +424,19 @@ index d353bb5..e39a926 100644
    out YV12,I420,IYUV
  
  videocodec ffzygo
-diff --git a/ffmpeg/libavcodec/vaapi_vc1.c b/ffmpeg/libavcodec/vaapi_vc1.c
-index 2c24042..34e9056 100644
---- a/ffmpeg/libavcodec/vaapi_vc1.c
-+++ b/ffmpeg/libavcodec/vaapi_vc1.c
-@@ -160,6 +160,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
-     pic_param->sequence_fields.bits.syncmarker                      = s->resync_marker;
-     pic_param->sequence_fields.bits.rangered                        = v->rangered;
-     pic_param->sequence_fields.bits.max_b_frames                    = s->avctx->max_b_frames;
-+    pic_param->sequence_fields.bits.profile                         = v->profile;
-     pic_param->coded_width                                          = s->avctx->coded_width;
-     pic_param->coded_height                                         = s->avctx->coded_height;
-     pic_param->entrypoint_fields.value                              = 0; /* reset all bits */
 diff --git a/fmt-conversion.c b/fmt-conversion.c
 index 9e88100..bd32ce8 100644
 --- a/fmt-conversion.c
 +++ b/fmt-conversion.c
-@@ -18,12 +18,14 @@
+@@ -18,6 +18,7 @@
  
  #include "mp_msg.h"
  #include "libavutil/avutil.h"
 +#include "libavcodec/avcodec.h"
  #include "libmpcodecs/img_format.h"
- #include "fmt-conversion.h"
- 
+ #include "libavutil/samplefmt.h"
+ #include "libaf/af_format.h"
+@@ -26,6 +27,7 @@
  static const struct {
      int fmt;
      enum PixelFormat pix_fmt;
@@ -503,14 +483,15 @@ diff --git a/fmt-conversion.h b/fmt-conv
 index 9e133a8..962ca4e 100644
 --- a/fmt-conversion.h
 +++ b/fmt-conversion.h
-@@ -23,6 +23,6 @@
- #include "libavutil/avutil.h"
+@@ -24,7 +24,7 @@
+ #include "libavutil/samplefmt.h"
  
  enum PixelFormat imgfmt2pixfmt(int fmt);
 -int pixfmt2imgfmt(enum PixelFormat pix_fmt);
 +int pixfmt2imgfmt(enum PixelFormat pix_fmt, int codec_id);
+ enum AVSampleFormat affmt2samplefmt(int fmt);
+ int samplefmt2affmt(enum AVSampleFormat sample_fmt);
  
- #endif /* MPLAYER_FMT_CONVERSION_H */
 diff --git a/gui/mplayer/gtk/opts.c b/gui/mplayer/gtk/opts.c
 index 4f7ffb2..0da5434 100644
 --- a/gui/mplayer/gtk/opts.c
@@ -808,7 +789,7 @@ index 7c68a20..609ac41 100644
          sh_video_t *sh     = avctx->opaque;
          vd_ffmpeg_ctx *ctx = sh->context;
 @@ -295,6 +296,12 @@ static int init(sh_video_t *sh){
-     avctx->codec_type = CODEC_TYPE_VIDEO;
+     avctx->codec_type = AVMEDIA_TYPE_VIDEO;
      avctx->codec_id = lavc_codec->id;
  
 +#if CONFIG_VAAPI
@@ -817,9 +798,9 @@ index 7c68a20..609ac41 100644
 +        avctx->get_format = get_format;
 +    }
 +#endif /* CONFIG_VAAPI */
- #if CONFIG_VDPAU
-     if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
-         avctx->get_format = get_format;
+     avctx->get_format = get_format;
+     if(ctx->do_dr1){
+         avctx->flags|= CODEC_FLAG_EMU_EDGE;
 @@ -487,7 +494,7 @@ static void draw_slice(struct AVCodecContext *s,
                          const AVFrame *src, int offset[4],
                          int y, int type, int height){
@@ -841,12 +822,10 @@ index 7c68a20..609ac41 100644
          ctx->vo_initialized = 1;
      }
      return 0;
-@@ -972,24 +980,62 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
+@@ -974,22 +974,60 @@ static mp_image_t *decode(sh_video_t *sh
      return mpi;
  }
  
--#if CONFIG_XVMC || CONFIG_VDPAU
-+#if CONFIG_XVMC || CONFIG_VAAPI || CONFIG_VDPAU
 +static inline int is_hwaccel_format(int imgfmt)
 +{
 +    switch (get_video_hwaccel()) {
@@ -883,15 +862,14 @@ index 7c68a20..609ac41 100644
      int imgfmt;
      sh_video_t *sh = avctx->opaque;
 -    int i;
--
++    int i, try_hwaccel;
+ 
 -    for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
 -        imgfmt = pixfmt2imgfmt(fmt[i]);
 -        if(!IMGFMT_IS_HWACCEL(imgfmt)) continue;
 -        mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
 -        if(init_vo(sh, fmt[i]) >= 0) {
 -            break;
-+    int i, try_hwaccel;
-+
 +    for (try_hwaccel = 1; try_hwaccel >= 0; --try_hwaccel) {
 +        for (i = 0; fmt[i] != PIX_FMT_NONE; i++) {
 +            imgfmt = pixfmt2imgfmt(fmt[i], avctx->codec_id);
@@ -912,11 +890,9 @@ index 7c68a20..609ac41 100644
 +            break;
      }
 -    selected_format = fmt[i];
+     if (selected_format == PIX_FMT_NONE)
+         selected_format = avcodec_default_get_format(avctx, fmt);
      set_format_params(avctx, selected_format);
-     return selected_format;
- }
--#endif /* CONFIG_XVMC || CONFIG_VDPAU */
-+#endif /* CONFIG_XVMC || CONFIG_VAAPI || CONFIG_VDPAU */
 diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
 index 3619e69..fd869b7 100644
 --- a/libmpcodecs/vf.h
diff -upr mplayer-vaapi-20110127.orig/patches/mplayer-vdpau.patch mplayer-vaapi-20110127/patches/mplayer-vdpau.patch
--- mplayer-vaapi-20110127.orig/patches/mplayer-vdpau.patch	2010-11-15 08:41:19.000000000 +0200
+++ mplayer-vaapi-20110127/patches/mplayer-vdpau.patch	2011-03-30 22:29:47.000000000 +0300
@@ -11,15 +11,6 @@ index 91fd164..1f4434e 100755
  libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' ffmpeg/libavformat/allformats.c | tr '[a-z]' '[A-Z]')
  libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//)
  libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' ffmpeg/libavformat/allformats.c | tr '[a-z]' '[A-Z]')
-@@ -4466,7 +4466,7 @@ if test "$_vdpau" = yes ; then
- else
-   def_vdpau='#define CONFIG_VDPAU 0'
-   novomodules="vdpau $novomodules"
--  libavdecoders=$(echo $libavdecoders | sed -e "s/\(MPEG\|MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_DECODER//g")
-+  libavhwaccels=$(echo $libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_HWACCEL//g")
- fi
- echores "$_vdpau"
- 
 diff --git a/etc/codecs.conf b/etc/codecs.conf
 index b0d00f4..745d3e4 100644
 --- a/etc/codecs.conf
@@ -48,7 +39,7 @@ index b0d00f4..745d3e4 100644
    out YV12,I420,IYUV
    out 422P,444P
  
-@@ -332,41 +335,6 @@ videocodec ffmpeg12mc
+@@ -332,38 +335,6 @@ videocodec ffmpeg12mc
    out IDCT_MPEG2
    out MOCO_MPEG2
  
@@ -73,9 +64,6 @@ index b0d00f4..745d3e4 100644
 -  fourcc xdv7,xdv8,xdv9
 -  fourcc xdva,xdvb,xdvc
 -  fourcc xdvd,xdve,xdvf
--  fourcc xd5a,xd5b,xd5c
--  fourcc xd5d,xd5e,xd5f
--  fourcc xd59,xd54
 -  fourcc mx5n,mx4n,mx4p
 -  fourcc mx3n,mx3p
 -  fourcc AVmp
@@ -87,9 +75,9 @@ index b0d00f4..745d3e4 100644
 -  out VDPAU_MPEG1
 -  out VDPAU_MPEG2
 -
- videocodec mpegpes
-   info "MPEG-PES output (.mpg or DXR3/IVTV/DVB/V4L2 card)"
-   comment "for hardware decoding"
+ videocodec ffmpeg2crystalhd
+   info "FFmpeg MPEG-2 (CrystalHD)"
+   status working
 @@ -943,6 +911,7 @@ videocodec ffwmv3
    driver ffmpeg
    dll wmv3
@@ -133,7 +121,7 @@ index b0d00f4..745d3e4 100644
  
  videocodec ffh264
    info "FFmpeg H.264"
-@@ -993,19 +947,8 @@ videocodec ffh264
+@@ -993,21 +947,8 @@ videocodec ffh264
    driver ffmpeg
    dll h264
    out VAAPI_H264
@@ -146,6 +134,8 @@ index b0d00f4..745d3e4 100644
 -  fourcc X264,x264
 -  fourcc avc1,AVC1
 -  fourcc davc,DAVC
+-  fourcc ai55,ai15 ; flip4mac avc intra
+-  fourcc ai1q,ai5q ; flip4mac avc intra
 -  format 0x10000005
 -  driver ffmpeg
 -  dll h264_vdpau
@@ -200,55 +190,41 @@ diff --git a/ffmpeg/libavcodec/allcodecs
 index fbae0f6..4b6d2e9 100644
 --- a/ffmpeg/libavcodec/allcodecs.c
 +++ b/ffmpeg/libavcodec/allcodecs.c
-@@ -65,6 +65,13 @@ void avcodec_register_all(void)
-     REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2);
-     REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi);
- 
-+    REGISTER_HWACCEL (H264_VDPAU, h264_vdpau);
-+    REGISTER_HWACCEL (MPEG1_VDPAU, mpeg1_vdpau);
-+    REGISTER_HWACCEL (MPEG2_VDPAU, mpeg2_vdpau);
-+    REGISTER_HWACCEL (MPEG4_VDPAU, mpeg4_vdpau);
-+    REGISTER_HWACCEL (VC1_VDPAU, vc1_vdpau);
-+    REGISTER_HWACCEL (WMV3_VDPAU, wmv3_vdpau);
-+
-     /* video codecs */
-     REGISTER_ENCODER (A64MULTI, a64multi);
-     REGISTER_ENCODER (A64MULTI5, a64multi5);
 @@ -116,7 +123,6 @@ void avcodec_register_all(void)
-     REGISTER_DECODER (H263I, h263i);
      REGISTER_ENCODER (H263P, h263p);
      REGISTER_DECODER (H264, h264);
+     REGISTER_DECODER (H264_CRYSTALHD, h264_crystalhd);
 -    REGISTER_DECODER (H264_VDPAU, h264_vdpau);
      REGISTER_ENCDEC  (HUFFYUV, huffyuv);
      REGISTER_DECODER (IDCIN, idcin);
      REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1);
 @@ -140,10 +146,7 @@ void avcodec_register_all(void)
-     REGISTER_ENCDEC  (MPEG1VIDEO, mpeg1video);
      REGISTER_ENCDEC  (MPEG2VIDEO, mpeg2video);
      REGISTER_ENCDEC  (MPEG4, mpeg4);
+     REGISTER_DECODER (MPEG4_CRYSTALHD, mpeg4_crystalhd);
 -    REGISTER_DECODER (MPEG4_VDPAU, mpeg4_vdpau);
      REGISTER_DECODER (MPEGVIDEO, mpegvideo);
 -    REGISTER_DECODER (MPEG_VDPAU, mpeg_vdpau);
 -    REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau);
+     REGISTER_DECODER (MPEG2_CRYSTALHD, mpeg2_crystalhd);
+     REGISTER_DECODER (MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
      REGISTER_ENCDEC  (MSMPEG4V1, msmpeg4v1);
-     REGISTER_ENCDEC  (MSMPEG4V2, msmpeg4v2);
-     REGISTER_ENCDEC  (MSMPEG4V3, msmpeg4v3);
 @@ -196,7 +199,6 @@ void avcodec_register_all(void)
-     REGISTER_DECODER (V210X, v210x);
      REGISTER_DECODER (VB, vb);
      REGISTER_DECODER (VC1, vc1);
+     REGISTER_DECODER (VC1_CRYSTALHD, vc1_crystalhd);
 -    REGISTER_DECODER (VC1_VDPAU, vc1_vdpau);
      REGISTER_DECODER (VCR1, vcr1);
      REGISTER_DECODER (VMDVIDEO, vmdvideo);
      REGISTER_DECODER (VMNC, vmnc);
 @@ -210,7 +212,6 @@ void avcodec_register_all(void)
-     REGISTER_ENCDEC  (WMV1, wmv1);
      REGISTER_ENCDEC  (WMV2, wmv2);
      REGISTER_DECODER (WMV3, wmv3);
+     REGISTER_DECODER (WMV3_CRYSTALHD, wmv3_crystalhd);
 -    REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau);
      REGISTER_DECODER (WNV1, wnv1);
      REGISTER_DECODER (XAN_WC3, xan_wc3);
-     REGISTER_DECODER (XL, xl);
+     REGISTER_DECODER (XAN_WC4, xan_wc4);
 diff --git a/ffmpeg/libavcodec/avcodec.h b/ffmpeg/libavcodec/avcodec.h
 index bff9477..1e77fa6 100644
 --- a/ffmpeg/libavcodec/avcodec.h
@@ -285,9 +261,9 @@ index b0a3a8a..b5b9026 100644
  #include "mpeg4video_parser.h"
  #include "msmpeg4.h"
 -#include "vdpau_internal.h"
+ #include "thread.h"
  #include "flv.h"
  #include "mpeg4video.h"
- 
 @@ -620,11 +619,6 @@ retry:
      if(MPV_frame_start(s, avctx) < 0)
          return -1;
@@ -305,23 +281,23 @@ index f99f7ea..faafa97 100644
 --- a/ffmpeg/libavcodec/h264.c
 +++ b/ffmpeg/libavcodec/h264.c
 @@ -37,7 +37,6 @@
- #include "golomb.h"
  #include "mathops.h"
  #include "rectangle.h"
+ #include "thread.h"
 -#include "vdpau_internal.h"
  #include "libavutil/avassert.h"
  
  #include "cabac.h"
 @@ -1647,9 +1646,6 @@ static void field_end(H264Context *h){
-     s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
-     s->current_picture_ptr->pict_type= s->pict_type;
+         ff_thread_report_progress((AVFrame*)s->current_picture_ptr, (16*s->mb_height >> FIELD_PICTURE) - 1,
+                                  s->picture_structure==PICT_BOTTOM_FIELD);
  
 -    if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
 -        ff_vdpau_h264_set_reference_frames(s);
 -
-     if(!s->dropable) {
-         ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
-         h->prev_poc_msb= h->poc_msb;
+     if(in_setup || !(avctx->active_thread_type&FF_THREAD_FRAME)){
+     	 if(!s->dropable) {
+             ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
 @@ -1663,9 +1659,6 @@ static void field_end(H264Context *h){
              av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
      }
@@ -362,13 +338,13 @@ index f99f7ea..faafa97 100644
                      context_count++;
              }
              break;
-@@ -3408,20 +3392,3 @@ AVCodec h264_decoder = {
+@@ -3408,21 +3392,3 @@ AVCodec h264_decoder = {
      .flush= flush_dpb,
      .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
  };
 -
 -#if CONFIG_H264_VDPAU_DECODER
--AVCodec h264_vdpau_decoder = {
+-AVCodec ff_h264_vdpau_decoder = {
 -    "h264_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_H264,
@@ -381,6 +357,7 @@ index f99f7ea..faafa97 100644
 -    .flush= flush_dpb,
 -    .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
 -    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE},
+-    .profiles = NULL_IF_CONFIG_SMALL(profiles),
 -};
 -#endif
 diff --git a/ffmpeg/libavcodec/mpeg12.c b/ffmpeg/libavcodec/mpeg12.c
@@ -449,7 +426,7 @@ index 6a331eb..c226797 100644
 -                    break;
 -                }
 -
-                 if(avctx->thread_count > 1){
+                 if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
                      int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count;
                      if(threshold <= mb_y){
 @@ -2578,36 +2561,3 @@ AVCodec mpeg_xvmc_decoder = {
@@ -458,7 +435,7 @@ index 6a331eb..c226797 100644
  #endif
 -
 -#if CONFIG_MPEG_VDPAU_DECODER
--AVCodec mpeg_vdpau_decoder = {
+-AVCodec ff_mpeg_vdpau_decoder = {
 -    "mpegvideo_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_MPEG2VIDEO,
@@ -474,7 +451,7 @@ index 6a331eb..c226797 100644
 -#endif
 -
 -#if CONFIG_MPEG1_VDPAU_DECODER
--AVCodec mpeg1_vdpau_decoder = {
+-AVCodec ff_mpeg1_vdpau_decoder = {
 -    "mpeg1video_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_MPEG1VIDEO,
@@ -500,7 +477,7 @@ index b339f78..1928d03 100644
 -
 -
 -#if CONFIG_MPEG4_VDPAU_DECODER
--AVCodec mpeg4_vdpau_decoder = {
+-AVCodec ff_mpeg4_vdpau_decoder = {
 -    "mpeg4_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_MPEG4,
@@ -527,9 +504,17 @@ index 9650066..5f8440b 100644
      PIX_FMT_NONE
  };
 @@ -1064,7 +1065,6 @@ void MPV_frame_end(MpegEncContext *s)
-     if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
          ff_xvmc_field_end(s);
-     }else if(!s->avctx->hwaccel
+     }else if((s->error_count || s->encoding)
+        && !s->avctx->hwaccel
+-       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+        && s->unrestricted_mv
+        && s->current_picture.reference
+        && !s->intra_only
+@@ -2254,7 +2254,6 @@ void ff_draw_horiz_band(MpegEncContext *
+     }
+ 
+     if (!s->avctx->hwaccel
 -       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
         && s->unrestricted_mv
         && s->current_picture.reference
@@ -582,13 +567,13 @@ index c9a547b..71c50e7 100644
          if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
              return -1;
          if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
-@@ -3376,37 +3364,3 @@ AVCodec wmv3_decoder = {
-     .pix_fmts = ff_hwaccel_pixfmt_list_420
+@@ -3376,39 +3364,3 @@ AVCodec wmv3_decoder = {
+     .profiles = NULL_IF_CONFIG_SMALL(profiles)
  };
  #endif
 -
 -#if CONFIG_WMV3_VDPAU_DECODER
--AVCodec wmv3_vdpau_decoder = {
+-AVCodec ff_wmv3_vdpau_decoder = {
 -    "wmv3_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_WMV3,
@@ -600,12 +585,13 @@ index c9a547b..71c50e7 100644
 -    CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
 -    NULL,
 -    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"),
--    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}
+-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE},
+-    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 -};
 -#endif
 -
 -#if CONFIG_VC1_VDPAU_DECODER
--AVCodec vc1_vdpau_decoder = {
+-AVCodec ff_vc1_vdpau_decoder = {
 -    "vc1_vdpau",
 -    AVMEDIA_TYPE_VIDEO,
 -    CODEC_ID_VC1,
@@ -617,7 +603,8 @@ index c9a547b..71c50e7 100644
 -    CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
 -    NULL,
 -    .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"),
--    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}
+-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE},
+-    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 -};
 -#endif
 diff --git a/ffmpeg/libavcodec/vdpau.c b/ffmpeg/libavcodec/vdpau.c
@@ -1163,9 +1150,9 @@ index 8ec91c8..2386a81 100644
      PIX_FMT_BGR444LE,  ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
      PIX_FMT_Y400A,     ///< 8bit gray, 8bit alpha
 +    PIX_FMT_VDPAU,     ///< HW decoding with VDPAU, Picture.data[3] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+     PIX_FMT_BGR48LE,   ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
+     PIX_FMT_BGR48BE,   ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
      PIX_FMT_NB,        ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
- };
- 
 diff --git a/fmt-conversion.c b/fmt-conversion.c
 index bd32ce8..8994caa 100644
 --- a/fmt-conversion.c
@@ -1198,19 +1185,6 @@ index bd32ce8..8994caa 100644
      {0, PIX_FMT_NONE}
  };
  
-diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
-index 84b5430..aef79e9 100644
---- a/libmpcodecs/vd_ffmpeg.c
-+++ b/libmpcodecs/vd_ffmpeg.c
-@@ -303,7 +303,7 @@ static int init(sh_video_t *sh){
-     }
- #endif /* CONFIG_VAAPI */
- #if CONFIG_VDPAU
--    if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
-+    if(get_video_hwaccel() == HWACCEL_VDPAU){
-         avctx->get_format = get_format;
-     }
- #endif /* CONFIG_VDPAU */
 diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
 index 5133b66..0ce6104 100644
 --- a/libvo/vo_vdpau.c