Hi all,
I made the attached patch. There might be a cleaner way, but this works
for me.
- Jan
On Wed, 2009-05-27 at 22:18 +0300, nez...@gmail.com wrote:
> The errors are probably due to the stricter aliasing requirements in GCC
> 4.4 :
> http://gcc.gnu.org/gcc-4.4/porting_to.html
>
>
>
> The error :
>
> cc1: warnings being treated as errors
> schromotionest.c: In function ‘schro_encoder_bigblock_estimation’:
> schromotionest.c:572: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:567: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:566: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:565: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:564: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:563: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:562: note: initialized from here
> schromotionest.c:407: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:407: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:407: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:524: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:525: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:541: error: dereferencing pointer ‘mvdc’ does break
> strict-aliasing rules
> schromotionest.c:523: note: initialized from here
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> Schrodinger-devel mailing list
> Schrodinger-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/schrodinger-devel
--
Jan Schmidt <thay...@noraisin.net>
commit 8b0c8b4a37e594a0d05459aeb09560b7a0641f67
Author: Jan Schmidt <thay...@noraisin.net>
Date: Wed Jun 10 15:14:36 2009 +0100
schromotionest: Use an anonymous union to avoid aliasing errors
Avoid strict-aliasing warnings about treating SchroMotionVector as
SchroMotionVectorDC by using an anonymous union for them in
SchroBlock.
diff --git a/schroedinger/schromotionest.c b/schroedinger/schromotionest.c
index aec43ef..4d42479 100644
--- a/schroedinger/schromotionest.c
+++ b/schroedinger/schromotionest.c
@@ -520,7 +520,7 @@ schro_motionest_superblock_dc (SchroMotionEst *me,
frame = get_downsampled (me->encoder_frame, 0);
- mvdc = (SchroMotionVectorDC *)&block->mv[0][0];
+ mvdc = &block->mvdc[0][0];
mvdc->split = 0;
mvdc->pred_mode = 0;
@@ -559,7 +559,7 @@ schro_motionest_superblock_dc_predicted (SchroMotionEst *me,
schro_motion_dc_prediction (me->motion, i, j, pred);
- mvdc = (SchroMotionVectorDC *)&block->mv[0][0];
+ mvdc = &block->mvdc[0][0];
mvdc->split = 0;
mvdc->pred_mode = 0;
mvdc->dc[0] = pred[0];
@@ -755,7 +755,7 @@ schro_motionest_block_dc (SchroMotionEst *me,
frame = get_downsampled (me->encoder_frame, 0);
- mvdc = (SchroMotionVectorDC *)&(block->mv[jj][ii]);
+ mvdc = &(block->mvdc[jj][ii]);
mvdc->split = 2;
mvdc->pred_mode = 0;
@@ -902,7 +902,7 @@ schro_motionest_subsuperblock_dc (SchroMotionEst *me,
frame = get_downsampled (me->encoder_frame, 0);
- mvdc = (SchroMotionVectorDC *)&block->mv[jj][ii];
+ mvdc = &(block->mvdc[jj][ii]);
mvdc->split = 1;
mvdc->pred_mode = 0;
@@ -1205,13 +1205,10 @@ schro_motionest_superblock_get_metric (SchroMotionEst *me,
width = xmax - xmin;
height = ymax - ymin;
- mv = &block->mv[0][0];
-
- if (mv->pred_mode == 0) {
- SchroMotionVectorDC *mvdc = (SchroMotionVectorDC *)mv;
+ if (block->mvdc[0][0].pred_mode == 0)
+ return schro_metric_get_dc (&orig, block->mvdc[0][0].dc[0], width, height);
- return schro_metric_get_dc (&orig, mvdc->dc[0], width, height);
- }
+ mv = &block->mv[0][0];
if (mv->pred_mode == 1 || mv->pred_mode == 2) {
SchroFrame *ref_frame;
SchroFrameData ref_data;
diff --git a/schroedinger/schromotionest.h b/schroedinger/schromotionest.h
index ce4c29c..3552546 100644
--- a/schroedinger/schromotionest.h
+++ b/schroedinger/schromotionest.h
@@ -47,7 +47,10 @@ struct _SchroBlock {
double score;
- SchroMotionVector mv[4][4];
+ union {
+ SchroMotionVectorDC mvdc[4][4];
+ SchroMotionVector mv[4][4];
+ };
};
SchroMotionEst *schro_motionest_new (SchroEncoderFrame *frame);
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Schrodinger-devel mailing list
Schrodinger-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel