Overview

Request 865 (accepted)

- update internal ffmpeg to version 1.2.5

Submit package home:enzokiel:...hes:Multimedia / avidemux3 to package Multimedia / avidemux3

avidemux3.changes Changed
x
 
1
@@ -1,4 +1,8 @@
2
 -------------------------------------------------------------------
3
+Sat Feb 01 2014 - joerg.lorenzen@ki.tng.de
4
+- update internal ffmpeg to version 1.2.5
5
+
6
+-------------------------------------------------------------------
7
 Mon Dec 09 2013 - joerg.lorenzen@ki.tng.de
8
 - Update to version 2.6.7
9
   * [MKV] Fix seeking in h264
10
@@ -9,9 +13,11 @@
11
   * [Build] Support for newer cmake (ajschult)
12
   * [Build] Better RPM generation (mit)
13
   * [Auto/PSP] Fixed scripts (LJ)
14
+
15
 -------------------------------------------------------------------
16
 Sat Nov 02 2013 - joerg.lorenzen@ki.tng.de
17
 - changes in spec file to enable build for openSUSE 11.4 and 12.1
18
+
19
 -------------------------------------------------------------------
20
 Wed Oct 30 2013 - joerg.lorenzen@ki.tng.de
21
 - Initial package, version 2.6.6
22
avidemux3.spec Changed
33
 
1
@@ -16,6 +16,8 @@
2
 #
3
 
4
 
5
+%define         ffmpeg_version 1.2.5
6
+
7
 Name:           avidemux3
8
 Summary:        Graphical video editing and transcoding tool
9
 Version:        2.6.7
10
@@ -24,6 +26,8 @@
11
 Source0:        avidemux_%{version}.tar.gz
12
 Source1:        avidemux3-qt4.desktop
13
 Source2:        avidemux3-gtk.desktop
14
+Source3:        ffmpeg-%{ffmpeg_version}.tar.bz2
15
+Source4:        xvba_support_from_xbmc_xvba.patch
16
 Patch0:         avidemux-cmake-2.8.8.patch
17
 Patch1:         avidemux-linking.patch
18
 Patch2:         avidemux-x264_plugins.patch
19
@@ -199,6 +203,13 @@
20
 %prep
21
 %setup -q -n avidemux_%{version}
22
 find . -type f -exec dos2unix -q {} \;
23
+sed -i -e 's|set(FFMPEG_VERSION "1.2.1")|set(FFMPEG_VERSION "%{ffmpeg_version}")|g' cmake/admFFmpegBuild.cmake
24
+rm -f avidemux_core/ffmpeg_package/ffmpeg-1.2.1.tar.bz2
25
+cp %{S:3} avidemux_core/ffmpeg_package/
26
+pushd avidemux_core/ffmpeg_package/patches/xvba
27
+rm -f xvba_support_from_xbmc_xvba.patch
28
+cp %{S:4} .
29
+popd
30
 %patch0 -p0
31
 %patch1 -p0
32
 %patch2 -p0
33
xvba_support_from_xbmc_xvba.patch Added
856
 
