AV1 RT: Add documentation for NonRD mode search

BUG=aomedia:2714

Change-Id: I05d3b23ae46e0736eef2f75d9d70e766f9773239
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index 31d8955..93a0c82 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -115,6 +115,30 @@
   bp->best_pred = NULL;
 }
 
+/*!\brief Runs Motion Estimation for a specific block and specific ref frame.
+ *
+ * \ingroup nonrd_mode_search
+ * \callgraph
+ * \callergraph
+ * Finds the best Motion Vector by running Motion Estimation for a specific
+ * block and a specific reference frame. Exits early if RDCost of Full Pel part
+ * exceeds best RD Cost fund so far
+ * \param[in]    cpi                      Top-level encoder structure
+ * \param[in]    x                        Pointer to structure holding all the
+ *                                        data for the current macroblock
+ * \param[in]    bsize                    Current block size
+ * \param[in]    mi_row                   Row index in 4x4 units
+ * \param[in]    mi_col                   Column index in 4x4 units
+ * \param[in]    tmp_mv                   Pointer to best found New MV
+ * \param[in]    rate_mv                  Pointer to Rate of the best new MV
+ * \param[in]    best_rd_sofar            RD Cost of the best mode found so far
+ * \param[in]    use_base_mv              Flag, indicating that tmp_mv holds
+ *                                        specific MV to start the search with
+ *
+ * \return Returns 0 if ME was terminated after Full Pel Search because too
+ * high RD Cost. Otherwise returns 1. Best New MV is placed into \c tmp_mv.
+ * Rate estimation for this vector is placed to \c rate_mv
+ */
 static int combined_motion_search(AV1_COMP *cpi, MACROBLOCK *x,
                                   BLOCK_SIZE bsize, int mi_row, int mi_col,
                                   int_mv *tmp_mv, int *rate_mv,
@@ -194,6 +218,34 @@
   return rv;
 }
 
+/*!\brief Searches for the best New Motion Vector.
+ *
+ * \ingroup nonrd_mode_search
+ * \callgraph
+ * \callergraph
+ * Finds the best Motion Vector by doing Motion Estimation. Uses reduced
+ * complexity ME for non-LAST frames or calls \c combined_motion_search
+ * for LAST reference frame
+ * \param[in]    cpi                      Top-level encoder structure
+ * \param[in]    x                        Pointer to structure holding all the
+ *                                        data for the current macroblock
+ * \param[in]    frame_mv                 Array that holds MVs for all modes
+ *                                        and ref frames
+ * \param[in]    ref_frame                Reference freme for which to find
+ *                                        the best New MVs
+ * \param[in]    gf_temporal_ref          Flag, indicating temporal reference
+ *                                        for GOLDEN frame
+ * \param[in]    bsize                    Current block size
+ * \param[in]    mi_row                   Row index in 4x4 units
+ * \param[in]    mi_col                   Column index in 4x4 units
+ * \param[in]    rate_mv                  Pointer to Rate of the best new MV
+ * \param[in]    best_rdc                 Pointer to the RD Cost for the best
+ *                                        mode found so far
+ *
+ * \return Returns -1 if the search was not done, otherwise returns 0.
+ * Best New MV is placed into \c frame_mv array, Rate estimation for this
+ * vector is placed to \c rate_mv
+ */
 static int search_new_mv(AV1_COMP *cpi, MACROBLOCK *x,
                          int_mv frame_mv[][REF_FRAMES],
                          MV_REFERENCE_FRAME ref_frame, int gf_temporal_ref,
@@ -245,6 +297,31 @@
   return 0;
 }
 
+/*!\brief Finds predicted motion vectors for a block.
+ *
+ * \ingroup nonrd_mode_search
+ * \callgraph
+ * \callergraph
+ * Finds predicted motion vectors for a block from a certain reference frame.
+ * First, it fills reference MV stack, then picks the test from the stack and
+ * predicts the final MV for a block for each mode.
+ * \param[in]    cpi                      Top-level encoder structure
+ * \param[in]    x                        Pointer to structure holding all the
+ *                                        data for the current macroblock
+ * \param[in]    ref_frame                Reference freme for which to find
+ *                                        ref MVs
+ * \param[in]    frame_mv                 Predicted MVs for a block
+ * \param[in]    tile_data                Pointer to struct holding adaptive
+ *                                        data/contexts/models for the tile
+ *                                        during encoding
+ * \param[in]    yv12_mb                  Buffer to hold predicted block
+ * \param[in]    bsize                    Current block size
+ * \param[in]    force_skip_low_temp_var  Flag indicating possible mode search
+ *                                        prune for low temporal variace  block
+ *
+ * \return Nothing is returned. Instead, predicted MVs are placed into
+ * \c frame_mv array
+ */
 static INLINE void find_predictors(AV1_COMP *cpi, MACROBLOCK *x,
                                    MV_REFERENCE_FRAME ref_frame,
                                    int_mv frame_mv[MB_MODE_COUNT][REF_FRAMES],
@@ -738,7 +815,7 @@
 
 /*!\brief Calculates RD Cost using Hadamard transform.
  *
- * \ingroup inter_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * \callergraph
  * Calculates RD Cost using Hadamard transform. For low bit depth this function
@@ -1136,7 +1213,7 @@
 
 /*!\brief Estimation of RD cost of an intra mode for Non-RD optimized case.
  *
- * \ingroup intra_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * \callergraph
  * Calculates RD Cost for an intra mode for a single TX block using Hadamard
@@ -1333,7 +1410,7 @@
 #define FILTER_SEARCH_SIZE 2
 /*!\brief Searches for the best intrpolation filter
  *
- * \ingroup inter_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * \callergraph
  * Iterates through subset of possible interpolation filters (currently
@@ -1603,7 +1680,7 @@
 
 /*!\brief Estimates best intra mode for inter mode search
  *
- * \ingroup inter_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * \callergraph
  *
diff --git a/av1/encoder/rdopt.h b/av1/encoder/rdopt.h
index cadd5d1..54086ad 100644
--- a/av1/encoder/rdopt.h
+++ b/av1/encoder/rdopt.h
@@ -98,7 +98,7 @@
 
 /*!\brief AV1 intra mode selection based on Non-RD optimized model.
  *
- * \ingroup intra_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * \callergraph
  * Top level function for Non-RD optimized intra mode selection.
@@ -126,7 +126,7 @@
 
 /*!\brief AV1 inter mode selection based on Non-RD optimized model.
  *
- * \ingroup inter_mode_search
+ * \ingroup nonrd_mode_search
  * \callgraph
  * Top level function for Non-RD optimized inter mode selection.
  * This finction will loop over subset of inter modes and select the best one
diff --git a/doc/dev_guide/av1_encoder.dox b/doc/dev_guide/av1_encoder.dox
index 3b1cf79..a5191d4 100644
--- a/doc/dev_guide/av1_encoder.dox
+++ b/doc/dev_guide/av1_encoder.dox
@@ -1293,3 +1293,10 @@
  * @{
  */
 /*! @} - end defgroup variance_partition */
+/*!\defgroup nonrd_mode_search NonRD Optimized Mode Search
+ * \ingroup encoder_algo
+ * This module describes NonRD Optimized Mode Search used in Real-Time mode.
+ * More details will be added.
+ * @{
+ */
+/*! @} - end defgroup nonrd_mode_search */