Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-09 13:24:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-09 13:24:15 +0400
commitd20c129a9cef276dd7d54c3cd03a6e4cfb024cfa (patch)
treebceac66f3b03f347900beec56c6efa2adc98beb9 /source/blender/imbuf
parentc2863e3f9b2a394ac943a8e0e982de8667e20b7e (diff)
style cleanup: whitespace/operators
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/anim_movie.c27
-rw-r--r--source/blender/imbuf/intern/indexer.c44
-rw-r--r--source/blender/imbuf/intern/scaling.c104
3 files changed, 74 insertions, 101 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 9f3ed6797be..5d8c65f7971 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -471,8 +471,7 @@ static int startffmpeg(struct anim * anim)
videoStream = -1;
for (i = 0; i < pFormatCtx->nb_streams; i++)
- if (pFormatCtx->streams[i]->codec->codec_type
- == AVMEDIA_TYPE_VIDEO) {
+ if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
streamcount--;
continue;
@@ -502,9 +501,9 @@ static int startffmpeg(struct anim * anim)
return -1;
}
- anim->duration = ceil(pFormatCtx->duration
- * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate)
- / AV_TIME_BASE);
+ anim->duration = ceil(pFormatCtx->duration *
+ av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate) /
+ AV_TIME_BASE);
frs_num = pFormatCtx->streams[videoStream]->r_frame_rate.num;
frs_den = pFormatCtx->streams[videoStream]->r_frame_rate.den;
@@ -658,8 +657,8 @@ static void ffmpeg_postprocess(struct anim * anim)
anim->pFrame,
anim->pCodecCtx->pix_fmt,
anim->pCodecCtx->width,
- anim->pCodecCtx->height)
- < 0) {
+ anim->pCodecCtx->height) < 0)
+ {
filter_y = TRUE;
}
else {
@@ -785,8 +784,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
"pkt_pts=%lld, guessed_pts=%lld\n",
(anim->pFrame->pts == AV_NOPTS_VALUE) ?
-1 : (long long int)anim->pFrame->pts,
- (anim->pFrame->pkt_pts
- == AV_NOPTS_VALUE) ?
+ (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ?
-1 : (long long int)anim->pFrame->pkt_pts,
(long long int)anim->next_pts);
break;
@@ -921,12 +919,11 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
}
else {
pts_to_search = (long long)
- floor(((double) position)
- / pts_time_base / frame_rate + 0.5);
+ floor(((double) position) /
+ pts_time_base / frame_rate + 0.5);
if (st_time != AV_NOPTS_VALUE) {
- pts_to_search += st_time / pts_time_base
- / AV_TIME_BASE;
+ pts_to_search += st_time / pts_time_base / AV_TIME_BASE;
}
}
@@ -1001,8 +998,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
}
}
else {
- pos = (long long) (position - anim->preseek)
- * AV_TIME_BASE / frame_rate;
+ pos = (long long) (position - anim->preseek) *
+ AV_TIME_BASE / frame_rate;
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"NO INDEX seek pos = %lld, st_time = %lld\n",
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 3095f5639fe..d823df11e36 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -68,9 +68,8 @@ static int tc_types[] = { IMB_TC_RECORD_RUN,
anim_index_builder * IMB_index_builder_create(const char * name)
{
- anim_index_builder * rv
- = MEM_callocN(sizeof(struct anim_index_builder),
- "index builder");
+ anim_index_builder * rv = MEM_callocN(sizeof(struct anim_index_builder),
+ "index builder");
fprintf(stderr, "Starting work on index: %s\n", name);
@@ -182,17 +181,17 @@ struct anim_index * IMB_indexer_open(const char * name)
fseek(fp, 0, SEEK_END);
- idx->num_entries = (ftell(fp) - 12)
- / (sizeof(int) // framepos
- + sizeof(unsigned long long) // seek_pos
- + sizeof(unsigned long long) // seek_pos_dts
- + sizeof(unsigned long long) // pts
- );
+ idx->num_entries = (ftell(fp) - 12) /
+ (sizeof(int) + // framepos
+ sizeof(unsigned long long) + // seek_pos
+ sizeof(unsigned long long) + // seek_pos_dts
+ sizeof(unsigned long long) // pts
+ );
fseek(fp, 12, SEEK_SET);
- idx->entries = MEM_callocN(sizeof(struct anim_index_entry)
- * idx->num_entries, "anim_index_entries");
+ idx->entries = MEM_callocN(sizeof(struct anim_index_entry) *
+ idx->num_entries, "anim_index_entries");
for (i = 0; i < idx->num_entries; i++) {
fread(&idx->entries[i].frameno,
@@ -260,7 +259,7 @@ int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno)
if (idx->entries[middle].frameno < frameno) {
first = middle;
- ++first;
+ first++;
len = len - half - 1;
}
else {
@@ -301,9 +300,8 @@ int IMB_indexer_can_scan(struct anim_index * idx,
{
/* makes only sense, if it is the same I-Frame and we are not
* trying to run backwards in time... */
- return (IMB_indexer_get_seek_pos(idx, old_frame_index)
- == IMB_indexer_get_seek_pos(idx, new_frame_index) &&
- old_frame_index < new_frame_index);
+ return (IMB_indexer_get_seek_pos(idx, old_frame_index) == IMB_indexer_get_seek_pos(idx, new_frame_index) &&
+ old_frame_index < new_frame_index);
}
void IMB_indexer_close(struct anim_index * idx)
@@ -515,9 +513,9 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
rv->c->pix_fmt = PIX_FMT_YUVJ420P;
}
- rv->c->sample_aspect_ratio
- = rv->st->sample_aspect_ratio
- = st->codec->sample_aspect_ratio;
+ rv->c->sample_aspect_ratio =
+ rv->st->sample_aspect_ratio =
+ st->codec->sample_aspect_ratio;
rv->c->time_base.den = 25;
rv->c->time_base.num = 1;
@@ -755,8 +753,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim
/* Find the video stream */
context->videoStream = -1;
for (i = 0; i < context->iFormatCtx->nb_streams; i++)
- if (context->iFormatCtx->streams[i]->codec->codec_type
- == AVMEDIA_TYPE_VIDEO) {
+ if (context->iFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
streamcount--;
continue;
@@ -895,8 +892,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
if (frame_finished) {
unsigned long long s_pos = seek_pos;
unsigned long long s_dts = seek_pos_dts;
- unsigned long long pts
- = av_get_pts_from_frame(context->iFormatCtx, in_frame);
+ unsigned long long pts = av_get_pts_from_frame(context->iFormatCtx, in_frame);
for (i = 0; i < context->num_proxy_sizes; i++) {
add_to_proxy_output_ffmpeg(
@@ -908,8 +904,8 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
start_pts_set = TRUE;
}
- frameno = floor((pts - start_pts)
- * pts_time_base * frame_rate + 0.5f);
+ frameno = floor((pts - start_pts) *
+ pts_time_base * frame_rate + 0.5f);
/* decoding starts *always* on I-Frames,
so: P-Frames won't work, even if all the
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 7f5430dad8a..3ccb6739beb 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -367,10 +367,8 @@ static void enlarge_picture_byte(
unsigned char* src, unsigned char* dst, int src_width,
int src_height, int dst_width, int dst_height)
{
- double ratiox = (double) (dst_width - 1.0)
- / (double) (src_width - 1.001);
- double ratioy = (double) (dst_height - 1.0)
- / (double) (src_height - 1.001);
+ double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
+ double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
uintptr_t x_src, dx_src, x_dst;
uintptr_t y_src, dy_src, y_dst;
@@ -395,41 +393,25 @@ static void enlarge_picture_byte(
unsigned long x = (x_src >> 16) * 4;
- *dst++ = ((((line1[x] * weight1y) >> 16)
- * weight1x) >> 16)
- + ((((line2[x] * weight2y) >> 16)
- * weight1x) >> 16)
- + ((((line1[4 + x] * weight1y) >> 16)
- * weight2x) >> 16)
- + ((((line2[4 + x] * weight2y) >> 16)
- * weight2x) >> 16);
-
- *dst++ = ((((line1[x + 1] * weight1y) >> 16)
- * weight1x) >> 16)
- + ((((line2[x + 1] * weight2y) >> 16)
- * weight1x) >> 16)
- + ((((line1[4 + x + 1] * weight1y) >> 16)
- * weight2x) >> 16)
- + ((((line2[4 + x + 1] * weight2y) >> 16)
- * weight2x) >> 16);
-
- *dst++ = ((((line1[x + 2] * weight1y) >> 16)
- * weight1x) >> 16)
- + ((((line2[x + 2] * weight2y) >> 16)
- * weight1x) >> 16)
- + ((((line1[4 + x + 2] * weight1y) >> 16)
- * weight2x) >> 16)
- + ((((line2[4 + x + 2] * weight2y) >> 16)
- * weight2x) >> 16);
-
- *dst++ = ((((line1[x + 3] * weight1y) >> 16)
- * weight1x) >> 16)
- + ((((line2[x + 3] * weight2y) >> 16)
- * weight1x) >> 16)
- + ((((line1[4 + x + 3] * weight1y) >> 16)
- * weight2x) >> 16)
- + ((((line2[4 + x + 3] * weight2y) >> 16)
- * weight2x) >> 16);
+ *dst++ = ((((line1[x] * weight1y) >> 16) * weight1x) >> 16) +
+ ((((line2[x] * weight2y) >> 16) * weight1x) >> 16) +
+ ((((line1[4 + x] * weight1y) >> 16) * weight2x) >> 16) +
+ ((((line2[4 + x] * weight2y) >> 16) * weight2x) >> 16);
+
+ *dst++ = ((((line1[x + 1] * weight1y) >> 16) * weight1x) >> 16) +
+ ((((line2[x + 1] * weight2y) >> 16) * weight1x) >> 16) +
+ ((((line1[4 + x + 1] * weight1y) >> 16) * weight2x) >> 16) +
+ ((((line2[4 + x + 1] * weight2y) >> 16) * weight2x) >> 16);
+
+ *dst++ = ((((line1[x + 2] * weight1y) >> 16) * weight1x) >> 16) +
+ ((((line2[x + 2] * weight2y) >> 16) * weight1x) >> 16) +
+ ((((line1[4 + x + 2] * weight1y) >> 16) * weight2x) >> 16) +
+ ((((line2[4 + x + 2] * weight2y) >> 16) * weight2x) >> 16);
+
+ *dst++ = ((((line1[x + 3] * weight1y) >> 16) * weight1x) >> 16) +
+ ((((line2[x + 3] * weight2y) >> 16) * weight1x) >> 16) +
+ ((((line1[4 + x + 3] * weight1y) >> 16) * weight2x) >> 16) +
+ ((((line2[4 + x + 3] * weight2y) >> 16) * weight2x) >> 16);
x_src += dx_src;
}
@@ -578,10 +560,8 @@ static void enlarge_picture_float(
float* src, float* dst, int src_width,
int src_height, int dst_width, int dst_height)
{
- double ratiox = (double) (dst_width - 1.0)
- / (double) (src_width - 1.001);
- double ratioy = (double) (dst_height - 1.0)
- / (double) (src_height - 1.001);
+ double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
+ double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
uintptr_t x_dst;
uintptr_t y_dst;
double x_src, dx_src;
@@ -613,25 +593,25 @@ static void enlarge_picture_float(
uintptr_t x = ((int) x_src) * 4;
- *dst++ = line1[x] * w11
- + line2[x] * w21
- + line1[4 + x] * w12
- + line2[4 + x] * w22;
-
- *dst++ = line1[x + 1] * w11
- + line2[x + 1] * w21
- + line1[4 + x + 1] * w12
- + line2[4 + x + 1] * w22;
-
- *dst++ = line1[x + 2] * w11
- + line2[x + 2] * w21
- + line1[4 + x + 2] * w12
- + line2[4 + x + 2] * w22;
-
- *dst++ = line1[x + 3] * w11
- + line2[x + 3] * w21
- + line1[4 + x + 3] * w12
- + line2[4 + x + 3] * w22;
+ *dst++ = line1[x] * w11 +
+ line2[x] * w21 +
+ line1[4 + x] * w12 +
+ line2[4 + x] * w22;
+
+ *dst++ = line1[x + 1] * w11 +
+ line2[x + 1] * w21 +
+ line1[4 + x + 1] * w12 +
+ line2[4 + x + 1] * w22;
+
+ *dst++ = line1[x + 2] * w11 +
+ line2[x + 2] * w21 +
+ line1[4 + x + 2] * w12 +
+ line2[4 + x + 2] * w22;
+
+ *dst++ = line1[x + 3] * w11 +
+ line2[x + 3] * w21 +
+ line1[4 + x + 3] * w12 +
+ line2[4 + x + 3] * w22;
x_src += dx_src;
}