1
@@ -0,0 +1,854 @@
2
+diff --git a/configure b/configure
3
+index d557cac..ba1f392 100755
4
+--- a/configure
5
++++ b/configure
6
+@@ -144,6 +144,7 @@
7
+   --disable-vaapi          disable VAAPI code [autodetect]
8
+   --enable-vda             enable VDA code
9
+   --disable-vdpau          disable VDPAU code [autodetect]
10
++  --disable-xvba           disable XVBA code
11
+ 
12
+ Individual component options:
13
+   --disable-everything     disable all components listed below
14
+@@ -1216,6 +1217,7 @@
15
+     vaapi
16
+     vda
17
+     vdpau
18
++    xvba
19
+ "
20
+ 
21
+ LIBRARY_LIST="
22
+@@ -1845,6 +1847,7 @@
23
+ dxva2_deps="dxva2api_h"
24
+ vaapi_deps="va_va_h"
25
+ vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
26
++xvba_deps="amd_amdxvba_h"
27
+ vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
28
+ vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
29
+ 
30
+@@ -1865,6 +1868,8 @@
31
+ h264_vdpau_decoder_select="h264_decoder"
32
+ h264_vdpau_hwaccel_deps="vdpau"
33
+ h264_vdpau_hwaccel_select="h264_decoder"
34
++h264_xvba_hwaccel_select="h264_decoder"
35
++h264_xvba_hwaccel_deps="xvba"
36
+ mpeg_vdpau_decoder_deps="vdpau"
37
+ mpeg_vdpau_decoder_select="mpegvideo_decoder"
38
+ mpeg1_vdpau_decoder_deps="vdpau"
39
+@@ -1877,6 +1882,8 @@
40
+ mpeg2_vaapi_hwaccel_deps="vaapi"
41
+ mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
42
+ mpeg2_vdpau_hwaccel_deps="vdpau"
43
++mpeg2_xvba_hwaccel_select="mpeg2video_decoder"
44
++mpeg2_xvba_hwaccel_deps="xvba"
45
+ mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
46
+ mpeg4_crystalhd_decoder_select="crystalhd"
47
+ mpeg4_vaapi_hwaccel_deps="vaapi"
48
+@@ -1895,11 +1902,14 @@
49
+ vc1_vdpau_decoder_select="vc1_decoder"
50
+ vc1_vdpau_hwaccel_deps="vdpau"
51
+ vc1_vdpau_hwaccel_select="vc1_decoder"
52
++vc1_xvba_hwaccel_select="vc1_decoder"
53
++vc1_xvba_hwaccel_deps="xvba"
54
+ wmv3_crystalhd_decoder_select="crystalhd"
55
+ wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
56
+ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
57
+ wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
58
+ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
59
++wmv3_xvba_hwaccel_select="vc1_xvba_hwaccel"
60
+ 
61
+ # parsers
62
+ h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
63
+@@ -3853,6 +3863,7 @@
64
+ check_header unistd.h
65
+ check_header vdpau/vdpau.h
66
+ check_header vdpau/vdpau_x11.h
67
++check_header amd/amdxvba.h
68
+ check_header VideoDecodeAcceleration/VDADecoder.h
69
+ check_header windows.h
70
+ check_header X11/extensions/XvMClib.h
71
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
72
+index dc065a5..c386923 100644
73
+--- a/libavcodec/Makefile
74
++++ b/libavcodec/Makefile
75
+@@ -12,6 +12,7 @@ HEADERS = avcodec.h                                                     \
76
+           vdpau.h                                                       \
77
+           version.h                                                     \
78
+           xvmc.h                                                        \
79
++          xvba.h                                                        \
80
+ 
81
+ OBJS = allcodecs.o                                                      \
82
+        audioconvert.o                                                   \
83
+@@ -73,6 +74,7 @@ OBJS-$(CONFIG_SHARED)                  += log2_tab.o
84
+ OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
85
+ OBJS-$(CONFIG_VAAPI)                   += vaapi.o
86
+ OBJS-$(CONFIG_VDPAU)                   += vdpau.o
87
++OBJS-$(CONFIG_XVBA)                    += xvba.o
88
+ OBJS-$(CONFIG_VIDEODSP)                += videodsp.o
89
+ OBJS-$(CONFIG_VP3DSP)                  += vp3dsp.o
90
+ 
91
+@@ -232,6 +234,7 @@ OBJS-$(CONFIG_H264_VAAPI_HWACCEL)      += vaapi_h264.o
92
+ OBJS-$(CONFIG_H264_VDA_HWACCEL)        += vda_h264.o
93
+ OBJS-$(CONFIG_H264_VDA_DECODER)        += vda_h264_dec.o
94
+ OBJS-$(CONFIG_H264_VDPAU_HWACCEL)      += vdpau_h264.o
95
++OBJS-$(CONFIG_H264_XVBA_HWACCEL)       += xvba_h264.o
96
+ OBJS-$(CONFIG_HUFFYUV_DECODER)         += huffyuv.o huffyuvdec.o
97
+ OBJS-$(CONFIG_HUFFYUV_ENCODER)         += huffyuv.o huffyuvenc.o
98
+ OBJS-$(CONFIG_IAC_DECODER)             += imc.o
99
+@@ -295,6 +298,7 @@ OBJS-$(CONFIG_MPEG1VIDEO_ENCODER)      += mpeg12enc.o mpeg12.o          \
100
+ OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)     += dxva2_mpeg2.o
101
+ OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)     += vaapi_mpeg2.o
102
+ OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)     += vdpau_mpeg12.o
103
++OBJS-$(CONFIG_MPEG2_XVBA_HWACCEL)      += xvba_mpeg2.o
104
+ OBJS-$(CONFIG_MPEG2VIDEO_DECODER)      += mpeg12.o mpeg12data.o
105
+ OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)      += mpeg12enc.o mpeg12.o          \
106
+                                           timecode.o
107
+@@ -459,6 +463,7 @@ OBJS-$(CONFIG_VC1_DECODER)             += vc1dec.o vc1.o vc1data.o vc1dsp.o \
108
+ OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)       += dxva2_vc1.o
109
+ OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)       += vaapi_vc1.o
110
+ OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)       += vdpau_vc1.o
111
++OBJS-$(CONFIG_VC1_XVBA_HWACCEL)        += xvba_vc1.o
112
+ OBJS-$(CONFIG_VCR1_DECODER)            += vcr1.o
113
+ OBJS-$(CONFIG_VMDAUDIO_DECODER)        += vmdav.o
114
+ OBJS-$(CONFIG_VMDVIDEO_DECODER)        += vmdav.o
115
+@@ -788,6 +793,7 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
116
+ SKIPHEADERS-$(CONFIG_LIBUTVIDEO)       += libutvideo.h
117
+ SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
118
+ SKIPHEADERS-$(CONFIG_VAAPI)            += vaapi_internal.h
119
++SKIPHEADERS-$(CONFIG_XVBA)             += xvba_internal.h
120
+ SKIPHEADERS-$(CONFIG_VDA)              += vda.h
121
+ SKIPHEADERS-$(CONFIG_VDPAU)            += vdpau.h
122
+ SKIPHEADERS-$(HAVE_OS2THREADS)         += os2threads.h
123
+diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
124
+index 584446f..7a8f61c 100644
125
+--- a/libavcodec/allcodecs.c
126
++++ b/libavcodec/allcodecs.c
127
+@@ -79,18 +79,22 @@ void avcodec_register_all(void)
128
+     REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
129
+     REGISTER_HWACCEL(H264_VDA,          h264_vda);
130
+     REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
131
++    REGISTER_HWACCEL(H264_XVBA,         h264_xvba);
132
+     REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
133
+     REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
134
+     REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
135
+     REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
136
++    REGISTER_HWACCEL(MPEG2_XVBA,        mpeg2_xvba);
137
+     REGISTER_HWACCEL(MPEG4_VAAPI,       mpeg4_vaapi);
138
+     REGISTER_HWACCEL(MPEG4_VDPAU,       mpeg4_vdpau);
139
+     REGISTER_HWACCEL(VC1_DXVA2,         vc1_dxva2);
140
+     REGISTER_HWACCEL(VC1_VAAPI,         vc1_vaapi);
141
+     REGISTER_HWACCEL(VC1_VDPAU,         vc1_vdpau);
142
++    REGISTER_HWACCEL(VC1_XVBA,          vc1_xvba);
143
+     REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
144
+     REGISTER_HWACCEL(WMV3_VAAPI,        wmv3_vaapi);
145
+     REGISTER_HWACCEL(WMV3_VDPAU,        wmv3_vdpau);
146
++    REGISTER_HWACCEL(WMV3_XVBA,         wmv3_xvba);
147
+ 
148
+     /* video codecs */
149
+     REGISTER_ENCODER(A64MULTI,          a64multi);
150
+diff --git a/libavcodec/h264.c b/libavcodec/h264.c
151
+index 3a83b4b..96b6c30 100644
152
+--- a/libavcodec/h264.c
153
++++ b/libavcodec/h264.c
154
+@@ -81,6 +81,9 @@ static const enum AVPixelFormat h264_hwaccel_pixfmt_list_420[] = {
155
+ #if CONFIG_H264_VDPAU_HWACCEL
156
+     AV_PIX_FMT_VDPAU,
157
+ #endif
158
++#if CONFIG_H264_XVBA_HWACCEL
159
++    AV_PIX_FMT_XVBA_VLD,
160
++#endif
161
+     AV_PIX_FMT_YUV420P,
162
+     AV_PIX_FMT_NONE
163
+ };
164
+diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
165
+index 2130c74..4d611f9 100644
166
+--- a/libavcodec/vc1dec.c
167
++++ b/libavcodec/vc1dec.c
168
+@@ -5807,6 +5807,9 @@ static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
169
+ #if CONFIG_VDPAU
170
+     AV_PIX_FMT_VDPAU,
171
+ #endif
172
++#if CONFIG_XVBA
173
++    AV_PIX_FMT_XVBA_VLD,
174
++#endif
175
+     AV_PIX_FMT_YUV420P,
176
+     AV_PIX_FMT_NONE
177
+ };
178
+diff --git a/libavcodec/xvba.c b/libavcodec/xvba.c
179
+new file mode 100644
180
+index 0000000..c6ff2fe
181
+--- /dev/null
182
++++ b/libavcodec/xvba.c
183
+@@ -0,0 +1,77 @@
184
++/*
185
++ * HW decode acceleration for MPEG-2, H.264 and VC-1
186
++ *
187
++ * Copyright (C) 2005-2011 Team XBMC
188
++ *
189
++ * This file is part of FFmpeg.
190
++ *
191
++ * FFmpeg is free software; you can redistribute it and/or
192
++ * modify it under the terms of the GNU Lesser General Public
193
++ * License as published by the Free Software Foundation; either
194
++ * version 2.1 of the License, or (at your option) any later version.
195
++ *
196
++ * FFmpeg is distributed in the hope that it will be useful,
197
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
198
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
199
++ * Lesser General Public License for more details.
200
++ *
201
++ * You should have received a copy of the GNU Lesser General Public
202
++ * License along with FFmpeg; if not, write to the Free Software
203
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
204
++ */
205
++
206
++
207
++/**
208
++ * \addtogroup XVBA_Decoding
209
++ *
210
++ * @{
211
++ */
212
++
213
++#include <stdint.h>
214
++#include "xvba.h"
215
++#include "xvba_internal.h"
216
++#include "avcodec.h"
217
++#include "mpegvideo.h"
218
++
219
++int ff_xvba_translate_profile(int profile) {
220
++
221
++  if (profile == 66)
222
++    return 1;
223
++  else if (profile == 77)
224
++    return 2;
225
++  else if (profile == 100)
226
++    return 3;
227
++  else if (profile == 0)
228
++    return 4;
229
++  else if (profile == 1)
230
++    return 5;
231
++  else if (profile == 3)
232
++    return 6;
233
++  else
234
++    return -1;
235
++}
236
++
237
++// See page 25 of the documentation
238
++int ff_xvba_translate_picture_structure(int picture_structure) {
239
++  if(picture_structure == PICT_BOTTOM_FIELD)
240
++    return 0;
241
++  else if (picture_structure == PICT_TOP_FIELD)
242
++    return 1;
243
++  else //PICT_FRAME by default
244
++    return 3;
245
++}
246
++
247
++void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size) {
248
++
249
++  render->buffers = av_fast_realloc(
250
++         render->buffers,
251
++         &render->buffers_alllocated,
252
++         sizeof(struct xvba_bitstream_buffers)*(render->num_slices + 1)
253
++  );
254
++
255
++  render->buffers[render->num_slices].buffer = buffer;
256
++  render->buffers[render->num_slices].size = size;
257
++
258
++  render->num_slices++;
259
++}
260
++
261
+diff --git a/libavcodec/xvba.h b/libavcodec/xvba.h
262
+new file mode 100644
263
+index 0000000..e590faf
264
+--- /dev/null
265
++++ b/libavcodec/xvba.h
266
+@@ -0,0 +1,72 @@
267
++/*
268
++ * HW decode acceleration for MPEG-2, H.264 and VC-1
269
++ *
270
++ * Copyright (C) 2005-2011 Team XBMC
271
++ *
272
++ * This file is part of FFmpeg.
273
++ *
274
++ * FFmpeg is free software; you can redistribute it and/or
275
++ * modify it under the terms of the GNU Lesser General Public
276
++ * License as published by the Free Software Foundation; either
277
++ * version 2.1 of the License, or (at your option) any later version.
278
++ *
279
++ * FFmpeg is distributed in the hope that it will be useful,
280
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
281
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
282
++ * Lesser General Public License for more details.
283
++ *
284
++ * You should have received a copy of the GNU Lesser General Public
285
++ * License along with FFmpeg; if not, write to the Free Software
286
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
287
++ */
288
++
289
++#ifndef AVCODEC_XVBA_H
290
++#define AVCODEC_XVBA_H
291
++
292
++#include <stdint.h>
293
++#include <X11/Xlib.h>
294
++#include <amd/amdxvba.h>
295
++
296
++
297
++/**
298
++ * \defgroup XVBA_Decoding VA API Decoding
299
++ * \ingroup Decoder
300
++ * @{
301
++ */
302
++
303
++/** \brief The videoSurface is used for rendering. */
304
++#define FF_XVBA_STATE_USED_FOR_RENDER 1
305
++
306
++/**
307
++ * \brief The videoSurface is needed for reference/prediction.
308
++ * The codec manipulates this.
309
++ */
310
++#define FF_XVBA_STATE_USED_FOR_REFERENCE 2
311
++
312
++/**
313
++ * \brief The videoSurface holds a decoded frame.
314
++ * The codec manipulates this.
315
++ */
316
++#define FF_XVBA_STATE_DECODED 4
317
++
318
++/* @} */
319
++
320
++struct xvba_bitstream_buffers
321
++{
322
++  const void *buffer;
323
++  unsigned int size;
324
++};
325
++
326
++struct xvba_render_state {
327
++
328
++  int state; ///< Holds FF_XVBA_STATE_* values.
329
++  void *surface;
330
++  XVBAPictureDescriptor *picture_descriptor;
331
++  XVBAQuantMatrixAvc *iq_matrix;
332
++  unsigned int num_slices;
333
++  struct xvba_bitstream_buffers *buffers;
334
++  uint32_t buffers_alllocated;
335
++  int psf;
336
++};
337
++
338
++#endif /* AVCODEC_XVBA_H */
339
+diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
340
+new file mode 100644
341
+index 0000000..20ba2f2
342
+--- /dev/null
343
++++ b/libavcodec/xvba_h264.c
344
+@@ -0,0 +1,194 @@
345
++/*
346
++ * H.264 HW decode acceleration through XVBA
347
++ *
348
++ * Copyright (C) 2005-2011 Team XBMC
349
++ *
350
++ * This file is part of FFmpeg.
351
++ *
352
++ * FFmpeg is free software; you can redistribute it and/or
353
++ * modify it under the terms of the GNU Lesser General Public
354
++ * License as published by the Free Software Foundation; either
355
++ * version 2.1 of the License, or (at your option) any later version.
356
++ *
357
++ * FFmpeg is distributed in the hope that it will be useful,
358
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
359
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
360
++ * Lesser General Public License for more details.
361
++ *
362
++ * You should have received a copy of the GNU Lesser General Public
363
++ * License along with FFmpeg; if not, write to the Free Software
364
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
365
++ */
366
++
367
++#include "xvba.h"
368
++#include "xvba_internal.h"
369
++#include "h264.h"
370
++#include <assert.h>
371
++
372
++/** @file
373
++ *  This file implements the glue code between FFmpeg's and XvBA API's
374
++ *  structures for H.264 decoding.
375
++ */
376
++
377
++
378
++/** Initialize and start decoding a frame with XVBA. */
379
++static int start_frame(AVCodecContext          *avctx,
380
++                       av_unused const uint8_t *buffer,
381
++                       av_unused uint32_t       size)
382
++{
383
++  H264Context * const h = avctx->priv_data;
384
++  struct xvba_render_state *render;
385
++  XVBAPictureDescriptor *pic_descriptor;
386
++  int i;
387
++
388
++  render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
389
++  assert(render);
390
++
391
++  if (render->picture_descriptor == 0)
392
++    return -1;
393
++
394
++  pic_descriptor = render->picture_descriptor;
395
++
396
++  for (i = 0; i < 2; ++i) {
397
++      int foc = h->cur_pic_ptr->field_poc[i];
398
++      if (foc == INT_MAX)
399
++          foc = 0;
400
++      pic_descriptor->avc_curr_field_order_cnt_list[i] = foc;
401
++  }
402
++
403
++  pic_descriptor->avc_frame_num = h->frame_num;
404
++
405
++  render->num_slices = 0;
406
++
407
++  return 0;
408
++}
409
++
410
++/** End a hardware decoding based frame. */
411
++static int end_frame(AVCodecContext *avctx)
412
++{
413
++  H264Context * const h = avctx->priv_data;
414
++  struct xvba_render_state *render;
415
++  XVBAPictureDescriptor *pic_descriptor;
416
++  XVBAQuantMatrixAvc *iq_matrix;
417
++
418
++  render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
419
++  assert(render);
420
++
421
++  if (render->picture_descriptor == 0 || render->iq_matrix == 0)
422
++    return -1;
423
++
424
++  pic_descriptor = render->picture_descriptor;
425
++  iq_matrix = render->iq_matrix;
426
++
427
++  av_dlog(avctx, "end_frame()\n");
428
++
429
++  /* Fill in Picture Parameters*/
430
++  pic_descriptor->profile                                     = ff_xvba_translate_profile(avctx->profile);
431
++  pic_descriptor->level                                       = avctx->level;
432
++  pic_descriptor->width_in_mb                                 = h->mb_width;
433
++  pic_descriptor->height_in_mb                                = h->mb_height;
434
++
435
++  pic_descriptor->picture_structure                           = ff_xvba_translate_picture_structure(h->picture_structure);
436
++
437
++  pic_descriptor->chroma_format                               = h->chroma_format_idc ? h->chroma_format_idc : 1;
438
++  pic_descriptor->avc_intra_flag                              = (h->slice_type == AV_PICTURE_TYPE_I) ? 1 : 0;
439
++  pic_descriptor->avc_reference                               = (h->cur_pic_ptr->f.reference & 3) ? 1 : 0;
440
++
441
++  pic_descriptor->avc_bit_depth_luma_minus8                   = h->sps.bit_depth_luma - 8;
442
++  pic_descriptor->avc_bit_depth_chroma_minus8                 = h->sps.bit_depth_chroma - 8;
443
++  pic_descriptor->avc_log2_max_frame_num_minus4               = h->sps.log2_max_frame_num -4;
444
++  pic_descriptor->avc_pic_order_cnt_type                      = h->sps.poc_type;
445
++  pic_descriptor->avc_log2_max_pic_order_cnt_lsb_minus4       = h->sps.log2_max_poc_lsb - 4;
446
++  pic_descriptor->avc_num_ref_frames                          = h->sps.ref_frame_count;
447
++  pic_descriptor->avc_reserved_8bit                           = 0;
448
++
449
++  /* Set a level that can decode stuff in every case without a lookup table 
450
++     xvba seems to have problems only when the number of Reframes goes beyond
451
++     the max support number of Level4.1@High. So in praxis decoding a Level 3.0
452
++     file that in deed has level4.1@High specs does not matter. We use this fact
453
++     and check if the ref_frames stay in the range Level4.1@high can decode if
454
++     not, we set Level5.1 */
455
++  if (pic_descriptor->avc_num_ref_frames > 4) {
456
++    const unsigned int mbw = pic_descriptor->width_in_mb;
457
++    const unsigned int mbh = pic_descriptor->height_in_mb;
458
++    // this matches Level4.1@High stats to differ between <= 4.1 and 5.1
459
++    const unsigned int max_ref_frames = 12288 * 1024 / (mbw * mbh * 384);
460
++    const unsigned int num_ref_frames = pic_descriptor->avc_num_ref_frames;
461
++    if (max_ref_frames < num_ref_frames)
462
++        pic_descriptor->level = 51;
463
++  }
464
++
465
++  pic_descriptor->avc_num_slice_groups_minus1                 = h->pps.slice_group_count - 1;
466
++  pic_descriptor->avc_num_ref_idx_l0_active_minus1            = h->pps.ref_count[0] - 1;
467
++  pic_descriptor->avc_num_ref_idx_l1_active_minus1            = h->pps.ref_count[1] - 1;
468
++
469
++  pic_descriptor->avc_pic_init_qp_minus26                     = h->pps.init_qp - 26;
470
++  pic_descriptor->avc_pic_init_qs_minus26                     = h->pps.init_qs - 26;
471
++  pic_descriptor->avc_chroma_qp_index_offset                  = h->pps.chroma_qp_index_offset[0];
472
++  pic_descriptor->avc_second_chroma_qp_index_offset           = h->pps.chroma_qp_index_offset[1];
473
++  pic_descriptor->avc_slice_group_change_rate_minus1          = 0; // not implemented in ffmpeg
474
++  pic_descriptor->avc_reserved_16bit                          = 0; // must be 0
475
++  memset(pic_descriptor->avc_field_order_cnt_list,0,sizeof(pic_descriptor->avc_field_order_cnt_list)); // must be 0
476
++  memset(pic_descriptor->avc_slice_group_map,0,sizeof(pic_descriptor->avc_slice_group_map)); // must be 0
477
++
478
++  // sps
479
++  pic_descriptor->sps_info.avc.delta_pic_always_zero_flag     = h->sps.delta_pic_order_always_zero_flag;
480
++  pic_descriptor->sps_info.avc.direct_8x8_inference_flag      = h->sps.direct_8x8_inference_flag;
481
++  pic_descriptor->sps_info.avc.frame_mbs_only_flag            = h->sps.frame_mbs_only_flag;
482
++  pic_descriptor->sps_info.avc.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
483
++  pic_descriptor->sps_info.avc.mb_adaptive_frame_field_flag   = h->sps.mb_aff;
484
++  pic_descriptor->sps_info.avc.residual_colour_transform_flag = h->sps.residual_color_transform_flag;
485
++  pic_descriptor->sps_info.avc.xvba_avc_sps_reserved          = 0;
486
++
487
++  // pps
488
++  pic_descriptor->pps_info.avc.entropy_coding_mode_flag       = h->pps.cabac;
489
++  pic_descriptor->pps_info.avc.pic_order_present_flag         = h->pps.pic_order_present;
490
++  pic_descriptor->pps_info.avc.weighted_pred_flag             = h->pps.weighted_pred;
491
++  pic_descriptor->pps_info.avc.weighted_bipred_idc            = h->pps.weighted_bipred_idc;
492
++  pic_descriptor->pps_info.avc.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
493
++  pic_descriptor->pps_info.avc.constrained_intra_pred_flag    = h->pps.constrained_intra_pred;
494
++  pic_descriptor->pps_info.avc.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
495
++  pic_descriptor->pps_info.avc.transform_8x8_mode_flag        = h->pps.transform_8x8_mode;
496
++  pic_descriptor->pps_info.avc.xvba_avc_pps_reserved          = 0; // must be 0
497
++
498
++  memcpy(iq_matrix->bScalingLists4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->bScalingLists4x4));
499
++  memcpy(iq_matrix->bScalingLists8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->bScalingLists8x8[0]));
500
++  memcpy(iq_matrix->bScalingLists8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->bScalingLists8x8[0]));
501
++
502
++  // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
503
++  if (!h->got_first_iframe) {
504
++      if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)
505
++          return -1;
506
++      h->got_first_iframe = 1;
507
++  }
508
++
509
++  ff_h264_draw_horiz_band(h, 0, h->avctx->height);
510
++
511
++  return 0;
512
++}
513
++
514
++/** Decode the given H.264 slice with XVBA. */
515
++static int decode_slice(AVCodecContext *avctx,
516
++                        const uint8_t  *buffer,
517
++                        uint32_t        size)
518
++{
519
++  H264Context * const h = avctx->priv_data;
520
++  struct xvba_render_state *render;
521
++
522
++  render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
523
++  assert(render);
524
++
525
++  ff_xvba_add_slice_data(render, buffer, size);
526
++
527
++  return 0;
528
++}
529
++
530
++AVHWAccel ff_h264_xvba_hwaccel = {
531
++    .name           = "h264_xvba",
532
++    .type           = AVMEDIA_TYPE_VIDEO,
533
++    .id             = CODEC_ID_H264,
534
++    .pix_fmt        = AV_PIX_FMT_XVBA_VLD,
535
++    .start_frame    = start_frame,
536
++    .end_frame      = end_frame,
537
++    .decode_slice   = decode_slice,
538
++};
539
+diff --git a/libavcodec/xvba_internal.h b/libavcodec/xvba_internal.h
540
+new file mode 100644
541
+index 0000000..18faa3e
542
+--- /dev/null
543
++++ b/libavcodec/xvba_internal.h
544
+@@ -0,0 +1,25 @@
545
++/*
546
++ * HW decode acceleration for MPEG-2, H.264 and VC-1
547
++ *
548
++ * Copyright (C) 2005-2011 Team XBMC
549
++ *
550
++ * This file is part of FFmpeg.
551
++ *
552
++ * FFmpeg is free software; you can redistribute it and/or
553
++ * modify it under the terms of the GNU Lesser General Public
554
++ * License as published by the Free Software Foundation; either
555
++ * version 2.1 of the License, or (at your option) any later version.
556
++ *
557
++ * FFmpeg is distributed in the hope that it will be useful,
558
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
559
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
560
++ * Lesser General Public License for more details.
561
++ *
562
++ * You should have received a copy of the GNU Lesser General Public
563
++ * License along with FFmpeg; if not, write to the Free Software
564
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
565
++ */
566
++
567
++int ff_xvba_translate_profile(int profile);
568
++int ff_xvba_translate_picture_structure(int picture_structure);
569
++void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size);
570
+diff --git a/libavcodec/xvba_mpeg2.c b/libavcodec/xvba_mpeg2.c
571
+new file mode 100644
572
+index 0000000..0fc7d78
573
+--- /dev/null
574
++++ b/libavcodec/xvba_mpeg2.c
575
+@@ -0,0 +1,52 @@
576
++/*
577
++ * MPEG-2 HW decode acceleration through XVBA
578
++ *
579
++ * Copyright (C) 2005-2011 Team XBMC
580
++ *
581
++ * This file is part of FFmpeg.
582
++ *
583
++ * FFmpeg is free software; you can redistribute it and/or
584
++ * modify it under the terms of the GNU Lesser General Public
585
++ * License as published by the Free Software Foundation; either
586
++ * version 2.1 of the License, or (at your option) any later version.
587
++ *
588
++ * FFmpeg is distributed in the hope that it will be useful,
589
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
590
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
591
++ * Lesser General Public License for more details.
592
++ *
593
++ * You should have received a copy of the GNU Lesser General Public
594
++ * License along with FFmpeg; if not, write to the Free Software
595
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
596
++ */
597
++
598
++#include "dsputil.h"
599
++
600
++static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
601
++{
602
++    struct MpegEncContext * const s = avctx->priv_data;
603
++    return 0;
604
++}
605
++
606
++static int end_frame(AVCodecContext *avctx)
607
++{
608
++    return 0;
609
++}
610
++
611
++static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
612
++{
613
++    struct MpegEncContext * const s = avctx->priv_data;
614
++    return 0;
615
++}
616
++
617
++AVHWAccel ff_mpeg2_xvba_hwaccel = {
618
++    .name           = "mpeg2_xvba",
619
++    .type           = AVMEDIA_TYPE_VIDEO,
620
++    .id             = CODEC_ID_MPEG2VIDEO,
621
++    .pix_fmt        = AV_PIX_FMT_XVBA_VLD,
622
++    .capabilities   = 0,
623
++    .start_frame    = start_frame,
624
++    .end_frame      = end_frame,
625
++    .decode_slice   = decode_slice,
626
++    .priv_data_size = 0,
627
++};
628
+diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
629
+new file mode 100644
630
+index 0000000..e7a85a7
631
+--- /dev/null
632
++++ b/libavcodec/xvba_vc1.c
633
+@@ -0,0 +1,193 @@
634
++/*
635
++ * VC-1 HW decode acceleration through XVBA
636
++ *
637
++ * Copyright (C) 2005-2011 Team XBMC
638
++ *
639
++ * This file is part of FFmpeg.
640
++ *
641
++ * FFmpeg is free software; you can redistribute it and/or
642
++ * modify it under the terms of the GNU Lesser General Public
643
++ * License as published by the Free Software Foundation; either
644
++ * version 2.1 of the License, or (at your option) any later version.
645
++ *
646
++ * FFmpeg is distributed in the hope that it will be useful,
647
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
648
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
649
++ * Lesser General Public License for more details.
650
++ *
651
++ * You should have received a copy of the GNU Lesser General Public
652
++ * License along with FFmpeg; if not, write to the Free Software
653
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
654
++ */
655
++
656
++#include "xvba.h"
657
++#include "xvba_internal.h"
658
++#include "vc1.h"
659
++#include "vc1data.h"
660
++#include <assert.h>
661
++
662
++
663
++/** @file
664
++ * Implement structures of ffmpeg <-> XvBA
665
++ */
666
++
667
++/* Initialize and start decoding a frame with XvBA */
668
++static int start_frame(AVCodecContext *avctx,
669
++              av_unused const uint8_t *buffer, 
670
++              av_unused uint32_t size)
671
++{
672
++    VC1Context * const v = avctx->priv_data;
673
++    MpegEncContext * const s = &v->s;
674
++    struct xvba_render_state *render;
675
++
676
++    render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
677
++    assert(render);
678
++    
679
++    render->num_slices = 0;
680
++    return 0;
681
++}
682
++
683
++/* End a hardware decoding based frame */
684
++static int end_frame(AVCodecContext *avctx)
685
++{
686
++    VC1Context* const v = avctx->priv_data;
687
++    MpegEncContext* const s = &v->s;
688
++    struct xvba_render_state *render, *last, *next;
689
++    XVBAPictureDescriptor *pic_descriptor;
690
++
691
++    render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
692
++    assert(render);
693
++
694
++    if (render->picture_descriptor == 0)
695
++      return -1;
696
++
697
++    pic_descriptor = render->picture_descriptor;
698
++    
699
++    av_dlog(avctx, "xvba_vc1_end_frame()\n");
700
++    
701
++    memset(pic_descriptor, 0, sizeof(*pic_descriptor));
702
++
703
++    /* Fill in Parameters - for reference see AMD sdk documentation */
704
++    pic_descriptor->profile                                 = ff_xvba_translate_profile(v->profile);
705
++    pic_descriptor->level                                   = v->level;
706
++    //done like in va-driver and vaapi
707
++    if (v->profile == PROFILE_ADVANCED) {
708
++      pic_descriptor->width_in_mb                           = s->avctx->coded_width;
709
++      pic_descriptor->height_in_mb                          = s->avctx->coded_height;
710
++    } else {
711
++      pic_descriptor->width_in_mb                           = s->mb_width;
712
++      pic_descriptor->height_in_mb                          = s->mb_height;
713
++    }
714
++
715
++    pic_descriptor->picture_structure                       = ff_xvba_translate_picture_structure(s->picture_structure);
716
++
717
++    // xvba-video set this to 1 only 4:2:0 supported
718
++    // doc says: if not set, choose 1 - we try this
719
++    pic_descriptor->chroma_format                           = 1;
720
++    pic_descriptor->avc_intra_flag                          = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1;
721
++    pic_descriptor->avc_reference                           = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
722
++    
723
++    // VC-1 explicit parameters see page 30 of sdk
724
++    // sps_info
725
++    pic_descriptor->sps_info.vc1.postprocflag               = v->postprocflag;
726
++    
727
++    // done as in vaapi
728
++    pic_descriptor->sps_info.vc1.pulldown                   = v->broadcast;
729
++    pic_descriptor->sps_info.vc1.interlace                  = v->interlace;
730
++    pic_descriptor->sps_info.vc1.tfcntrflag                 = v->tfcntrflag;
731
++    pic_descriptor->sps_info.vc1.finterpflag                = v->finterpflag;
732
++    pic_descriptor->sps_info.vc1.reserved                   = 1;
733
++    // eventually check if this makes sense together with interlace
734
++    pic_descriptor->sps_info.vc1.psf                        = v->psf;
735
++    // what about if it is a frame (page 31)
736
++    // looked at xvba-driver
737
++    pic_descriptor->sps_info.vc1.second_field               = v->interlace && v->second_field && (v->fcm == ILACE_FIELD);
738
++    pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved      = 0;
739
++    
740
++    // VC-1 explicit parameters see page 30 of sdk
741
++    // pps_info
742
++    pic_descriptor->pps_info.vc1.panscan_flag               = v->panscanflag;
743
++    pic_descriptor->pps_info.vc1.refdist_flag               = v->refdist_flag;
744
++    pic_descriptor->pps_info.vc1.loopfilter                 = s->loop_filter;
745
++    pic_descriptor->pps_info.vc1.fastuvmc                   = v->fastuvmc;
746
++    pic_descriptor->pps_info.vc1.extended_mv                = v->extended_mv;
747
++    pic_descriptor->pps_info.vc1.dquant                     = v->dquant;
748
++    pic_descriptor->pps_info.vc1.vstransform                = v->vstransform;
749
++    pic_descriptor->pps_info.vc1.overlap                    = v->overlap;
750
++    pic_descriptor->pps_info.vc1.quantizer                  = v->quantizer_mode;
751
++    pic_descriptor->pps_info.vc1.extended_dmv               = v->extended_dmv;   
752
++    pic_descriptor->pps_info.vc1.maxbframes                 = s->avctx->max_b_frames;
753
++    pic_descriptor->pps_info.vc1.rangered                   = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : v->rangered;   
754
++    pic_descriptor->pps_info.vc1.syncmarker                 = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : s->resync_marker;
755
++    pic_descriptor->pps_info.vc1.multires                   = v->multires;
756
++    pic_descriptor->pps_info.vc1.reserved                   = 1;
757
++    pic_descriptor->pps_info.vc1.range_mapy_flag            = v->range_mapy_flag;
758
++    pic_descriptor->pps_info.vc1.range_mapy                 = v->range_mapy;
759
++    pic_descriptor->pps_info.vc1.range_mapuv_flag           = v->range_mapuv_flag;
760
++    pic_descriptor->pps_info.vc1.range_mapuv                = v->range_mapuv;
761
++    pic_descriptor->pps_info.vc1.xvba_vc1_pps_reserved      = 0;
762
++    
763
++    pic_descriptor->past_surface                            = 0;
764
++    pic_descriptor->future_surface                          = 0;
765
++    switch (s->pict_type) {
766
++    case AV_PICTURE_TYPE_B:
767
++        next = (struct xvba_render_state *)s->next_picture.f.data[0];
768
++        assert(next);
769
++        if (next)
770
++          pic_descriptor->past_surface = next->surface;
771
++        // fall-through
772
++    case AV_PICTURE_TYPE_P:
773
++        last = (struct xvba_render_state *)s->last_picture.f.data[0];
774
++        assert(last);
775
++        if (last)
776
++          pic_descriptor->future_surface = last->surface;
777
++        break;
778
++    }
779
++    render->psf = v->psf;
780
++
781
++    ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
782
++
783
++    return 0;
784
++}
785
++
786
++static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
787
++{
788
++  VC1Context* const v = avctx->priv_data;
789
++  MpegEncContext* const s = &v->s;
790
++  struct xvba_render_state *render;
791
++
792
++  render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
793
++  assert(render);
794
++
795
++  if (avctx->codec_id == CODEC_ID_VC1 &&
796
++      size >= 4 && IS_MARKER(AV_RB32(buffer))) {
797
++      buffer += 4;
798
++      size   -= 4;
799
++  }
800
++
801
++  ff_xvba_add_slice_data(render, buffer, size);
802
++
803
++  return 0;
804
++}
805
++
806
++#if CONFIG_WMV3_XVBA_HWACCEL
807
++AVHWAccel ff_wmv3_xvba_hwaccel = {
808
++    .name           = "wmv3_xvba",
809
++    .type           = AVMEDIA_TYPE_VIDEO,
810
++    .id             = CODEC_ID_WMV3,
811
++    .pix_fmt        = AV_PIX_FMT_XVBA_VLD,
812
++    .start_frame    = start_frame,
813
++    .end_frame      = end_frame,
814
++    .decode_slice   = decode_slice,
815
++};
816
++#endif
817
++
818
++AVHWAccel ff_vc1_xvba_hwaccel = {
819
++    .name           = "vc1_xvba",
820
++    .type           = AVMEDIA_TYPE_VIDEO,
821
++    .id             = CODEC_ID_VC1,
822
++    .pix_fmt        = AV_PIX_FMT_XVBA_VLD,
823
++    .start_frame    = start_frame,
824
++    .end_frame      = end_frame,
825
++    .decode_slice   = decode_slice,
826
++};
827
+diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
828
+index 1016dba..53dfec1 100644
829
+--- a/libavutil/pixdesc.c
830
++++ b/libavutil/pixdesc.c
831
+@@ -1141,6 +1141,12 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
832
+         .log2_chroma_h = 1,
833
+         .flags = PIX_FMT_HWACCEL,
834
+     },
835
++    [AV_PIX_FMT_XVBA_VLD] = {
836
++        .name = "xvba_vld",
837
++        .log2_chroma_w = 1,
838
++        .log2_chroma_h = 1,
839
++        .flags = PIX_FMT_HWACCEL,
840
++    },
841
+     [AV_PIX_FMT_YUV420P9LE] = {
842
+         .name = "yuv420p9le",
843
+         .nb_components = 3,
844
+diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
845
+index 1c00ac4..6437e29 100644
846
+--- a/libavutil/pixfmt.h
847
++++ b/libavutil/pixfmt.h
848
+@@ -124,6 +124,7 @@ enum AVPixelFormat {
849
+     AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
850
+     AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
851
+     AV_PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
852
++    AV_PIX_FMT_XVBA_VLD,  ///< HW decoding through xvba, Picture.data[3] contains a xvba_rander_state struct which contains the bitstream of the slices
853
+ 
854
+     AV_PIX_FMT_YUV420P16LE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
855
+     AV_PIX_FMT_YUV420P16BE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
856
ffmpeg-1.2.5.tar.bz2 Added
Refresh

No build results available

Refresh

No rpmlint results available

Request History
enzokiel's avatar

enzokiel created request about 11 years ago

- update internal ffmpeg to version 1.2.5


Stefan Botter's avatar

jsjhb accepted request about 11 years ago

OK