Turn off trellis optimization in the lossless mode

The trellis optimization would incur information loss. It needs to
be disabled in the lossless mode.

Change-Id: I3e73f2f466631b61729cadc38a2ed74656f73529
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 195f3d3..7863514 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1230,7 +1230,7 @@
                     coeff_ctx, AV1_XFORM_QUANT_FP);
 #endif  // CONFIG_NEW_QUANT
 #if !CONFIG_PVQ
-    if (x->plane[plane].eobs[block])
+    if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
       av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
 #endif
     dist_block(args->cpi, x, plane, block, blk_row, blk_col, tx_size,