]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add doxy comments, based on Loren's explanations posted here:
authorgpoirier <gpoirier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 31 Mar 2007 22:39:43 +0000 (22:39 +0000)
committergpoirier <gpoirier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 31 Mar 2007 22:39:43 +0000 (22:39 +0000)
Date: Mar 30, 2007 9:00 PM
Subject: Re: [Ffmpeg-devel] Motion Estimation in snow.c for Waevelet encoded frames (DWT)

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@8579 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/motion_est.c
libavcodec/motion_est_template.c
libavcodec/mpegvideo.h

index 2e8b1d34bc9465d6923fd07a1c509196e08b3ac7..cb9731c3e2fc6f2cb226265ad58442e2dccd9061 100644 (file)
@@ -103,6 +103,9 @@ static int get_flags(MotionEstContext *c, int direct, int chroma){
            + (chroma ? FLAG_CHROMA : 0);
 }
 
+/*! \brief compares two blocks, which may be full macroblocks or may be
+    partitions thereof.
+ */
 static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
                       const int size, const int h, int ref_index, int src_index,
                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
index 897c08e3dfc0fd535fb2b034d3c91e8a525bc8e9..e0142502695b1b09dba9ec37a74eeddda5f9a761 100644 (file)
@@ -991,13 +991,24 @@ static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dm
         return   var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
 }
 
+/*!
+   \param P[10][2] a list of candidate mvs to check before starting the
+   iterative search. If one of the candidates is close to the optimal mv, then
+   it takes fewer iterations. And it increases the chance that we find the
+   optimal mv.
+ */
 static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
                              int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
                              int ref_mv_scale, int flags, int size, int h)
 {
     MotionEstContext * const c= &s->me;
-    int best[2]={0, 0};
-    int d, dmin;
+    int best[2]={0, 0};      /*!< x and y coordinates of the best motion vector.
+                               i.e. the difference between the position of the
+                               block current being encoded and the position of
+                               the block chosen to predict it from. */
+    int d;                   ///< the score (cmp + penalty) of any given mv
+    int dmin;                /*!< the best value of d, i.e. the score
+                               corresponding to the mv stored in best[]. */
     int map_generation;
     int penalty_factor;
     const int ref_mv_stride= s->mb_stride; //pass as arg  FIXME
index fd89f38e575658ee25caef820bf077b375af27ad..80e0f9065f30edb32794067b5fc162ce933e630c 100644 (file)
@@ -162,7 +162,11 @@ typedef struct MotionEstContext{
     uint32_t *score_map;               ///< map to store the scores
     int map_generation;
     int pre_penalty_factor;
-    int penalty_factor;
+    int penalty_factor;                /*!< an estimate of the bits required to
+                                        code a given mv value, e.g. (1,0) takes
+                                        more bits than (0,0). We have to
+                                        estimate whether any reduction in
+                                        residual is worth the extra bits. */
     int sub_penalty_factor;
     int mb_penalty_factor;
     int flags;