From fcf96d47b4dfa70c5b0626c6069eb5d32ece283b Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 18 Oct 2012 15:04:12 +0200 Subject: [PATCH] ffmpeg: add upstream patches Signed-off-by: Stephan Raue --- ...he-PTS-from-the-presentation-segment.patch | 64 +++++++++++++++++++ ...ac3-fix-ac3_bit_alloc_calc_bap_armv6.patch | 62 ++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0032-PGS-use-the-PTS-from-the-presentation-segment.patch create mode 100644 packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0033-ARM-ac3-fix-ac3_bit_alloc_calc_bap_armv6.patch diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0032-PGS-use-the-PTS-from-the-presentation-segment.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0032-PGS-use-the-PTS-from-the-presentation-segment.patch new file mode 100644 index 0000000000..8b773e6253 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0032-PGS-use-the-PTS-from-the-presentation-segment.patch @@ -0,0 +1,64 @@ +diff --git a/lib/ffmpeg/libavcodec/pgssubdec.c b/lib/ffmpeg/libavcodec/pgssubdec.c +index 2785d25..02e650a 100644 +--- a/libavcodec/pgssubdec.c ++++ b/libavcodec/pgssubdec.c +@@ -64,6 +64,7 @@ typedef struct PGSSubContext { + PGSSubPresentation presentation; + uint32_t clut[256]; + PGSSubPicture pictures[UINT16_MAX]; ++ int64_t pts; + } PGSSubContext; + + static av_cold int init_decoder(AVCodecContext *avctx) +@@ -377,6 +378,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data, + { + AVSubtitle *sub = data; + PGSSubContext *ctx = avctx->priv_data; ++ int64_t pts; + + uint16_t rect; + +@@ -386,7 +388,10 @@ static int display_end_segment(AVCodecContext *avctx, void *data, + * not been cleared by a subsequent empty display command. + */ + ++ pts = ctx->pts != AV_NOPTS_VALUE ? ctx->pts : sub->pts; + memset(sub, 0, sizeof(*sub)); ++ sub->pts = pts; ++ ctx->pts = AV_NOPTS_VALUE; + + // Blank if last object_count was 0. + if (!ctx->presentation.object_count) +@@ -431,8 +436,10 @@ static int display_end_segment(AVCodecContext *avctx, void *data, + static int decode(AVCodecContext *avctx, void *data, int *data_size, + AVPacket *avpkt) + { ++ PGSSubContext *ctx = avctx->priv_data; + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; ++ AVSubtitle *sub = data; + + const uint8_t *buf_end; + uint8_t segment_type; +@@ -477,6 +484,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, + break; + case PRESENTATION_SEGMENT: + parse_presentation_segment(avctx, buf, segment_length); ++ ctx->pts = sub->pts; + break; + case WINDOW_SEGMENT: + /* +diff --git a/lib/ffmpeg/libavcodec/utils.c b/lib/ffmpeg/libavcodec/utils.c +index 99bf27c..c1cde2c 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -1396,6 +1396,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + avctx->pkt = avpkt; + *got_sub_ptr = 0; + avcodec_get_subtitle_defaults(sub); ++ if (avctx->time_base.den && avpkt->pts != AV_NOPTS_VALUE) ++ sub->pts = av_rescale_q(avpkt->pts, ++ avctx->time_base, AV_TIME_BASE_Q); + ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt); + if (*got_sub_ptr) + avctx->frame_number++; diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0033-ARM-ac3-fix-ac3_bit_alloc_calc_bap_armv6.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0033-ARM-ac3-fix-ac3_bit_alloc_calc_bap_armv6.patch new file mode 100644 index 0000000000..fb5c6d091a --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.5-0033-ARM-ac3-fix-ac3_bit_alloc_calc_bap_armv6.patch @@ -0,0 +1,62 @@ +From cd2f98f365dfd83f0debac030413e57a73c7ecd5 Mon Sep 17 00:00:00 2001 +From: Mans Rullgard +Date: Wed, 1 Feb 2012 22:25:10 +0000 +Subject: [PATCH] ARM: ac3: fix ac3_bit_alloc_calc_bap_armv6 + +This function was broken when the start bin was not at the start +of a band. + +Signed-off-by: Mans Rullgard +--- + libavcodec/arm/ac3dsp_armv6.S | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/arm/ac3dsp_armv6.S b/libavcodec/arm/ac3dsp_armv6.S +index b6aee86..df8bfba 100644 +--- a/libavcodec/arm/ac3dsp_armv6.S ++++ b/libavcodec/arm/ac3dsp_armv6.S +@@ -34,24 +34,23 @@ function ff_ac3_bit_alloc_calc_bap_armv6, export=1 + add r0, r0, r4, lsl #1 @ mask + band + add r4, lr, r4 + add r7, r7, r2 @ bap + start +- ldrb r10, [r4], #1 + 1: + ldrsh r9, [r0], #2 @ mask[band] + mov r8, #0xff0 + sub r9, r9, r12 @ - snr_offset +- mov r11, r10 +- ldrb r10, [r4], #1 @ band_start_tab[band++] ++ ldrb r10, [r4, #1]! @ band_start_tab[++band] + subs r9, r9, r5 @ - floor + it lt + movlt r9, #0 + cmp r10, r3 @ - end + and r9, r9, r8, lsl #1 @ & 0x1fe0 + ite gt +- subgt r8, r3, r11 +- suble r8, r10, r11 ++ subgt r8, r3, r2 ++ suble r8, r10, r2 ++ mov r2, r10 + add r9, r9, r5 @ + floor => m + tst r8, #1 +- add r2, r7, r8 ++ add r11, r7, r8 + bne 3f + b 5f + 2: +@@ -65,9 +64,9 @@ function ff_ac3_bit_alloc_calc_bap_armv6, export=1 + ldrb lr, [r6, lr] + strb r8, [r7], #1 @ bap[bin] + strb lr, [r7], #1 +-5: cmp r7, r2 ++5: cmp r7, r11 + blo 2b +- cmp r3, r11 ++ cmp r3, r10 + bgt 1b + pop {r4-r11,pc} + 3: +-- +1.7.10.4 +