diff options
| author | niels <[email protected]> | 2011-09-15 18:20:39 (GMT) |
|---|---|---|
| committer | niels <[email protected]> | 2011-09-15 18:20:39 (GMT) |
| commit | 78bf819f7f4ae1ea65a5c1995ac66c56acad2432 (patch) | |
| tree | b9558bc0f80c5d9420f423dfea90dbb6e5a3b475 | |
| parent | 7f3d03e1421ad9e63ac52697233352977314e1d9 (diff) | |
saver maximum size for encoding high resolution video
fixed a possible segfault in white emboss, fixes #0000335
added assertion for STRICT_CHECKING and clamping index of resampling contexts
4 files changed, 30 insertions, 11 deletions
diff --git a/veejay-current/veejay-server/libel/vj-avcodec.c b/veejay-current/veejay-server/libel/vj-avcodec.c index 8959384..478e55d 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.c +++ b/veejay-current/veejay-server/libel/vj-avcodec.c @@ -130,7 +130,7 @@ static vj_encoder *vj_avcodec_new_encoder( int id, editlist *el, char *filename) #endif e->data[0] = (uint8_t*) vj_calloc(sizeof(uint8_t) * el->video_width * el->video_height * 3 ); e->data[1] = e->data[0] + el->video_width * el->video_height; - e->data[2] = e->data[1] + el->video_width * el->video_height /2; + e->data[2] = e->data[1] + el->video_width * el->video_height; //@ for all pixfmt #ifdef SUPPORT_READ_DV2 } #endif diff --git a/veejay-current/veejay-server/libsamplerec/samplerecord.c b/veejay-current/veejay-server/libsamplerec/samplerecord.c index 298ebd8..66ceba0 100644 --- a/veejay-current/veejay-server/libsamplerec/samplerecord.c +++ b/veejay-current/veejay-server/libsamplerec/samplerecord.c @@ -159,6 +159,7 @@ static int sample_start_encoder(sample_info *si, editlist *el, int format, long si->encoder_succes_frames = 0; int tmp = el->video_width * el->video_height; + int tmp1 = (el->video_width/2 ) * el->video_height; if(format==ENCODER_DVVIDEO) si->encoder_max_size = ( el->video_height == 480 ? 120000: 144000); @@ -171,11 +172,11 @@ static int sample_start_encoder(sample_info *si, editlist *el, int format, long case ENCODER_YUV422: case ENCODER_YUV422F: case ENCODER_YUV4MPEG: - si->encoder_max_size = 2048 + tmp + (tmp/2) + (tmp/2);break; + si->encoder_max_size = 2048 + tmp + tmp1 + tmp1;break; case ENCODER_LZO: si->encoder_max_size = (tmp * 3 ); break; default: - si->encoder_max_size = ( 8 * 65535 ); + si->encoder_max_size = ( 16 * 65535 ); break; } diff --git a/veejay-current/veejay-server/libvje/effects/emboss.c b/veejay-current/veejay-server/libvje/effects/emboss.c index ea18df3..c27bea0 100644 --- a/veejay-current/veejay-server/libvje/effects/emboss.c +++ b/veejay-current/veejay-server/libvje/effects/emboss.c @@ -147,8 +147,12 @@ void white_emboss_framedata(VJFrame *frame, int width, int height) unsigned int r, c; int val; uint8_t *Y = frame->data[0]; - for (r = 0; r < (width * height); r += width) { - for (c = 0; c < width; c++) { + + for (r = 1; r < (width * height ); r += width) { + + Y[ r + c + 0 ] = pixel_Y_lo_; + + for (c = 1; c < (width-1); c++) { val = (Y[r - 1 + c - 1] - Y[r - 1 + c] - Y[r - 1 + c + 1] + @@ -159,8 +163,9 @@ void white_emboss_framedata(VJFrame *frame, int width, int height) Y[r + 1 + c] - Y[r + 1 + c + 1] ) / 9; Y[c + r] = CLAMP_Y(val); - } + + Y[ r + c + 1] = pixel_Y_lo_; } } diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index 13a4068..729b7b7 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -1598,14 +1598,21 @@ int vj_perform_fill_audio_buffers(veejay_t * info, uint8_t *audio_buf, uint8_t * rs = 1; } } -#ifdef STRICT_CHECKING - assert( resample_context[ n_frames ] != NULL ); -#endif + if( rs ) { if( speed < 0 ) vj_perform_reverse_audio_frame(info, n_samples, sambuf ); - n_samples = audio_resample( resample_context[n_frames-2],audio_buf, sambuf, n_samples ); + + int sc = n_frames - 2; +#ifdef STRICT_CHECKING + assert( sc >= 0 ); + assert( sc <= MAX_SPEED ); +#else + if( sc < 0 ) sc = 0; else if ( sc > MAX_SPEED ) sc = MAX_SPEED; +#endif + + n_samples = audio_resample( resample_context[sc],audio_buf, sambuf, n_samples ); } } else if( speed == 0 ) { n_samples = len = pred_len; @@ -1638,8 +1645,14 @@ int vj_perform_fill_audio_buffers(veejay_t * info, uint8_t *audio_buf, uint8_t * int val = *sampled_down; if( cur_sfd == 0 ) { + int sc = max_sfd - 2; +#ifdef STRICT_CHECKING + assert(sc>=0); + assert(sc <= MAX_SPEED ); +#endif + if( sc < 0 ) sc = 0; else if ( sc > MAX_SPEED ) sc = MAX_SPEED; // @ resample buffer - n_samples = audio_resample( downsample_context[ max_sfd-2 ], + n_samples = audio_resample( downsample_context[ sc ], down_sample_buffer,audio_buf, n_samples ); *sampled_down = n_samples / max_sfd; val = n_samples / max_sfd; |

