Complexity of blocks is one of the key factors to influence the performance of reversible data hiding. By embedding data into blocks with smaller complexity, the invalid shifting in pixel value ordering (PVO) based reversible data hiding is largely reduced, thus increasing the imperceptibility. However, the existing techniques are not always accurate in complexity calculation, since context pixels are usually treated equally. As a result, a great number of invalid pixels are assigned too large a weight in complexity calculation, which inevitably affects the precision. In this paper, we propose a weighted average based novel strategy in complexity calculation. In this scheme, we calculate the weight of a certain context pixel with the help of its adjacent neighbors, which ensures the one in a smooth area is assigned a larger weight, and otherwise the opposite. Experimental results show that invalid shifting is largely reduced, thus our scheme is better in imperceptibility compared with the state of the art and has potential application in a lot of fields such as medical imaging.