History

Merge commit '1fb8f6a44f06e48386450fe0363aefc02583d24a'

* commit '1fb8f6a44f06e48386450fe0363aefc02583d24a': x86: lavr: add SSE2 quantize() for dithering doc/APIchanges: fill in missing dates and hashes. rtpdec_vp8: Request a keyframe if RTP packets are lost Conflicts: doc/APIchanges

Michael Niedermayer committed 13 years ago

Commit 75afbe22 parents 34c1c08 1fb8f6a7 files · +140 −12Browse files

Unified · Split

7 files
  1. doc/APIchanges +11 −11
  2. libavformat/rtpdec_vp8.c +27 −1
  3. libavresample/dither.c +3 −0
  4. libavresample/dither.h +5 −0
  5. libavresample/x86/Makefile +2 −0
  6. libavresample/x86/dither.asm +53 −0
  7. libavresample/x86/dither_init.c +39 −0
doc/APIchanges+11−11
@@ -132,34 +132,34 @@ API changes, most recent first: · 131 unmodified lines
1322012-03-26 - a67d9cf - lavfi 2.66.1001322012-03-26 - a67d9cf - lavfi 2.66.100
133 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.133 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
134 134
1352013-xx-xx - xxxxxxx - lavr 1.1.01352013-01-07 - 074a00d - lavr 1.1.0
136 Add avresample_set_channel_mapping() for input channel reordering,136 Add avresample_set_channel_mapping() for input channel reordering,
137 duplication, and silencing.137 duplication, and silencing.
138 138
1392012-xx-xx - xxxxxxx - lavu 52.2.1 - avstring.h1392012-12-29 - d8fd06c - lavu 52.2.1 - avstring.h
140 Add av_basename() and av_dirname().140 Add av_basename() and av_dirname().
141 141
1422012-11-10 - 5980f5dd - lavu 52.2.0 - audioconvert.h1422012-11-11 - 5980f5d - lavu 52.2.0 - audioconvert.h
143 Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.143 Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
144 144
1452012-10-26 - dfde8a34 - lavu 52.1.0 - intmath.h1452012-11-05 - dfde8a3 - lavu 52.1.0 - intmath.h
146 Add av_ctz() for trailing zero bit count.146 Add av_ctz() for trailing zero bit count
147 147
1482012-10-18 - a893655b - lavu 51.45.0 - error.h1482012-10-21 - a893655 - lavu 51.45.0 - error.h
149 Add AVERROR_EXPERIMENTAL.149 Add AVERROR_EXPERIMENTAL
150 150
1512012-10-12 - d2fcb356 - lavu 51.44.0 - pixdesc.h1512012-10-12 - d2fcb35 - lavu 51.44.0 - pixdesc.h
152 Add functions for accessing pixel format descriptors.152 Add functions for accessing pixel format descriptors.
153 Accessing the av_pix_fmt_descriptors array directly is now153 Accessing the av_pix_fmt_descriptors array directly is now
154 deprecated.154 deprecated.
155 155
1562012-10-11 - 9a92aea2 - lavu 51.43.0 - aes.h, md5.h, sha.h, tree.h1562012-10-11 - 9a92aea - lavu 51.43.0 - aes.h, md5.h, sha.h, tree.h
157 Add functions for allocating the opaque contexts for the algorithms,157 Add functions for allocating the opaque contexts for the algorithms,
158 158
1592012-10-10 - b522000e - lavf 54.18.0 - avio.h1592012-10-10 - b522000 - lavf 54.18.0 - avio.h
160 Add avio_closep to complement avio_close.160 Add avio_closep to complement avio_close.
161 161
1622012-10-06 - 78071a14 - lavu 51.42.0 - pixfmt.h1622012-10-08 - 78071a1 - lavu 51.42.0 - pixfmt.h
163 Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*.163 Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*.
164 To provide backwards compatibility, PixelFormat is now #defined as164 To provide backwards compatibility, PixelFormat is now #defined as
165 AVPixelFormat.165 AVPixelFormat.
libavformat/rtpdec_vp8.c+27−1
@@ -35,11 +35,21 @@ struct PayloadContext { · 34 unmodified lines
35 AVIOContext *data;35 AVIOContext *data;
36 uint32_t timestamp;36 uint32_t timestamp;
37 int is_keyframe;37 int is_keyframe;
38 /* If sequence_ok is set, we keep returning data (even if we might have
39 * lost some data, but we haven't lost any too critical data that would
40 * cause the decoder to desynchronize and output random garbage).
41 */
38 int sequence_ok;42 int sequence_ok;
39 int first_part_size;43 int first_part_size;
40 uint16_t prev_seq;44 uint16_t prev_seq;
41 int prev_pictureid;45 int prev_pictureid;
42 int broken_frame;46 int broken_frame;
47 /* If sequence_dirty is set, we have lost some data (critical or
48 * non-critical) and decoding will have some sort of artefacts, and
49 * we thus should request a new keyframe.
50 */
51 int sequence_dirty;
52 int got_keyframe;
43};53};
44 54
45static void vp8_free_buffer(PayloadContext *vp8)55static void vp8_free_buffer(PayloadContext *vp8)
@@ -141,11 +151,15 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, · 95 unmodified lines
141 vp8_free_buffer(vp8);151 vp8_free_buffer(vp8);
142 // Keyframe, decoding ok again152 // Keyframe, decoding ok again
143 vp8->sequence_ok = 1;153 vp8->sequence_ok = 1;
154 vp8->sequence_dirty = 0;
155 vp8->got_keyframe = 1;
144 } else {156 } else {
145 int can_continue = vp8->data && !vp8->is_keyframe &&157 int can_continue = vp8->data && !vp8->is_keyframe &&
146 avio_tell(vp8->data) >= vp8->first_part_size;158 avio_tell(vp8->data) >= vp8->first_part_size;
147 if (!vp8->sequence_ok)159 if (!vp8->sequence_ok)
148 return AVERROR(EAGAIN);160 return AVERROR(EAGAIN);
161 if (!vp8->got_keyframe)
162 return vp8_broken_sequence(ctx, vp8, "Keyframe missing\n");
149 if (pictureid >= 0) {163 if (pictureid >= 0) {
150 if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {164 if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {
151 return vp8_broken_sequence(ctx, vp8,165 return vp8_broken_sequence(ctx, vp8,
@@ -179,6 +193,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, · 27 unmodified lines
179 }193 }
180 }194 }
181 if (vp8->data) {195 if (vp8->data) {
196 vp8->sequence_dirty = 1;
182 if (avio_tell(vp8->data) >= vp8->first_part_size) {197 if (avio_tell(vp8->data) >= vp8->first_part_size) {
183 int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);198 int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
184 if (ret < 0)199 if (ret < 0)
@@ -220,6 +235,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, · 35 unmodified lines
220 "Missed part of a keyframe, sequence broken\n");235 "Missed part of a keyframe, sequence broken\n");
221 } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {236 } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {
222 vp8->broken_frame = 1;237 vp8->broken_frame = 1;
238 vp8->sequence_dirty = 1;
223 } else {239 } else {
224 return vp8_broken_sequence(ctx, vp8,240 return vp8_broken_sequence(ctx, vp8,
225 "Missed part of the first partition, sequence broken\n");241 "Missed part of the first partition, sequence broken\n");
@@ -253,7 +269,11 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, · 27 unmodified lines
253 269
254static PayloadContext *vp8_new_context(void)270static PayloadContext *vp8_new_context(void)
255{271{
256 return av_mallocz(sizeof(PayloadContext));272 PayloadContext *vp8 = av_mallocz(sizeof(PayloadContext));
273 if (!vp8)
274 return NULL;
275 vp8->sequence_ok = 1;
276 return vp8;
257}277}
258 278
259static void vp8_free_context(PayloadContext *vp8)279static void vp8_free_context(PayloadContext *vp8)
@@ -262,6 +282,11 @@ static void vp8_free_context(PayloadContext *vp8) · 2 unmodified lines
262 av_free(vp8);282 av_free(vp8);
263}283}
264 284
285static int vp8_need_keyframe(PayloadContext *vp8)
286{
287 return vp8->sequence_dirty || !vp8->sequence_ok;
288}
289
265RTPDynamicProtocolHandler ff_vp8_dynamic_handler = {290RTPDynamicProtocolHandler ff_vp8_dynamic_handler = {
266 .enc_name = "VP8",291 .enc_name = "VP8",
267 .codec_type = AVMEDIA_TYPE_VIDEO,292 .codec_type = AVMEDIA_TYPE_VIDEO,
@@ -269,4 +294,5 @@ RTPDynamicProtocolHandler ff_vp8_dynamic_handler = { · 1 unmodified line
269 .alloc = vp8_new_context,294 .alloc = vp8_new_context,
270 .free = vp8_free_context,295 .free = vp8_free_context,
271 .parse_packet = vp8_handle_packet,296 .parse_packet = vp8_handle_packet,
297 .need_keyframe = vp8_need_keyframe,
272};298};
libavresample/dither.c+3−0
@@ -336,6 +336,9 @@ static void dither_init(DitherDSPContext *ddsp, · 335 unmodified lines
336 ddsp->dither_int_to_float = dither_int_to_float_rectangular_c;336 ddsp->dither_int_to_float = dither_int_to_float_rectangular_c;
337 else337 else
338 ddsp->dither_int_to_float = dither_int_to_float_triangular_c;338 ddsp->dither_int_to_float = dither_int_to_float_triangular_c;
339
340 if (ARCH_X86)
341 ff_dither_init_x86(ddsp, method);
339}342}
340 343
341DitherContext *ff_dither_alloc(AVAudioResampleContext *avr,344DitherContext *ff_dither_alloc(AVAudioResampleContext *avr,
libavresample/dither.h+5−0
@@ -85,4 +85,9 @@ void ff_dither_free(DitherContext **c); · 84 unmodified lines
85 */85 */
86int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src);86int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src);
87 87
88/* arch-specific initialization functions */
89
90void ff_dither_init_x86(DitherDSPContext *ddsp,
91 enum AVResampleDitherMethod method);
92
88#endif /* AVRESAMPLE_DITHER_H */93#endif /* AVRESAMPLE_DITHER_H */
libavresample/x86/Makefile+2−0
@@ -1,5 +1,7 @@
1OBJS += x86/audio_convert_init.o \1OBJS += x86/audio_convert_init.o \
2 x86/audio_mix_init.o \2 x86/audio_mix_init.o \
3 x86/dither_init.o \
3 4
4YASM-OBJS += x86/audio_convert.o \5YASM-OBJS += x86/audio_convert.o \
5 x86/audio_mix.o \6 x86/audio_mix.o \
7 x86/dither.o \
libavresample/x86/dither.asm+53−0
@@ -0,0 +1,53 @@
1;******************************************************************************
2;* x86 optimized dithering format conversion
3;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
4;*
5;* This file is part of FFmpeg.
6;*
7;* FFmpeg is free software; you can redistribute it and/or
8;* modify it under the terms of the GNU Lesser General Public
9;* License as published by the Free Software Foundation; either
10;* version 2.1 of the License, or (at your option) any later version.
11;*
12;* FFmpeg is distributed in the hope that it will be useful,
13;* but WITHOUT ANY WARRANTY; without even the implied warranty of
14;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15;* Lesser General Public License for more details.
16;*
17;* You should have received a copy of the GNU Lesser General Public
18;* License along with FFmpeg; if not, write to the Free Software
19;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20;******************************************************************************
21
22%include "libavutil/x86/x86util.asm"
23
24SECTION_RODATA 32
25
26pf_s16_scale: times 4 dd 32753.0
27
28SECTION_TEXT
29
30;------------------------------------------------------------------------------
31; void ff_quantize(int16_t *dst, float *src, float *dither, int len);
32;------------------------------------------------------------------------------
33
34INIT_XMM sse2
35cglobal quantize, 4,4,3, dst, src, dither, len
36 lea lenq, [2*lend]
37 add dstq, lenq
38 lea srcq, [srcq+2*lenq]
39 lea ditherq, [ditherq+2*lenq]
40 neg lenq
41 mova m2, [pf_s16_scale]
42.loop:
43 mulps m0, m2, [srcq+2*lenq]
44 mulps m1, m2, [srcq+2*lenq+mmsize]
45 addps m0, [ditherq+2*lenq]
46 addps m1, [ditherq+2*lenq+mmsize]
47 cvtps2dq m0, m0
48 cvtps2dq m1, m1
49 packssdw m0, m1
50 mova [dstq+lenq], m0
51 add lenq, mmsize
52 jl .loop
53 REP_RET
libavresample/x86/dither_init.c+39−0
@@ -0,0 +1,39 @@
1/*
2 * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "config.h"
22#include "libavutil/cpu.h"
23#include "libavutil/x86/cpu.h"
24#include "libavresample/dither.h"
25
26extern void ff_quantize_sse2(int16_t *dst, const float *src, float *dither,
27 int len);
28
29av_cold void ff_dither_init_x86(DitherDSPContext *ddsp,
30 enum AVResampleDitherMethod method)
31{
32 int mm_flags = av_get_cpu_flags();
33
34 if (EXTERNAL_SSE2(mm_flags)) {
35 ddsp->quantize = ff_quantize_sse2;
36 ddsp->ptr_align = 16;
37 ddsp->samples_align = 8;
38 }
39}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t